Opportunity Name
EC2 Install CloudWatch Agent
AWS Resource Type (AWS service name)
Amazon EC2 instances, managed through AWS Systems Manager (State Manager)
Opportunity Description
By default, Amazon EC2 reports CPU, disk I/O and network metrics, but it cannot see inside the operating system, so memory and disk-space usage are missing. The Amazon CloudWatch agent collects those system-level metrics. This opportunity finds AWS account and Region combinations where the agent is not being installed across EC2 instances, and sets up an installation that covers every instance in that Region.
This is an enabling opportunity rather than a direct saving: memory data lets you, and CloudFix, judge instance sizes on real usage instead of CPU alone.
Criteria for identifying the opportunity
CloudFix checks each AWS account and Region:
Cost filters (from CUR)
-
The account has Amazon EC2 usage in that Region over the last 30 days (annualized).
-
The annualized amortized EC2 cost is above your tenant's configurable resource cost threshold.
-
The account is not tagged cloudfix:dont-fix-it.
Eligibility validation (AWS Systems Manager check)
-
ResourceFixed: CloudFix looks for an existing, successful State Manager association that targets all instances and installs the AmazonCloudWatchAgent package through AWS-ConfigureAWSPackage. If one exists, there is nothing to do and no recommendation is made.
Potential Savings (if known)
CloudFix does not estimate a direct saving for this opportunity. Its value is visibility: once memory metrics are available, over-provisioned instances can be right-sized with confidence.
The agent publishes its metrics as CloudWatch custom metrics, which AWS bills per metric per month. See Amazon CloudWatch pricing.
What happens when the Fixer is Executed?
The fixer runs an SSM Automation runbook in the account and Region that:
-
Checks whether the SSM document CloudFix-InstallCloudWatchAgentOnEC2 already exists, and creates it if not. The document installs the CloudWatch agent with AWS-ConfigureAWSPackage, then uses AmazonCloudWatch-ManageAgent to apply the agent's default configuration (only where no configuration exists yet) and restart the agent.
-
Creates a State Manager association named CloudFix-InstallCloudWatchAgentOnEC2 that targets all instances (InstanceIds = *) in that Region.
Important: because the association targets all instances, it applies to every current and future SSM-managed instance in that Region, not to a single instance.
Prerequisites
-
Instances must be managed by AWS Systems Manager (SSM Agent running and able to reach the SSM endpoints). Unmanaged instances are not reached.
-
To publish metrics, the instance profile needs CloudWatch agent permissions (for example the CloudWatchAgentServerPolicy managed policy). See Fix EC2 instance IAM profiles to allow traffic from SSM and CloudWatch agents and Fix VPC DNS settings for SSM and CloudWatch agents.
Is it possible to roll back once CloudFix implements the Fixer?
CloudFix does not roll this change back automatically. To reverse it:
-
In Systems Manager → State Manager, delete the association CloudFix-InstallCloudWatchAgentOnEC2, so it stops applying to instances.
-
Optionally delete the document CloudFix-InstallCloudWatchAgentOnEC2 under Systems Manager → Documents → Owned by me.
-
To remove the agent itself, run AWS-ConfigureAWSPackage with action: Uninstall and name: AmazonCloudWatchAgent on the instances.
Does the fix require downtime?
No. Installing and starting the agent does not restart the instance. The agent itself is restarted to load its configuration.
Additional Resources
-
Installing the CloudWatch agent (AWS documentation)
-
AWS Systems Manager State Manager (AWS documentation)
Bill Gleeson
Comments