- Newest
- Most votes
- Most comments
This issue appears to be related to how the CloudWatch agent is trying to access your configuration from Parameter Store. Here are a few things to check and potential solutions:
-
Verify the exact parameter name format you're using. When specifying the parameter in the SSM document, make sure you're using the complete name exactly as it appears in Parameter Store. Parameter names are case-sensitive.
-
Check that the parameter is in the same AWS region as your EC2 instance. The CloudWatch agent will look for the parameter in the region where the instance is running (eu-west-1 in your case).
-
Ensure the IAM role attached to your EC2 instance has the necessary permissions to read from Parameter Store. The role should have the
ssm:GetParameterpermission at minimum. -
Try starting the CloudWatch agent manually using PowerShell to see if you get more detailed error information:
& "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c ssm:your-parameter-name
-
Check if there's any issue with the parameter name format. If your parameter name includes hierarchical paths (like /cloudwatch/config), make sure you're referencing it correctly.
-
Verify that the configuration file is properly formatted as a JSON string in Parameter Store. The CloudWatch agent expects a specific format for its configuration.
-
As a workaround, you could try saving the configuration file locally on the instance first, then use the file path instead of the SSM parameter:
& "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c file:C:\path\to\config.json
After the agent is successfully configured, you should see the configuration file appear in C:\ProgramData\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent.json.
Sources
Starting the CloudWatch agent - Amazon CloudWatch
Troubleshooting the CloudWatch agent - Amazon CloudWatch
Manually create or edit the CloudWatch agent configuration file - Amazon CloudWatch
Relevant content
- asked 2 years ago
