Je dois télécharger un fichier lors de l'initialisation de mon instance Windows. Pour tester cela, j'utilise le script suivant pour télécharger le logo Google (en utilisant une version simplifiée du Windows Roles and Features template):Pourquoi mon script CloudFormation ne téléchargera-t-il pas un fichier?
{
"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"
}
}
}
}
Cette fin de l'exécution sans erreur ... et aucun fichier. Où vais-je mal?
Peu après, il a travaillé pour moi aussi - bizarre. Merci d'avoir pris le temps de vérifier. – Jonathan