I am creating an ASG in which i want to call few rest api's soon after the instance is created. i know i can write a bash script and pass that in cloud-config but i want to use a python script since that will give me additional advantage of using json parsing libraries. i am not able to figure out how to pass the python file in user-data cloud-config. any help is much appreciated.
# ...terraform stuff for ASG
user_data = <<EOF
#cloud-config
#script.py(my python script)
One way would be to run your script inline, as in
python -c "print 'Hello, World!'"
.If you really need a script passed in you'll need to have the user_data script download it to the instance from some storage location. Or if you're using a custom built AMI you would be able to include the script on the AMI.