问题描述
AWS最近发布了一个新的AMI,它的Windows Server 2008 R2默认安装了CloudFormation工具。 AMI本身可以在这里找到:
[
使用此AMI时直接在CloudFormation模板中并启动堆栈,我可以轻松地启动我的堆栈,并且实例在启动过程中下载我的位于S3中的文件,没有任何问题,所有由cfn-init命令创建的文件夹也可以视为预期。但是,如果我修改AMI以自定义(仅启用IIS)并重新创建一个新的AMI,并在模板中使用此AMI,则文件不会被下载没有其他文件夹假设要通过cfn-init命令创建命令可以看到。
任何建议?我错过了什么?
最可能的原因是自定义AMI是在不使用包选项卡。
Windows上的CloudFormaion支持取决于EC2Config服务在第一次启动时运行用户数据中指定的命令的功能。此功能在首次引导后自动禁用,以便随后的引导不会导致重新运行相同的命令。
如果使用EC2Config的捆绑选项卡创建自定义AMI,它确保生成的AMI启用了用户数据命令执行功能。因此,有必要(并始终建议)使用EC2Config的Bundle选项卡创建自定义AMI。
希望这有帮助。
问候,
Shon
AWS released a new AMI recently which has CloudFormation tools installed by default on their Windows Server 2008 R2. The AMI itself can be found here :[https://aws.amazon.com/amis/microsoft-windows-server-2008-r2-base-cloudformation]
When using this AMI directly within a CloudFormation template and launching the stack, I am able to launch my stack easily and the instance downloads my files located in S3 without any problem during boot up, all the folders created by cfn-init command can also be seen as expected.
However, if I modify the AMI to customize (just enabling IIS) it and recreate a new AMI and use this AMI within the template, the files don't get downloaded neither are the other folders suppose to be created by cfn-init command can be seen.
Any suggestions ?! Am I missing something ?!
Most probable cause of this is that the custom AMI was created without using EC2Config Service's Bundle tab.
CloudFormaion support on Windows depends on EC2Config service's functionality of running commands specified in User Data on first boot. This functionality automatically gets disabled after first boot so that the subsequent boots do not cause re-runs of the same commands.
If the custom AMI is created using EC2Config's Bundle tab , it ensures that the resulting AMI has the User Data command execution functionality enabled. Hence it is necessary (and always recommended) to create the custom AMI using EC2Config's Bundle tab.
Hope this helps.
Regards,Shon
这篇关于AWS CloudFormation和Windows Server 2008 R2,用于Bootstrap文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!