I'm trying to run shell scripts from User-data of Launch Configuration in AWS Cloudformation template. I created AMI with some script inside.
Here is example from Cloudformation template of LaunchConfiguration:
"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"
]
]
}
}
}
}
It doesn't run(as I see in log "/var/log/cloud-init.log") when I creating stack. What I'm doing wrong?
Thanks!