Monitor Proactively 📈 — AWS Well-Architected

shelan
3 min readFeb 8, 2024

--

Dive into the AWS Well-Architected Framework with me over 30 days.

In today’s cloud-centric environments, ensuring the smooth operation of your applications and services is paramount. AWS CloudWatch offers a comprehensive suite of tools to help you monitor your resources proactively, enabling you to maintain operational excellence. This post delves into the functionalities of CloudWatch metrics, alarms, and dashboards, and provides practical examples of real-time monitoring for CPU, memory, network utilization, and custom application metrics. Moreover, we’ll guide you through setting up proactive notifications and automated actions based on alarms to enhance your operational posture.

Understanding CloudWatch Metrics, Alarms, and Dashboards

CloudWatch Metrics offer a detailed view of your AWS resources and application performance. These metrics collect data points on various aspects such as CPU utilization, disk I/O, and network traffic.

CloudWatch Alarms watch over the metrics you care about and perform one or more actions when the metric crosses a threshold you define. This could be anything from sending an SNS notification to auto-scaling your resources.

CloudWatch Dashboards provide a customizable home in the Cloud for monitoring your resources. You can create visual representations of metrics and alarms to get an at-a-glance understanding of your environment’s health.

Real-Time Monitoring Examples

CPU Utilization Monitor the CPU usage of your EC2 instances to ensure they’re performing optimally and not over or under-utilized.

AWS Management Console > CloudWatch > Metrics > EC2 > Per-Instance Metrics > CPUUtilization

Memory Utilization

Memory usage isn’t tracked by default in CloudWatch, but you can push custom metrics using the CloudWatch agent.

You can find information on how to configure the agent here

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
-a fetch-config -m ec2 -c file:/tmp/my-config.json -s

Network Utilization

Keep an eye on the NetworkIn and NetworkOut metrics for your instances to monitor the data being transferred.

AWS Management Console > CloudWatch > Metrics > EC2 > Per-Instance Metrics > NetworkIn / NetworkOut

Custom Application Metrics

Use the PutMetricData API to send custom metrics to CloudWatch, allowing you to monitor application-specific events and states.

import boto3

cloudwatch = boto3.client('cloudwatch')
cloudwatch.put_metric_data(
MetricData = [
{
'MetricName': 'Purchases',
'Dimensions': [
{
'Name': 'ProductType',
'Value': 'Sports'
},
],
'Unit': 'None',
'Value': 1.0
},
],
Namespace='YourApplication'
)

Setting Up Proactive Notifications and Automated Actions

To ensure you’re immediately aware of any issues, you can configure CloudWatch Alarms to send notifications or even trigger automated actions.

Create an Alarm:

Navigate to the CloudWatch console, and select “Alarms” > “Create alarm”. Choose the metric you wish to monitor, specify the threshold, and set the period.

Define the Action: Select an SNS topic to notify when the alarm state is reached. You can also choose to make an EC2 action, like stopping or terminating an instance, or an Auto Scaling action.

Notification Setup: Create an SNS topic and subscribe to it via email or SMS to receive notifications when your alarm’s state changes.

aws sns create-topic --name CloudWatchAlarms
aws sns subscribe --topic-arn arn:aws:sns:region:account-id:CloudWatchAlarms --protocol email --notification-endpoint your-email@example.com

Conclusion

Monitoring your AWS resources proactively with CloudWatch can significantly enhance your operational efficiency and prevent potential issues from escalating. By utilizing metrics, alarms, and dashboards, you gain a comprehensive view of your environment’s health and can automate responses to specific events, ensuring your applications run smoothly.

Remember, operational excellence is not just about monitoring; it’s about continuously improving your monitoring strategies and responses to maintain an optimal cloud environment.

Link to the Day1: https://shelan.medium.com/day1-automate-everything-83fb716290be

You can find all the articles in the following repository.
https://github.com/shelan/aws-well-architected

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

shelan
shelan

Written by shelan

CTO at Estabild.com. Startup helping construction projects stakeholders to maximize the returns on their portfolio.

No responses yet

Write a response