Introduction:)
On day46 of 90daysofdevops, we explore and continue on this journey with a new topic. We will learn about Amazon CloudWatch and Amazon SNS today.
What is Amazon CloudWatch?
Amazon CloudWatch is a monitoring and observability service provided by Amazon Web Services (AWS). It is designed to collect and track metrics, collect and monitor log files, and set alarms. CloudWatch provides you with data and operational insights for your AWS resources, applications, and services, allowing you to monitor, troubleshoot, and optimize performance.
Key features of Amazon CloudWatch
Metric Collection and Tracking: Monitors an extensive range of metrics from AWS resources, serving as the cornerstone for assessing system health and performance.
Log Management: Tracks, stores, and analyzes log files, providing insights into application behavior.
Alerting and Alarming: Set up custom alarms based on thresholds for timely notifications of metric changes.
Real-time Dashboards: Creates custom real-time dashboards for a holistic view of system performance.
Granular Data Retrieval: Retrieves metrics with precision, ranging from one-second to one-day intervals.
Integration with AWS Services: Seamlessly integrates with AWS resources for comprehensive monitoring and optimization.
Custom Metrics Support: Publishes custom metrics to monitor specific aspects of applications and services.
What is Amazon SNS?
Amazon Simple Notification Service (SNS) is a fully managed messaging service provided by Amazon Web Services (AWS). It enables the distribution of messages to many recipients through various delivery methods like SMS, email, application endpoints, and more. SNS is designed to facilitate the creation of applications that can deliver notifications, alerts, or updates to users or systems. It's a versatile tool that helps build event-driven and distributed systems in the AWS environment.
Key features of Amazon SNS
Multi-Platform Notifications: Allows sending messages via various channels like SMS, email, mobile push, etc., providing flexibility in communication.
Message Filtering: Deliver specific messages to particular subscribers, reducing redundancy.
Message Attributes: You can attach custom message attributes to messages, providing additional context or metadata. This is valuable for filtering and routing messages based on specific criteria.
Security and IAM Integration: Fine-grained control over permissions.
Scalability and Auto-Scaling: Easily handles varying message volumes.
SNS Mobile Push Notifications: SNS provides a streamlined way to send mobile push notifications to Apple, Google, and other platforms, simplifying the process of notifying mobile app users.
Billing and Usage Reports: AWS provides detailed billing and usage reports for SNS, helping you monitor costs and optimize your messaging solutions.
Global Reach: SNS can deliver messages globally, making it suitable for applications with a worldwide user base.
Message Size Flexibility: SNS supports different message sizes, accommodating both small and large messages for various use cases.
What are the pricing details for Amazon CloudWatch and Amazon SNS?
Amazon CloudWatch:
Metrics:
Custom Metrics: $0.30 per metric per month.
Free Tier: 10 custom metrics and 10 alarms per month are included for free.
Logs:
Log Ingestion: Paid based on the volume of log data ingested.
Log Storage: Paid based on the volume of log data stored.
Alarms:
- $0.10 per alarm per month (beyond the 10 free alarms in the free tier).
Dashboards:
- $3.00 per dashboard per month (the first three are free).
Synthetics:
- Paid based on the number of canaries run and the frequency of runs.
Anomaly Detection:
- Paid based on the number of detectors.
Amazon SNS:
Publishing:
- $0.50 per 1 million publishes.
SMS Messaging:
- Varies by destination country. Prices are available on the AWS SNS pricing page.
Voice Messaging:
- Varies by destination country. Prices are available on the AWS SNS pricing page.
Push Notifications:
- Free tier includes one million pushes per month for mobile endpoints.
What is the difference between Amazon CloudWatch and Amazon SNS?
Feature | Amazon CloudWatch | Amazon SNS |
Primary Use | Monitoring and Observability | Notification and Messaging Service |
Metrics | Collects and tracks metrics from AWS resources and applications. | N/A |
Logs | Collects, monitors, and analyzes log data from AWS resources and applications. | N/A |
Alerting/Alarms | Allows users to set up custom alarms based on predefined thresholds for metrics. | Sends notifications based on events or thresholds being met. |
Dashboards | Provides real-time customizable dashboards for visualizing metrics. | N/A |
Custom Metrics | Allows users to publish their own custom metrics for monitoring specific aspects. | N/A |
Integration | Integrates with various AWS resources, providing insights into instances, databases, storage, etc. | Can be integrated with various AWS services, including CloudWatch for alerting. |
Use Case | Best suited for monitoring and troubleshooting the performance and health of AWS resources and applications. | Best suited for sending notifications and alerts for events or thresholds being met. |
Cost Structure | Pay-as-you-go model based on usage and additional features like custom metrics, logs, etc. | Pay-as-you-go model based on the number of messages sent or published. |
Real-time | Provides real-time monitoring and observability of metrics. | Provides real-time notifications for events. |
Tasks :)
Task 1: Create a CloudWatch alarm that monitors your billing and sends an email to you when it reaches $2.
Sign in to AWS Management Console:
Go to the AWS Management Console and sign in with your AWS account.
Navigate to CloudWatch:
In the AWS Console, search for and select "CloudWatch".
Set Up Billing Alarm:
In the CloudWatch Dashboard, click on "Alarms" from the left-hand menu.
Create Alarm:
Click "Create Alarm".
You get 10 free alarms and 1,000 free e-mail notifications each month as part of the AWS Free Tier
Select Metric:
- Under "Select metric", search for "EstimatedCharges" and select it.
Choose Conditions:
Define the conditions for the alarm:
For example, choose "Threshold type" as static and set the threshold to $2.
Select the statistic (e.g., maximum).
Set the period (e.g., 6 hrs).
Define actions for whenever the threshold is breached.
Set Actions:
Click on "Actions" and select "Create a new topic" under the "Actions" dropdown.
Provide a name for the SNS topic (e.g., BillingAlerts) and your email address.
Create SNS Topic:
Click "Create topic" to create a new SNS topic. Provide a name and display name.
Add Email Subscriptions:
Once the SNS topic is created, select it and click "Create subscription".
Choose "Email" as the protocol and enter your email address.
Confirm Subscription:
You will receive a confirmation email. Confirm the subscription to start receiving notifications.
Set Alarm Name and Description:
Provide a name and description for your CloudWatch alarm.
Create Alarm:
Review the alarm configuration and click "Create Alarm".
Task 2: Delete the billing Alarm that you created now
Sign in to AWS Management Console:
- Go to the AWS Management Console and sign in with your AWS account.
Navigate to CloudWatch:
- In the AWS Console, search for and select "CloudWatch".
Manage Alarms:
In the CloudWatch Dashboard, click on "
Alarms > All alarms
" from the left-hand menu.
Select Alarm:
Find the alarm you want to delete in the list, and select it.
Delete Alarm:
Click on the "Actions" button and select "Delete" from the dropdown menu.
Confirm Deletion:
Confirm the deletion when prompted.
Successfully Deleted:
Conclusion:)
In this blog post, we have learned about Amazon CloudWatch and Amazon SNS, two powerful AWS services that can be used to monitor and manage your AWS resources. We have also seen how to create and delete a CloudWatch billing alarm.
Successfully completed the task! I have learned about Amazon CloudWatch and Amazon SNS, and I am now able to create and delete a CloudWatch billing alarm. I am excited to continue learning about DevOps and to use these new skills to improve my work as a software engineer.
Thank you for diving into this blog with me! I trust you found the information both helpful and enlightening. To stay updated on the latest in DevOps ๐, make sure to follow me. Remember, staying informed means staying ahead in the dynamic world of DevOps!
Feel free to connect with me on:
For more updates and engaging discussions on DevOps, let's connect! ๐ #DevOpsCommunity
Happy Learning! Keep pushing those boundaries! ๐