Open GoogleCodeExporter opened 9 years ago
I have used user_data extensively with boto so I'm pretty sure the
functionality should be working. What are you using to try to retrieve the
user_data on the instance? The boto.utils module has a function called
get_instance_userdata. Have you tried using that?
Original comment by Mitch.Ga...@gmail.com
on 8 Aug 2010 at 10:44
Thanks for you reply.
I used get_instance_userdata() function from boto.utils but it did not work
too. Here is my whole code that I run in my local. Would you please check it
and let me know what is the problem with it that it does not work and my shell
script passed as user_data to the instance does not work?
import time
try:
import boto
import boto.utils
ec2 = boto.connect_ec2(KEY, SECRET)
reservation = ec2.run_instances(image_id=AMI_ID,
key_name=KEY_NAME,
security_groups=SECURITY_GROUP,
user_data = """#!/bin/bash
cd /root
mkdir rozita
""",
instance_type=INSTANCE_TYPE)
instance = reservation.instances[0]
instance.update()
while not instance.state == "running":
time.sleep(30)
instance.update()
print boto.utils.get_instance_userdata()
instance.stop()
except Exception,e:
print str(e)
Original comment by rozita.r...@gmail.com
on 10 Aug 2010 at 7:54
Issue 437 has been merged into this issue.
Original comment by Mitch.Ga...@gmail.com
on 14 Aug 2010 at 2:08
think there may be some confusion about the userdata. It can only be access from the actual EC2 instance. There is no way to access the special metadata server from another machine. So, basically, you pass the userdata to the instance and then the instance can access it and do whatever you want to do with it. If you want to pass in a script and have that run automatically you will either have to create a custom AMI that adds something to rc.local (or equivalent) to run your script or you could try using an Ubuntu image which has built in support for something they call CloudInit:
https://help.ubuntu.com/community/CloudInit
Does that help?
Mitch
Original comment by Mitch.Ga...@gmail.com
on 22 Aug 2010 at 12:41
Original comment by Mitch.Ga...@gmail.com
on 22 Aug 2010 at 12:41
Original issue reported on code.google.com by
rozita.r...@gmail.com
on 8 Aug 2010 at 5:58