Python – Using boto, is there a way to create an AMI from a snapshot ID

amazon ec2amazon-amiamazon-web-servicespython

There's a command in the AWS EC2 API called ec2-register or ec2reg which has an argument -s for snapshot ID. You are able to create an image from a snapshot. I'd like to be able to do this in Python (currently using boto), but it doesn't look like it's built in functionality within boto yet. Is there still a way using boto to create an image from a snapshot id? Also assume, architecture, kernel, and other attributes are available and S3 access if necessary. Thanks.

Best Answer

Yes, boto does have an AMI registration function. Please look at http://readthedocs.org/docs/boto/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.register_image.

You need to register an AMI with every option except for "image_location". Specify your snapshot id when making the block device mapping object for whatever you specified as your "root_device_name".

Related Topic