AWS CloudWatch
Advanced Observability with CloudWatch
Demo Resource Health
In this tutorial, you’ll learn how to deploy EC2 instances via AWS CloudFormation and monitor their health using the CloudWatch Resource Health dashboard.
Deploying the CloudFormation Stack
Template Overview
The CloudFormation template below launches three t2.micro
EC2 instances across different Availability Zones. It automatically retrieves the latest Amazon Linux 2 AMI ID from the AWS Systems Manager (SSM) Parameter Store.
AWSTemplateFormatVersion: '2010-09-09'
Description: Launch 3 EC2 Instances in separate Subnets/AZs
Parameters:
LatestAmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Ids>
Default: /service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
Resources:
EC2Instance1:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LatestAmiId
InstanceType: t2.micro
SubnetId: subnet-64e600e
EC2Instance2:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LatestAmiId
InstanceType: t2.micro
SubnetId: subnet-68cf014
EC2Instance3:
Type: AWS::EC2::Instance
Properties:
ImageId: !Ref LatestAmiId
InstanceType: t2.micro
SubnetId: subnet-a5e028e9
Note
Ensure you replace the subnet-xxxxxxx
values with valid subnet IDs from your VPC before deployment.
- Open the AWS Management Console and navigate to CloudFormation.
- Choose Create stack > With new resources (standard).
- Under Template source, select Upload a template file and upload
resource_health.yaml
. - Click Next, name your stack (e.g.,
resource-health-demo
), then proceed through the configuration pages. - Review and click Create stack to launch the resources.
Verifying Stack Creation
Return to the CloudFormation dashboard and monitor the stack status. Deployment completes when the status changes to CREATE_COMPLETE.
Warning
Stack creation can take several minutes. Do not interrupt the process or delete the stack until it reaches CREATE_COMPLETE
.
Confirming EC2 Instances
Once the stack reaches CREATE_COMPLETE
, go to the EC2 console. Under Instances, verify that three t2.micro
instances are Initializing or Running.
Exploring the CloudWatch Resource Health Dashboard
The CloudWatch Resource Health dashboard gives you a centralized view of instance-level metrics and status checks:
- Open the CloudWatch console and select Resource Health.
- Choose EC2 as the resource type.
Initially, CPU charts may take up to five minutes to populate. Once data is available, customize your view:
Dimension | Options | Use Case |
---|---|---|
Metric | CPUUtilization, StatusCheckFailed | Monitor CPU load and health checks |
Group by | Availability Zone, Instance Type, Image ID | Visualize grouping by AZ or instance |
Sort by | CPUUtilization, StatusCheckFailed, Instance ID | Quickly identify high-usage instances |
In Map view, instances are color-coded by CPU utilization:
- Blue: < 25%
- Green: 25%–50%
- Yellow: 50%–75%
- Red: > 75%
Switch to List view for a detailed table showing:
- CPU and memory usage (Memory requires [CloudWatch Agent] installation)
- Alarm state
- System and instance status checks
Note
For large environments (hundreds of instances), use filters and grouping by tags, subnets, or Auto Scaling groups to quickly narrow down potential issues.
Conclusion
You’ve learned how to:
- Deploy EC2 instances with AWS CloudFormation
- Retrieve the latest AMI via SSM Parameter Store
- Monitor instance health and metrics using the CloudWatch Resource Health dashboard
This workflow scales seamlessly across large fleets, ensuring proactive maintenance and rapid troubleshooting.
References
- AWS CloudFormation Documentation: https://docs.aws.amazon.com/cloudformation/
- Amazon EC2 User Guide: https://docs.aws.amazon.com/ec2/
- Amazon CloudWatch User Guide: https://docs.aws.amazon.com/cloudwatch/
- AWS Systems Manager Parameter Store: https://docs.aws.amazon.com/systems-manager/maintenance-windows/latest/userguide/parameter-store.html
Watch Video
Watch video content
Practice Lab
Practice lab