Amazon web services 为什么赢了';我的CloudFormation脚本不能下载文件吗?

Amazon web services 为什么赢了';我的CloudFormation脚本不能下载文件吗?,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,在初始化Windows实例期间,我需要下载一个文件。为了测试这一点,我使用以下脚本下载Google徽标(使用简化版的): { “AWSTemplateFormatVersion”:“2010-09-09”, “说明”:“测试下载”, “资源”:{ “InstanceSecurityGroup”:{ “类型”:“AWS::EC2::SecurityGroup”, “财产”:{ “GroupDescription”:“启用RDP”, “SecurityGroupIngress”:[ {“IpProt

在初始化Windows实例期间,我需要下载一个文件。为了测试这一点,我使用以下脚本下载Google徽标(使用简化版的):

{
“AWSTemplateFormatVersion”:“2010-09-09”,
“说明”:“测试下载”,
“资源”:{
“InstanceSecurityGroup”:{
“类型”:“AWS::EC2::SecurityGroup”,
“财产”:{
“GroupDescription”:“启用RDP”,
“SecurityGroupIngress”:[
{“IpProtocol”:“tcp”,“FromPort”:“3389”,“ToPort”:“3389”,“CidrIp”:“0.0.0.0/0”}
]
}
},
“Windows服务器”:{
“类型”:“AWS::EC2::实例”,
“元数据”:{
“AWS::CloudFormation::Init”:{
“配置”:{
“文件”:{
“c:\\test\\google logo.png”:{
“来源”:http://www.google.com/images/srpr/logo4w.png"
}
}
}
}
},
“财产”:{
“InstanceType”:“m1.small”,
“ImageId”:“ami-bbf2e1cf”,
“SecurityGroup”:[{“Ref”:“InstanceSecurityGroup”}],
“KeyName”:“POP”,
“UserData”:{“Fn::Base64”:{“Fn::Join”:[“”[
“\n”,
“cfn-init.exe-v-s”,{“Ref”:“AWS::StackId”},
“-r Windows服务器”,
--region“,{”Ref:“AWS::region”},“\n”,
""
]]}}
}
},
“WindowsServerWaitHandle”:{
“类型”:“AWS::CloudFormation::WaitConditionHandle”
},
“WindowsServerWaitCondition”:{
“类型”:“AWS::CloudFormation::WaitCondition”,
“DependsOn”:“WindowsServer”,
“财产”:{
“句柄”:{“Ref”:“WindowsServerWaitHandle”},
“超时”:“1800”
}
}
}
}
这将完成执行,没有错误。。。没有文件。我哪里出错了?

乔纳森

我尝试了你的模板,并为我成功下载了文件。您可以检查实例上的cfn日志。它们位于
c:\cfn\log\
中。我的cfn-init.log显示:

2013-07-19 21:30:18,269 [DEBUG] Parent directory c:\test does not exist, creating
2013-07-19 21:30:18,269 [DEBUG] Writing content to c:\test\google-logo.png
2013-07-19 21:30:18,269 [DEBUG] Retrieving contents from http://www.google.com/images/srpr/logo4w.png
2013-07-19 21:30:18,316 [DEBUG] No mode specified for c:\test\google-logo.png
2013-07-19 21:30:18,316 [WARNING] Unsupported OS for setting owner/group: nt
2013-07-19 21:30:18,269 [DEBUG] Request: GET http://www.google.com/images/srpr/logo4w.png [headers: {'Accept-Encoding': 'identity, deflate, compress, gzip', 'Accept': '*/*', 'User-Agent': 'python-requests/0.11.1'}]
2013-07-19 21:30:18,302 [DEBUG] Response: 200 http://www.google.com/images/srpr/logo4w.png [headers: {'content-length': '18946', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'expires': 'Fri, 19 Jul 2013 21:30:20 GMT', 'server': 'sffe', 'last-modified': 'Mon, 25 Mar 2013 19:02:15 GMT', 'cache-control': 'private, max-age=31536000', 'date': 'Fri, 19 Jul 2013 21:30:20 GMT', 'content-type': 'image/png'}]
我的cfn-wire.log显示:

2013-07-19 21:30:18,269 [DEBUG] Parent directory c:\test does not exist, creating
2013-07-19 21:30:18,269 [DEBUG] Writing content to c:\test\google-logo.png
2013-07-19 21:30:18,269 [DEBUG] Retrieving contents from http://www.google.com/images/srpr/logo4w.png
2013-07-19 21:30:18,316 [DEBUG] No mode specified for c:\test\google-logo.png
2013-07-19 21:30:18,316 [WARNING] Unsupported OS for setting owner/group: nt
2013-07-19 21:30:18,269 [DEBUG] Request: GET http://www.google.com/images/srpr/logo4w.png [headers: {'Accept-Encoding': 'identity, deflate, compress, gzip', 'Accept': '*/*', 'User-Agent': 'python-requests/0.11.1'}]
2013-07-19 21:30:18,302 [DEBUG] Response: 200 http://www.google.com/images/srpr/logo4w.png [headers: {'content-length': '18946', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'expires': 'Fri, 19 Jul 2013 21:30:20 GMT', 'server': 'sffe', 'last-modified': 'Mon, 25 Mar 2013 19:02:15 GMT', 'cache-control': 'private, max-age=31536000', 'date': 'Fri, 19 Jul 2013 21:30:20 GMT', 'content-type': 'image/png'}]

不久之后,它对我也起了作用——奇怪。感谢您抽出时间查看。