Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I create an EC2 image from a running instance using boto?
    primarykey
    data
    text
    <p>I'm trying to create a simple python backup script for my EC2 instances. This script's purpose is to create daily/weekly snapshots of the current machine (see <a href="https://serverfault.com/questions/238083/whats-the-easiest-way-to-auto-backup-an-ec2-instance/244091#244091">this question on ServerFault</a>). I'm using the <a href="http://code.google.com/p/boto/" rel="nofollow noreferrer">boto</a> python package for EC2 API, and would like to create an EBS AMI from a given instance (like ElasticFox's "Create Image" action)</p> <pre><code># This script will look up all your running EC2 images, find the current one, and back it up by creating an AMI # Configuration accessKeyId = "..." accessKeySecret = "..." target = "..." def resolveIp(target): import socket ip = repr(socket.gethostbyname_ex(target)[2][0]) return ip def find_target(target, connection) : ip = resolveIp(target) print "Finding instance for " + target + " (IP " + ip + ")" reservations = connection.get_all_instances(); for reservation in reservations: instances = reservation.instances if len(instances) != 1: print "Skipping reservation " + reservation continue instance = instances[0] instanceIp = resolveIp(instance.dns_name) if instanceIp == ip: return instance raise Exception("Can't find instance with IP " + ip) from boto.ec2.connection import EC2Connection print "Connecting to EC2" conn = EC2Connection(accessKeyId, accessKeySecret) print "Connected to EC2" instance = find_target(target, conn) print "Backing up instance '{}'".format(instance) # Now, I'd like to create a new image out of this instance # Can you help? </code></pre> <p>(Also reported as <a href="http://code.google.com/p/boto/issues/detail?id=495" rel="nofollow noreferrer">an issue on the boto project page</a>, since I didn't find a mailing list)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload