2013-07-19 6 views
1

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?

Répondre

1

Jonathon,

J'ai essayé votre modèle et le fichier téléchargé avec succès pour moi. Vous pouvez vérifier les journaux cfn sur l'instance. Ils sont au c:\cfn\log\. Mes CFN-init.log montre:

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 

Et mes CFN-wire.log montre:

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'}] 
+0

Peu après, il a travaillé pour moi aussi - bizarre. Merci d'avoir pris le temps de vérifier. – Jonathan

Questions connexes