我需要在我的 Windows 实例初始化期间下载一个文件。为了测试这一点,我使用以下脚本来下载 Google 徽标(使用Windows 角色和功能模板的简化版本):
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Test download.",
"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:\\test\\google-logo.png" : {
"source" : "http://www.google.com/images/srpr/logo4w.png"
}
}
}
}
},
"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>"
]]}}
}
},
"WindowsServerWaitHandle" : {
"Type" : "AWS::CloudFormation::WaitConditionHandle"
},
"WindowsServerWaitCondition" : {
"Type" : "AWS::CloudFormation::WaitCondition",
"DependsOn" : "WindowsServer",
"Properties" : {
"Handle" : {"Ref" : "WindowsServerWaitHandle"},
"Timeout" : "1800"
}
}
}
}
这完成了没有错误的执行......并且没有文件。我哪里错了?