Creating Alerts with CloudWatch Alarm

  1. Open AWS CloudWatch console.

    • Click the In alarm on the left menu.
    • Click the Create alarm button. CreateAlarm
  2. At Step 1: Specify metric and conditions page.

    • Click the Select metric button. CreateAlarm
    • At Select metric popup.
      • Click the BooksList_Lambda at the Custom namespaces. CreateAlarm
      • Next, click the env. CreateAlarm
      • Check the staging.
      • Click the Select metric button. CreateAlarm
    • Choose the Sum at Statistic.
    • Choose the Static at Threshold type.
    • Choose the Greater/Equal at Whenever FailedConnectToDynamoDB is….
    • Enter 2 at than….
    • Click the Next button. CreateAlarm
  3. At Step 2: Configure actions page.

    • Choose the In alarm at Alarm state trigger.
    • Choose the Create new topic at Send a notification to the following SNS topic.
    • Enter fcj_cloudwatch_alarm_topic at Create a new topic….
    • Enter the email that you want to receive the notification.
    • Click the Create topic button. CreateAlarm
  4. Open the email that you chose to receive the notification before.

    • Click the Confirm subscription. CreateAlarm
    • Then you will receive the Subscription confirmed notification. CreateAlarm
  5. Back to Step 2: Configure actions page.

    • Scroll down to the bottom and click the Next button. CreateAlarm
  6. At Step 3: Add name and description page.

    • Enter fcaj-fail-connect-to-dynamodb-alarm at Alarm name.
    • Click the Next button. CreateAlarm
  7. At Step 4: Preview and create page.

    • Click the Create alarm button. CreateAlarm
  8. You can see the fcaj-fail-connect-to-dynamodb-alarm that we created in the previous step and the state is currently Insufficient Data. CreateAlarm

  9. Open Postman to recall the api twice, as we set the condition for more or equal to 2 failures. CloudWatchMetrics

  10. Open the email that you chose to receive the notification before.

  11. Back to AWS CloudWatch console.

    • Click the In alarm on the left menu or view all alarms.
    • You can see your alarm is now in the In alarm state. CloudWatchMetrics
    • Click the fcaj-fail-connect-to-dynamodb-alarm at Name. You can see the histogram of the metric graph indicating the threshold was crossed. CloudWatchMetrics