cfn-initはファイルを受け入れますが、ファイルにはルートキーとして"Metadata"
キーが必要です。
は、だから我々はtemplate.json
にこれを保存する場合:
{
"AWS::CloudFormation::Init": {
"config": {
"files": {
"C:\\Users\\Administrator\\Desktop\\test-file": {
"source": "https://s3.us-east-2.amazonaws.com/example-bucket/example-file"
}
}
}
},
"AWS::CloudFormation::Authentication": {
"S3AccessCreds": {
"type": "S3",
"buckets": ["example-bucket"],
"roleName": "s3access"
}
}
}
その後、我々はcfn-init -v --region us-east-2 template.json
を実行することができます。
注:あなたはあなたが得るでしょうcfn-init -v -s my_stack -r my_instance --region us-east-2 template.json
使用する場合は、スタックまたはリソースを含めないでください:
Error: You cannot specify more than one input source for metadata
rootとしてだけではなく、「メタデータ」の全体のテンプレートファイルを置く場合は、取得します:
Could not find 'AWS::CloudFormation::Init' key in template.json