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.

Read more about cloudwatch from the official documentation here

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.

Read more about it here

Task :

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

(You can keep it for your future use)

1 . Create a Billing Alarm in CloudWatch:

  • Go to the AWS Management Console.Open the "CloudWatch" service.

  • In the left navigation pane, select "Alarms" and then click on "Billing".Click on "Create Alarm".

  • Choose "Total Estimated Charge" as the metric.Set the threshold value to $2 and click on "Next."

  • Configure the actions to be taken when the alarm state changes. Choose "In Alarm" and select "Create new topic" and topic name you can keep it as default and Enter your Email ID and click on "create topic" and click on "Next."

  • In the Add name and description keep its as you like and click on "Next."

  • Now Preview your steps and click on "create alarm."

  • Now open your Email and click on "AWS notification" which is send by AWS

  • Now click on Confirm subscription.

  • Now comeback to your Cloud watch > In alarm there you will see "View SNS subscription" click on it.

  • After that your "Amazon SNS" page will open there you should get confirm.

Congratulations! You've successfully set up a CloudWatch alarm that monitors your AWS billing and sends an email notification to your chosen SNS topic when the estimated charges reach your specified threshold.

Delete your billing Alarm that you created now

Deleting the Billing Alarm (Optional):

  • In the CloudWatch console, under "Alarms," navigate to "Billing alarms."

  • Select the billing alarm you created.

  • Click on "Actions" and choose "Delete alarm."

  • Confirm the deletion to remove the alarm.