Day 46 : Set up CloudWatch alarms and SNS topic in AWS
Table of contents
What is Amazon CloudWatch?
Amazon CloudWatch is a comprehensive monitoring and observability service provided by AWS. It allows you to collect and track metrics, monitor log files, set alarms, and automatically react to changes in your AWS resources and applications.
Here are some key features of Amazon CloudWatch:
Metrics Collection: You can collect and track metrics for AWS services and custom applications. This includes CPU usage, memory usage, and request counts.
Log Monitoring: CloudWatch Logs enables you to monitor, store, and access log files from Amazon EC2 instances, AWS CloudTrail, and other sources.
Alarms: You can set alarms to automatically perform actions like sending notifications or scaling resources when certain thresholds are met.
Dashboards: Create custom dashboards to visualize and analyze your metrics and logs in one place.
Integration: CloudWatch integrates with over 70 AWS services, providing a unified view of your operational health.
What is Amazon SNS?
This service is particularly useful for DevOps engineers, developers, and IT managers to gain insights into system-wide performance and operational health, helping to optimize resource use and respond to performance changes effectively.
Amazon Simple Notification Service (SNS) is a fully managed messaging service provided by AWS. It enables you to send messages from publishers to subscribers using a variety of endpoints, such as email, SMS, mobile push notifications, and HTTP/S endpoints.
Here are some key features of Amazon SNS:
Pub/Sub Messaging: SNS supports both application-to-application (A2A) and application-to-person (A2P) messaging. This allows you to decouple microservices, distribute messages to multiple endpoints, and send notifications to users.
Message Filtering: You can filter messages based on attributes, ensuring that subscribers only receive relevant messages.
High Throughput: SNS is designed to handle high-throughput, push-based, many-to-many messaging.
Durability and Security: Messages are stored across multiple availability zones, ensuring durability. SNS also supports encryption and access control using AWS Key Management Service (KMS) and IAM policies.
Integration: SNS integrates with other AWS services like AWS Lambda, Amazon SQS, and Amazon Kinesis Data Firehose, enabling seamless event-driven architectures.
This service is particularly useful for sending notifications, alerting systems, and integrating distributed applications.
Task :
- Create a CloudWatch alarm that monitors your billing and send an email to you when a it reaches $2.
Solution:
Prerequisite: To see the Billing metric in CloudWatch, you need to enable billing preferences. Check the box for receiving Billing alerts and save your preferences.
Note:*If you don't see the Billing/Total Estimated Charge metric, enable billing alerts, and change your Region to US East (N. Virginia)* / us-east-1.
Keep that in mind:
For Statistic, choose maximum period.
Verify and Create alarm.
Go to your e-mail, click on confirm subscription.
Thank you for reading😉.
Subscribe to my newsletter
Read articles from Sahil Kaushal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by