AWS AMI ami-0c7328b3dbb11f540(Windows_Server-2012-R2_RTM-English-64Bit-Base-2022.07.13)似乎已经损坏。由于缺少文件,它在自动扩展 时启动的实例无法运行简单的powershell命令?

0

【以下的问题经过翻译处理】 AWS于2022年7月13日发布了最新的Windows Server 2012 R2 AMIs。今天测试时,发现ami-0c7328b3dbb11f540已损坏,无法在启动时正常运行powershell命令,因为文件系统中缺少文件。恢复到6月的镜像(ami-09e13647920b2ba1d)则可以使我们的自动扩展EC2实例正常启动。

具体而言,下面是导致自动扩展构建失败的错误信息。

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'

profile picture
专家
已提问 5 个月前24 查看次数
1 回答
0

【以下的回答经过翻译处理】 我通过如下方式解决了此问题:

<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> 确保将“EC2Instance”更改为您的逻辑 ID
profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则