Closed rawahars closed 3 months ago
Hi @rawahars,
Thanks for reporting this issue. One workaround for the delayed IMDS availability on start up is to set the newly available imds_retries
section (see https://github.com/aws/amazon-cloudwatch-agent/issues/803#issuecomment-1749342400), which can potentially allow the agent to retry during start up until IMDS is up.
Changing the translator to panic instead of exiting with an exit code of 1 is a behavior change that can potentially impact existing customers in unexpected ways.
This issue was marked stale due to lack of activity.
Closing this because it has stalled. Feel free to reopen if this issue is still relevant, or to ping the collaborator who labeled it stalled if you have any questions.
Describe the bug We are using the following to install Amazon CloudWatch agent on Windows hosts as specified in the Amazon CloudWatch docs. The following command is used-
This script registers the CloudWatch agent as a Windows Service here. Ideally, whenever the agent crashes, Windows Service Manager (WSM) should restart the same. We assume that was the original intention and it works if the agent actually does crash.
In our use-case, we are running the same on an EC2 instance with the region being used in the config for the agent. However, when the instance boots up, IMDS is not available for few reasons. This causes the agent to assume that it is running in
OnPrem
environment and therefore it exits with code 1.Since the agent stops with code 1, WSM assumes that the application stopped by itself and therefore, it never restarts the same. We think that the correct action would be for agent to exit with panic whenever there is any non-recoverable failure.
The logs we see are-
Steps to reproduce
Start-Service AmazonCloudWatchAgent
What did you expect to see? We expected that Windows Service Manager would try to restart the CloudWatch Agent service.
What did you see instead? We saw in the CloudWatch Agent logs that the agent never restarted.
What version did you use? Version:
What config did you use?
Environment OS: Windows Server 2019 and Windows Server 2022