🚀Day 7 of 7 days of AWS challenge Introduction of AWS CloudWatch

Deepika PandeyDeepika Pandey
4 min read

⌚What is AWS CloudWatch?

Amazon Web Services offers a robust monitoring and observability service called AWS CloudWatch. You can use it to obtain insights into the operational, health, and performance aspects of your AWS apps and resources. CloudWatch gathers and monitors log files, gathers and maintains metrics, and creates alarms to notify you under specific circumstances.

Advantages of AWS CloudWatch:

  • Comprehensive Monitoring: CloudWatch allows you to monitor various AWS resources, such as EC2 instances, RDS databases, Lambda functions, and more. You get a unified view of your entire AWS infrastructure.

  • Real-Time Metrics: It provides real-time monitoring of metrics, allowing you to respond quickly to any issues or anomalies that might arise.

  • Automated Actions: With CloudWatch Alarms, you can set up automated actions, like triggering an auto-scaling group to scale in or out based on certain conditions.

  • Log Insights: CloudWatch Insights lets you analyze and search log data from various AWS services, making it easier to troubleshoot problems and identify trends.

  • Dashboards and Visualization: Create custom dashboards to visualize your application and infrastructure metrics in one place, making it easier to understand the overall health of your system.

We can do with such cases of AWS CloudWatch:

Auto Scaling: Depending on predetermined thresholds, CloudWatch can initiate auto-scaling operations. You can, for instance, dynamically scale up or down in response to CPU usage or request counts.

Resource Monitoring: Keep an eye on the health and performance of your AWS resources, including DynamoDB tables, RDS databases, and EC2 instances.

Application Insights: Monitor application-specific metrics to spot any bottlenecks and keep an eye on your apps' performance.

Log analysis: Analyze log data, spot trends, and solve problems instantly with CloudWatch Logs Insights.

Billing and Cost Monitoring: By keeping an eye on your AWS consumption and billing trends, CloudWatch can help you optimize your costs.

⌚Hands-on EC2 CPU ALERTING THROUGH SNS

Step 1: Navigate to AWS CloudWatch Console

  1. Log in to your AWS Management Console.

  2. Navigate to the CloudWatch service.

Step 2: Create CloudWatch Alarm for EC2 CPU

  1. In the CloudWatch console, select "Alarms" from the left navigation pane.

  2. Click "Create Alarm" and choose "Select Metric" under EC2.

  3. Choose the desired EC2 instance and select "Per-Instance Metrics" > "CPU Utilization."

  4. Define the threshold values for CPU utilization.

  5. Configure actions to be taken when the alarm state changes. Choose "State is ALARM" and select "Add an action" > "Create a new SNS topic."

Step 3: Create an SNS Topic

  1. Navigate to the SNS service in the AWS Management Console.

  2. Select "Topics" from the left navigation pane.

  3. Click "Create Topic" and provide a name and display name for your topic.

  4. Once created, select the newly created topic and note down the ARN.

Step 4: Subscribe to SNS Topic

  1. In the SNS topic details, click "Create Subscription."

  2. Choose the protocol (e.g., email, SMS) and provide the necessary details.

  3. Confirm the subscription by responding to the confirmation message.

Step 5: Add SNS as an Action to CloudWatch Alarm

  1. Return to the CloudWatch console and select your newly created alarm.

  2. Under the "Actions" tab, click "Add Action" > "SNS Action."

  3. Choose the SNS topic created in Step 3.

Step 6: Test the Configuration

  1. Intentionally generate high CPU utilization on your EC2 instance to trigger the alarm.

  2. Verify that you receive notifications through the subscribed SNS endpoint (e.g., email or SMS).

⌚Conclusion of the AWS cloud watch:

To sum up, AWS CloudWatch is an effective tool for tracking and controlling the functionality of your AWS resources. You can create a strong monitoring system that aids in ensuring the best possible performance, availability, and dependability of your applications running on the AWS cloud by adhering to best practices for threshold setting, taking into account the subtleties of multi-instance environments and dynamic workloads, and utilizing advanced CloudWatch features. Using CloudWatch for proactive alerting and continuous monitoring is a big help in maintaining an AWS infrastructure that is both healthy and optimal.

0
Subscribe to my newsletter

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

Written by

Deepika Pandey
Deepika Pandey