Day-46: Set up CloudWatch alarms and SNS topic in AWS

What is Amazon CloudWatch?

Amazon CloudWatch monitors your Amazon Web Services (AWS) resources and the applications you run on AWS in real time. You can use CloudWatch to collect and track metrics, which are variables you can measure for your resources and applications.

What is Amazon SNS?

Amazon Simple Notification Service is a notification service provided as part of Amazon Web Services since 2010. It provides a low-cost infrastructure for mass delivery of messages, predominantly to mobile users.

(Note :

  • Billing metric data is stored in the US East (N. Virginia) Region and represents worldwide charges.

Thus, have to go to us-east-1 region for Billing metrics.

  • If necessary, change the Region to US East (N. Virginia)*. Billing metric data is stored in this Region and represents worldwide charges.*

To create CloudWatch alarm for the billing metrics also need to be in us-east-1

)

Task :

Create a CloudWatch alarm that monitors your billing and send an email to you when a it reaches $2.

To enable the monitoring of estimated charges

Open the AWS Billing console at https://console.aws.amazon.com/billing/.

In the navigation pane, choose Billing Preferences.

Choose Receive Billing Alerts.

Choose Save preferences.

Creating a billing alarm

Open the CloudWatch console

In the navigation pane, choose Alarms, and then choose All alarms.

Choose Create alarm.

Choose Select metric.

In Browse, choose Billing, and then choose Total Estimated Charge.

Select the box for the EstimatedCharges metric, and then choose Select metric.

For Statistic, choose Maximum.

For Period, choose 6 hours.

For Threshold type, choose Static.

For Whenever EstimatedCharges is, choose Greater.

define a threshold value that triggers your alarm. here threshold value is 2$.

Under Notification, specify an Amazon SNS topic to be notified when your alarm is in the ALARM state.

You can select an existing Amazon SNS topic or create a new Amazon SNS topic by selecting 'Create new topic'.

If you want your alarm to send multiple notifications for the same alarm state or for different alarm states, choose Add notification.

choose Next.

Under Name and description, enter a name for your alarm.

Under Preview and create, make sure that your configuration is correct, and then choose Create alarm.

Billing alarm is created.

Click on View SNS Subscription. Select the checkbox and click on Request confirmation. By doing this, you will receive an email to your given email id. Click on Confirm subscription from your mobile device. The status will change to Confirmed.

Delete your billing Alarm that you created now.

Select the checkbox of the alarm you want to delete. Navigate and click on Actions. Under it, click on Delete. Again click on Delete.

Your alarm will get deleted.

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )

0
Subscribe to my newsletter

Read articles from Prathmesh Vibhute directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prathmesh Vibhute
Prathmesh Vibhute