-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloudWatch Agent 1.247351.0 Fails to Start on Windows Server 2022 #471
Comments
Are you running this in Powershell or Powershell ISE? I recall that a change in piping debug logs to stderr instead of stdout causes ISE to think that there is an error with the executable and stops |
It is run in PowerShell as part of the user data script for an EC2 instance |
+1 for issue |
Considering that it works on Windows Server 2019, it seems like there's some change/regression at an OS level. That being said, I'm fairly certain that this is related to the issue I mentioned since I think the only change that would have impacted this is changing from using the |
Hey @SignalRichard,
Would it be best for you to show us the replication process ? From the AMI and go through the whole process. Moreover, at least we know that it does not relates to Window PowerShell ISE and Powershell since CWAgent does not stop at
|
@SignalRichard @fivehorizons are either of you able to provide the EC2 user data script you used to install the CloudWatch agent? I think that installing the agent manually on a Windows Server 2022 EC2 works, as far as I know. It would help with trying to reproduce the exact issue if we could take a look at your existing user data |
I will try and get you a succinct setup to reproduce this issue - currently the CloudWatch agent is installed on a machine and a new AMI is created and when the instance starts the user data initializes/configures the CloudWatch agent. Unfortunately, the AMI creation process and the AMI itself is complicated so I want to provide a boiled down example. To note - I downgraded the CloudWatch agent on the existing AMI that I was having issues with to the previous version and it starts and works as expected. |
@SignalRichard @fivehorizons Another thing we would like you to provide us is the error info in the Event Viewer during the the CWAgent fails to start. |
I think I've been able to root cause it. #473 accounts for this in that it wraps a call to the config-downloader executable in I was able to reproduce the issue on the 351 release, and used this user data script to check if I fixed the issue:
I got onto the host and ran the following to see if it was running, and it was.
|
#473 accounts for this. As far as the identified discrepancy between regional S3 endpoints with the "latest" version, it's mostly because we release in waves, caught an issue, halted, and rolled back to v350. As of 5/20, downloading and installing the "latest" CloudWatch agent should be pointing to v350, not v351. Given that we rolled back the release, root caused this issue with what we were going to release and have the fix merged and primed for our next release, I'm going to be closing this. Much appreciated on the prompt reach out to identify this issue, and the analysis done upfront for isolating it to Windows Server 2022. I dug into it a little more and I think the root cause is a behavior change between the service that executes the user data script on Windows Server 2022 compared to prior OSes. Windows Server 2022 uses EC2Launch v2 by default, whereas previous OSes use v1. |
To solved the problem I did the steps below. 1 - Install CloudWatch agent bty SSM using this document https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance-fleet.html 2 - After install perform this command & $Env:ProgramFiles\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1 -m ec2 -a start & $Env:ProgramFiles\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1 -m ec2 -a status |
Describe the bug
The CloudWatch Agent fails to start on Windows Server 2022 when using the
amazon-cloudwatch-agent-ctl.ps1
to set the configuration file.Steps to reproduce
Start the cloud watch agent with a local configuration file similar to:
& "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c file:C:\asg-cloudwatch\amazon-cloudwatch-agent.json
What did you expect to see?
Expected the CloudWatch agent to start.
What did you see instead?
The agent does not start - the log file indicates that it does not re-attempt to start after it detects the instance is EC2 when the metadata service is not yet available (see log files and additional info below)
What version did you use?
Version:
1.247351.0b251861
Downloaded from: https://s3.amazonaws.com/amazoncloudwatch-agent/windows/amd64/latest/amazon-cloudwatch-agent.msi
Please note - there is some anomaly here when a regional endpoint is used instead of the global endpoint the following version is downloaded which DOES NOT produce the problematic behavior:
1.247350.0b251780
Example regional endpoint: https://s3.us-west-2.amazonaws.com/amazoncloudwatch-agent-us-west-2/windows/amd64/latest/amazon-cloudwatch-agent.msi
What config did you use?
Config:
Environment
OS: Windows Server 2022 (10.0.20348 Build 707)
Additional context
This issue appears to only happen on Windows Server 2022 since I have also tested the version in question on Windows Server 2019 without issue.
Here are the log files from various configurations:
Windows Server 2022 with CloudWatch Agent 1.247351.0
Windows Server 2022 with CloudWatch Agent 1.247350.0
Windows Server 2019 with CloudWatch Agent 1.247351.0
The text was updated successfully, but these errors were encountered: