我的 CloudFormation 模板中有以下用户数据脚本:
"UserData" : {"Fn::Base64" : {"Fn::Join" : ["", [
"#!/bin/bash\n",
"cd /home/www","\n",
"sudo su www","\n",
"git clone git@github.com:company-name/web-app.git -b master2 app","\n",
"cd app","\n",
"phing clean prepare configure -Dpropsfile ./build/props/build.ec2.properties","\n",
"\n",
"/opt/aws/bin/cfn-signal",
" -e $?",
" '", {"Ref" : "WebServerPort"}, "'",
"\n"
]]}},
这将运行一个基于默认 cloudformation 模板的预配置私有 ami 如果我自己启动一个实例,我可以运行 git/build 进程而不会出现错误但是当 cloudformation 启动服务器时,它似乎从未运行过