0
我試圖從AWS Cloudformation模板中的啓動配置的用戶數據運行shell腳本。我用一些腳本創建了AMI。啓動配置用戶數據shell腳本不從CloudForms運行
這裏是例如,從LaunchConfiguration的Cloudformation模板:
"ProcessLC": {
"Type" : "AWS::AutoScaling::LaunchConfiguration",
"Properties" : {
"ImageId": {"Ref" : "GeneralAMI"},
"InstanceType" : "t2.medium",
"SecurityGroups" : [{"Ref": "SecurityGroup"}],
"KeyName" : {"Ref": "KeyPair"},
"UserData": {"Fn::Base64": {"Fn::Join": ["", [
{"Fn::Join": ["", ["Env=",{"Ref": "Env"}," \n"]]},
{"Fn::Join": ["", ["DBConn=", {"Ref": "Database"}," \n"]]},
{"Fn::Join": ["", ["DBEngine=", {"Ref": "Metabase"}," \n"]]},
"#!/bin/bash\n",
"cd /project/\n",
"./stop.sh\n",
"./vpcAssignIP.sh\n"
]
]
}
}
}
}
它不運行(正如我在日誌「/var/log/cloud-init.log」見),當我創建堆棧。 我做錯了什麼?
謝謝!
所以如果「fn :: join」將在bash腳本之後,它們將不起作用,不是嗎? – muzafarow
您必須將您的連接輸出「#!/ bin/bash \ n」作爲第一行。目前,您的連接輸出該行作爲第四行。查看我編輯的代碼片段。 –