Lab Goal
In this lab you will learn how DevOps engineers monitor applications running in production.
By the end of this lab you will be able to:
- Understand what CloudWatch Metrics are.
- Create a CloudWatch Dashboard.
- Monitor your ECS Service.
- Monitor your Application Load Balancer.
- Create CloudWatch Alarms.
- Receive notifications when something goes wrong.
- Understand how DevOps engineers detect problems before customers report them.
Production Scenario
Imagine your application is running on ECS.
GitHub
↓
GitHub Actions
↓
Amazon ECR
↓
Amazon ECS
↓
Application Load Balancer
↓
Users
Yesterday everything worked perfectly.
Today users start saying:
"The website is very slow."
As a DevOps Engineer, the first question is:
What changed?
You don't guess.
You look at monitoring.
That is why companies use Amazon CloudWatch.
What is Amazon CloudWatch?
CloudWatch is AWS's monitoring service.
Think of it as a health monitor for your AWS resources.
Instead of waiting for customers to complain, CloudWatch tells you when something is wrong.
CloudWatch collects information such as:
- CPU Usage
- Memory Usage
- Network Traffic
- Requests
- Response Time
- Errors
What is a Metric?
A metric is simply a number measured over time.
Examples:
| Metric | Meaning |
|---|---|
| CPU Utilization | How busy the server is |
| Memory Utilization | How much RAM is being used |
| Request Count | Number of users visiting |
| Response Time | How long requests take |
| Healthy Host Count | Number of healthy ECS tasks |
Think of your smartwatch.
It measures:
- Heart Rate
- Steps
- Calories
CloudWatch does the same thing for AWS resources.
Why Do Companies Monitor?
Imagine this happens:
At 2 AM
CPU becomes
98%
If nobody notices,
the application becomes slow.
Eventually
CPU 100%
↓
Application Stops Responding
Customers cannot use the website.
Monitoring allows DevOps engineers to fix problems before they become outages.
What Can CloudWatch Monitor?
Today we will monitor:
- ECS Service
- ECS Tasks
- Application Load Balancer
Later you can also monitor:
- EC2
- Lambda
- RDS
- DynamoDB
- API Gateway
- S3
Part 1 – Open CloudWatch
Open AWS Console
Search
CloudWatch
Open it.
You will see:
- Dashboards
- Alarms
- Metrics
- Logs
Today we will use:
- Metrics
- Dashboards
- Alarms
Part 2 – View Metrics
Click
Metrics
Click
All Metrics
You will see many AWS services.
Examples:
- ECS
- EC2
- ApplicationELB
- Lambda
- RDS
Part 3 – ECS Metrics
Click
ECS
Then
ClusterName
Choose your cluster.
You should see metrics such as:
- CPUUtilization
- MemoryUtilization
Click
CPUUtilization
A graph appears.
This graph shows how busy your ECS service has been.
Why CPU Matters
Imagine CPU usage stays around
15%
Everything is healthy.
Now traffic increases.
CPU becomes
95%
The application may:
- become slow
- stop responding
- restart
This is why DevOps engineers always monitor CPU.
Memory Utilization
Return to Metrics.
Choose
MemoryUtilization
Memory shows how much RAM the container is using.
If memory reaches
100%
The container may crash.
Part 4 – Monitor the Load Balancer
Go back.
Choose
ApplicationELB
Select your ALB.
Useful metrics include:
RequestCount
How many requests users are sending.
If it suddenly increases,
your website is getting more traffic.
TargetResponseTime
How long your application takes to respond.
Healthy example:
150 ms
Bad example:
3 seconds
Slow response usually means:
- high CPU
- database problems
- slow application code
HealthyHostCount
Shows how many healthy ECS tasks are receiving traffic.
Example
2 Healthy
Good.
If it becomes
0
Nobody can use your application.
HTTPCode_Target_5XX_Count
Shows application errors.
Examples
500
502
503
504
These usually mean something is wrong with the application.
Part 5 – Create a Dashboard
Why create dashboards?
Instead of opening many AWS pages,
DevOps engineers want everything on one screen.
Open
Dashboards
↓
Create Dashboard
Dashboard name
Restaurant-App
Click
Create
Add Widgets
Click
Add Widget
Choose
Line
Add:
Widget 1
CPUUtilization
Widget 2
MemoryUtilization
Widget 3
RequestCount
Widget 4
HealthyHostCount
Widget 5
TargetResponseTime
Save.
Now one screen shows the health of your application.
This is how many DevOps teams monitor production.
Part 6 – CloudWatch Alarms
Monitoring is useful.
But nobody watches dashboards 24 hours a day.
Instead,
CloudWatch sends alerts.
Example
CPU
95%
↓
CloudWatch Alarm
↓
Email
↓
DevOps Engineer
Now someone knows there is a problem.
Part 7 – Create CPU Alarm
Open
CloudWatch
↓
Alarms
↓
Create Alarm
Choose Metric
ECS
↓
CPUUtilization
Condition
Greater Than
80
Meaning
If CPU stays above
80%
CloudWatch creates an alarm.
Evaluation Period
Choose
5 minutes
Why?
CPU can briefly spike.
We don't want false alarms.
Waiting a few minutes helps reduce unnecessary alerts.
Notification
Choose
Create New SNS Topic
Name
DevOpsAlerts
Enter your email.
Click
Create
Check your email.
Click
Confirm Subscription
Without confirming, AWS cannot send notifications.
Alarm Name
High-CPU-Restaurant-App
Click
Create Alarm
Done.
Part 8 – Create Memory Alarm
Repeat the process.
Metric
MemoryUtilization
Threshold
80%
Alarm Name
High-Memory
Part 9 – Create Healthy Host Alarm
Metric
HealthyHostCount
Condition
Less Than
1
Meaning
If no healthy ECS tasks exist,
CloudWatch immediately sends an alert.
This is one of the most important production alarms.
Part 10 – Create Target Response Time Alarm
Metric
TargetResponseTime
Condition
Greater Than
2 Seconds
If users wait too long,
DevOps receives a notification.
Which Alarms Should Every DevOps Engineer Create?
At a minimum:
| Alarm | Why It Matters |
|---|---|
| High CPU | Application is overloaded |
| High Memory | Prevent container crashes |
| Healthy Host Count < 1 | Application is unavailable |
| Target Response Time High | Website is slow |
| HTTP 5XX Errors | Application is failing |
As you gain experience, you can add alarms for other AWS services and business-specific metrics.
How DevOps Engineers Use CloudWatch
Imagine your phone rings.
Email says:
High CPU
95%
What should you check?
- Is ECS running?
- Are tasks healthy?
- Open CloudWatch Logs.
- Look for application errors.
- Check database connectivity.
- Decide whether scaling or a code fix is needed.
CloudWatch tells you something is wrong.
CloudWatch Logs usually help explain why it is happened.
Production Tips
✔ Monitor trends, not just current values.
✔ Use dashboards for daily monitoring.
✔ Use alarms for important events.
✔ Don't create hundreds of unnecessary alarms.
✔ Review alarms regularly to remove ones that are noisy or no longer useful.
Lab Checklist
Complete the following:
✅ View ECS CPU metric
✅ View ECS Memory metric
✅ View ALB Request Count
✅ View ALB Healthy Hosts
✅ Create Dashboard
✅ Add CPU Widget
✅ Add Memory Widget
✅ Add Request Widget
✅ Add Healthy Host Widget
✅ Create CPU Alarm
✅ Create Memory Alarm
✅ Create Healthy Host Alarm
✅ Confirm SNS Email
Interview Questions
1. What is CloudWatch?
AWS monitoring service used to collect metrics, logs, dashboards, and alarms.
2. What is the difference between Metrics and Logs?
Metrics are numbers collected over time (CPU, memory, requests). Logs are detailed text records from your application or services that explain what happened.
3. Why do we create Dashboards?
To view the health of multiple AWS resources in one place.
4. Why do we create Alarms?
To notify the DevOps team automatically when a metric crosses a defined threshold.
5. Which metrics do you monitor in ECS?
- CPU Utilization
- Memory Utilization
- Healthy Host Count
- Request Count
- Target Response Time
- HTTP 5XX Errors
6. What happens if Healthy Host Count becomes 0?
The load balancer has no healthy targets to send traffic to, so users are likely to experience application failures.
7. What is Amazon SNS used for in CloudWatch?
SNS sends notifications, such as email, when an alarm changes to the ALARM state.
Homework
- Create a CloudWatch Dashboard with at least 5 widgets.
- Create 4 CloudWatch Alarms:
- High CPU (>80%)
- High Memory (>80%)
- Healthy Host Count (<1)
-
High Target Response Time (>2 seconds)
- Trigger one alarm (if possible) and verify that you receive an email notification.
- Take screenshots of:
Your Dashboard
Your Alarms
Your SNS subscription confirmation
Your ECS Metrics graph
By completing this lab, students will have a basic monitoring setup similar to what many teams configure for an ECS application in AWS.
Top comments (0)