我的 cloudformation 模板中有类似的东西
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#cloud-config\n",
"repo_releasever: ",
{
"Ref": "LinuxVersion"
},
"\n",
"\n",
"runcmd:\n",
" - [curl, -s, -S, -o, /tmp/user_data.txt, 'http://some.s3bucket.amazonaws.com/cfn/some_Script.txt']\n",
" - [bash, /tmp/user_data.txt]\n",
" - [mkdir, -p, /root/.aws/\n",
" - [echo, ' aws_access_key_id = ", { "Ref": "AWSAccessKey" }, " >> /root/.aws/credentials']\n",
" - [echo, ' aws_secret_access_key' = ", { "Ref": "AWSSecretAccessKey" }, " >> /root/.aws/credentials']\n"
]
]
}
}
}
},
一旦实例由 CloudFormation 供应,如果执行此操作,则无。
/var/lib/cloud/instance/scripts/ 中没有创建任何内容。