AWS AMI ami-0c7328b3dbb11f540 (Windows_Server-2012-R2_RTM-English-64Bit-Base-2022.07.13) seems corrupt. It can't run basic powershell commands upon autoscaling launch due to missing files?

0

AWS released the latest Windows Server 2012 R2 AMIs on 7/13/2022. Upon testing this morning, I found that ami-0c7328b3dbb11f540 is corrupt and will not properly run powershell commands upon launch due to missing files in the filesystem. Reverting to the June image (ami-09e13647920b2ba1d) allowed our autoscaling EC2 instances to launch properly.

For specifics, below is the error that triggered an autoscaling build failure.

2022-07-15 13:43:32,501 [ERROR] -----------------------BUILD FAILED!------------------------
2022-07-15 13:43:32,501 [ERROR] Unhandled exception during build: [Errno 2] No such file or directory: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmp2_4a69w_/subp-stderr-8e0905c1-1293-4379-bbb8-bf88a2978290.txt'

Traceback (most recent call last):
  File "cfn-init", line 176, in <module>
  File "cfnbootstrap\construction.pyc", line 137, in build
  File "cfnbootstrap\construction.pyc", line 564, in build
  File "cfnbootstrap\construction.pyc", line 578, in run_config
  File "cfnbootstrap\construction.pyc", line 146, in run_commands
  File "cfnbootstrap\command_tool.pyc", line 92, in apply
  File "cfnbootstrap\util.pyc", line 587, in call
  File "cfnbootstrap\util.pyc", line 562, in call
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\tmp2_4a69w_/subp-stderr-8e0905c1-1293-4379-bbb8-bf88a2978290.txt'
asked 2 years ago544 views
4 Answers
2

Hi, I've received an update frow AWS support.

The above looks to be a cloudformation + python error. With this error I was able to locate an issue regarding the Cloudformation Helper Script in the userdata utilizing the latest version from the public url (https://s3.us-east-1.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-win64-latest.exe), to cause issues when performing a windows restart during cfn bootstrapping [1].

The workaround at this stage is to down grade 2.0-10 (https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-2.0-10.win64.exe). Or as you have done already by rolling back to the June AMI. The internal team is aware of this issue and working on a fix.

I will monitor this issue and inform you as soon as there is a fix for this. If you need further assistance regarding the CFN Bootstrap, I would encourage you to reach out to the Cloudformation Team, along with the below log files [2]: -The EC2 configuration log at C:\Program Files\Amazon\Ec2ConfigService\Logs\Ec2ConfigLog.txt -The cfn-init log at C:\cfn\log\cfn-init.log

answered 2 years ago
  • Thanks for the follow-up. We don't specify a version of this helper script in the user data, so we have to wait on them to fix it. It's at least good to know they've located the issue and have plans to fix it.

1
Accepted Answer

this works fine for me:

<script>

powershell.exe -Command "(New-Object Net.WebClient).DownloadFile('https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-2.0-12.win64.exe','C:\aws-cfn-bootstrap-py3-2.0-12.win64.exe')"

START /wait C:\aws-cfn-bootstrap-py3-2.0-12.win64.exe /Q

cfn-init.exe -v -s ${AWS::StackId} -r EC2Instance --configsets default --region ${AWS::Region}

</script>


make sure to change "EC2Instance" to your logical-id

answered 2 years ago
1

I've got the exact same problem with Windows Server 2019 July AMI. Do you have a solution ? For now, I will recreate my golden ami from june ami provide by aws....

answered 2 years ago
  • We reverted to AWS's June 2022 image for now in hopes they would fix it. I contacted AWS Support and they wouldn't do anything since we don't pay for support. They suggested I post here, but unless AWS sees this question and resolves the issue, I'm skeptical it'll get fixed.

0

I'll open a case on my side since we have AWS support.....I'll add info in this post....

answered 2 years ago
  • Awesome! Thank you!

  • please let us know. Same issue, again!

  • @gMergulhao we have a similar issue with the August 2022 Serer 2012 R2 RTM English image, but not exactly the same. Instead of saying the file is missing, we got an error about the file or directory already being in use so the Autoscaling Launch Config can't complete its processes.

  • similar with August 2019 Server. Installing an older cfn-boostrap is a pain since the required c++ redist has been superseeded and the installer refuses to continue.. Thanks to your tip, i changed my ImageBuilder Recipe to the June AMI and updated to cfn-bootstrap 2.0-12

  • Hi, on my side, all is now working as expected with August, Windows Server 2019 AMI and cfn-int 2.0.15

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.

Guidelines for Answering Questions