-
Open AWS CloudWatch console.
- Click the In alarm on the left menu.
- Click the Create alarm button.

-
At Step 1: Specify metric and conditions page.
- Click the Select metric button.

- At Select metric popup.
- Click the BooksList_Lambda at the Custom namespaces.

- Next, click the env.

- Check the staging.
- Click the Select metric button.

- 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.

-
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.

-
Open the email that you chose to receive the notification before.
- Click the Confirm subscription.

- Then you will receive the Subscription confirmed notification.

-
Back to Step 2: Configure actions page.
- Scroll down to the bottom and click the Next button.

-
At Step 3: Add name and description page.
- Enter
fcaj-fail-connect-to-dynamodb-alarm at Alarm name.
- Click the Next button.

-
At Step 4: Preview and create page.
- Click the Create alarm button.

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

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

-
Open the email that you chose to receive the notification before.
-
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.

- Click the fcaj-fail-connect-to-dynamodb-alarm at Name. You can see the histogram of the metric graph indicating the threshold was crossed.
