我正在使用这个 CloudFormation 脚本来创建一个 Windows 实例并安装Web Deploy:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Test.",
"Resources" : {
"InstanceSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable RDP",
"SecurityGroupIngress" : [
{"IpProtocol" : "tcp", "FromPort" : "3389", "ToPort" : "3389", "CidrIp" : "0.0.0.0/0"}
]
}
},
"WindowsServer": {
"Type" : "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"files" : {
"c:\\Packages\\WebDeploy_amd64_en-US.msi" : {
"source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi"
}
}
},
"commands" : {
"1-installwebdeploy" : {
"command" : "msiexec.exe /i c:\\Packages\\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart"
}
}
}
},
"Properties": {
"InstanceType" : "m1.small",
"ImageId" : "ami-bbf2e1cf",
"SecurityGroups" : [ {"Ref" : "InstanceSecurityGroup"} ],
"KeyName" : "POP",
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"<script>\n",
"cfn-init.exe -v -s ", { "Ref" : "AWS::StackId" },
" -r WindowsServer",
" --region ", { "Ref" : "AWS::Region" }, "\n",
"</script>"
]]}}
}
}
}
}
MSI 包正确下载,但命令不执行。事实上,cfn-init.log 声明没有指定任何命令:
2013-07-23 12:57:10,740 [DEBUG] CloudFormation client initialized with endpoint https://cloudformation.eu-west-1.amazonaws.com
2013-07-23 12:57:10,740 [DEBUG] Describing resource WindowsServer in stack ***
2013-07-23 12:57:14,079 [DEBUG] Creating Scheduled Task for cfn-init resume
2013-07-23 12:57:14,220 [DEBUG] Scheduled Task created
2013-07-23 12:57:14,328 [INFO] Running configSets: default
2013-07-23 12:57:14,328 [INFO] Running configSet default
2013-07-23 12:57:14,328 [INFO] Running config config
2013-07-23 12:57:14,328 [DEBUG] No packages specified
2013-07-23 12:57:14,328 [DEBUG] No groups specified
2013-07-23 12:57:14,328 [DEBUG] No users specified
2013-07-23 12:57:14,328 [DEBUG] No sources specified
2013-07-23 12:57:14,328 [DEBUG] Parent directory c:\Packages does not exist, creating
2013-07-23 12:57:14,328 [DEBUG] Writing content to c:\Packages\WebDeploy_amd64_en-US.msi
2013-07-23 12:57:14,328 [DEBUG] Retrieving contents from http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi
2013-07-23 12:57:14,673 [DEBUG] No mode specified for c:\Packages\WebDeploy_amd64_en-US.msi
2013-07-23 12:57:14,673 [WARNING] Unsupported OS for setting owner/group: nt
2013-07-23 12:57:14,673 [DEBUG] No commands specified
2013-07-23 12:57:14,673 [DEBUG] No services specified
2013-07-23 12:57:14,673 [INFO] ConfigSets completed
2013-07-23 12:57:14,734 [DEBUG] Deleting Scheduled Task for cfn-init resume
2013-07-23 12:57:14,796 [DEBUG] Scheduled Task deleted
这里到底发生了什么?提前致谢。