Day-46: Set Up CloudWatch Alarms and SNS Topic in AWS

Dhruv MoradiyaDhruv Moradiya
3 min read

Hey, learners! 🎉
You’ve been working with AWS services for at least the past 45 days. But have you ever wondered what would happen if a service kept charging your account, and you didn’t realize it until your pocket money was gone? 😱


What is Amazon CloudWatch?

Amazon CloudWatch is a monitoring service for AWS resources and the applications running on them. It provides real-time metrics, allowing you to collect and track data like CPU usage, memory usage, and billing information.

➡️ Learn more from the official documentation.


What is Amazon SNS?

Amazon Simple Notification Service (SNS) is a messaging service designed for mass delivery of messages—ideal for mobile users. It’s cost-effective and allows you to send notifications to subscribers via email, SMS, or other means.

➡️ Read more about SNS here.


Today's Task

We’ll set up a CloudWatch alarm to monitor your billing and notify you via email when the cost exceeds $2. Here’s what we’ll cover:

  1. Create a CloudWatch Alarm

  2. Send Notifications via SNS

  3. Delete the Billing Alarm


Step-by-Step Guide

1. Create a CloudWatch Alarm for Billing

  • Requirement: Ensure billing alerts are enabled in your AWS account.

  • Go to the CloudWatch console.

  • Select Billing under metrics (use the Billing metric namespace).

  • Choose the metric EstimatedCharges.

  • Set a threshold: $2 (you can adjust this based on your budget).

  • Configure the alarm to trigger when the threshold is breached.

Tip: Make sure your AWS region supports billing alarms (usually, this is only available in the US East (N. Virginia) region).


2. Send Notifications via SNS

  • Requirement: Create an SNS topic to receive notifications.

  • Go to the SNS console and create a new topic (e.g., BillingAlertsTopic).

  • Add an email subscription to the topic.

  • Confirm the subscription via the email link sent to your inbox.

  • Link the SNS topic to your CloudWatch alarm during the alarm setup.

Pro Tip: Use an easily accessible email address so you never miss important notifications.


3. Delete the Billing Alarm

  • Navigate to the CloudWatch console.

  • Go to the Alarms section.

  • Select the billing alarm you created.

  • Click Delete to remove it.

Why Delete? This helps you practice managing alarms and ensures you don’t get unnecessary notifications during testing.


Need More Help?

If you’re stuck or need further clarification:


Conclusion

By setting up a CloudWatch alarm and integrating it with an SNS topic, you ensure you’ll never be caught off guard by unexpected AWS charges. This is an essential skill for any AWS user aiming to manage costs effectively. 💰

Let us know how it went in the comments, or share any tips you discovered during this task. Happy learning! 🚀


0
Subscribe to my newsletter

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

Written by

Dhruv Moradiya
Dhruv Moradiya