Skip to content

CloudWatch Agent on Windows Server 2022 — “ParameterNotFound” when using AmazonCloudWatch-ManageAgent with Parameter Store config

0

I am running Windows Server 2022 on EC2 and trying to configure the CloudWatch Agent using the AmazonCloudWatch-ManageAgent SSM document. My goal is to store the configuration JSON in AWS Systems Manager Parameter Store and have the agent fetch it. I created a Parameter Store entry in the same region (eu-west-1) via the AWS Console, but when I run the document, I get: Fail to fetch/remove json config: ParameterNotFound I confirmed via Session Manager that no config file is present under C:\ProgramData\Amazon\AmazonCloudWatchAgent\Configs, and aws ssm get-parameter from the instance also returns ParameterNotFound. The IAM IAM role has required permissions. I’ve verified the JSON is valid and the parameter name matches the one I specify in the document. Since the CloudWatch Agent is not configured, it is not starting, and no logs are being generated. Why would the SSM document still report ParameterNotFound when the parameter clearly exists in the console? and how can I resolve this?

1 Answer
0

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:

  1. 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.

  2. 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).

  3. Ensure the IAM role attached to your EC2 instance has the necessary permissions to read from Parameter Store. The role should have the ssm:GetParameter permission at minimum.

  4. 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
  1. 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.

  2. 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.

  3. 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

answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.