Set up CloudWatch alarms and SNS topic in AWS

Set up CloudWatch alarms and SNS topic in AWS

·

2 min read

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.

Task :

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

Access the AWS Billing console by navigating to https://console.aws.amazon.com/billing/.

In the left-hand menu, click on Billing Preferences.

Opt for Receive Billing Alerts.

Click on Save preferences.

Now, let's set up a billing alarm:

Launch the CloudWatch console.

In the side menu, select Alarms, then click on All alarms.

Click on Create alarm.

Select the metric by choosing Select metric.

Navigate to Billing in the Browse section, and click on Total Estimated Charge.

Tick the box next to the EstimatedCharges metric, and click on Select metric.

Set Statistic to Maximum, Period to 6 hours.

For Threshold type, choose Static, and for Whenever EstimatedCharges is, select Greater. Define the threshold value, e.g., $2.

Under Notification, designate an Amazon SNS topic to be notified when the alarm is in the ALARM state. You can either choose an existing Amazon SNS topic or create a new one by selecting 'Create new topic'.

If you wish to receive multiple notifications for the same or different alarm states, click on Add notification.

Click Next.

Provide a name for your alarm under Name and description.

Review your configuration under Preview and create, ensuring it is accurate, and then click on Create alarm.

Your billing alarm has been successfully created.

Now, proceed to delete the billing alarm you just created.


Thank you for taking the time to read this article! Happy Learning!