Sharing AMIs with DistAMI

Sharing is caring

Making AMIs is easy with tools such as Aminator and Packer. And copying an AMI to another region is a single API call now. However, if you produce AMIs for the public, distributing them to all regions and making the AMIs and the underlying EBS Snapshots public is still fairly manual. To automate this, we are releasing DistAMI.

With DistAMI, once you have made a single AMI in any region you like, you can distribute it by running a command like

distami ami-1234abcd

This will copy the AMI and snapshot to all regions, and make them all publicly accessible. By default, DistAMI does this in serial. To speed things up, you can add the -p option to copy to all regions in parallel. You can also run DistAMI from you laptop, and specify the region the AMI is in:

distami --region ap-southeast-2 -p ami-1234abcd

DistAMI also copies all of the tags associated with the AMI and Snapshots to all regions as well. Just be sure to tag the original AMI and Snapshot before running DistAMI to make finding them easy.

DistAMI is open source with an Apache 2 license, written in Python, and uses the Boto library to make API calls to AWS. If you are using the AWS CLI tools, you have no new configuration to do. Boto automatically searches for environment variables, .boto files, and if DistAMI is running on an EC2 instance with an IAM Role, Boto will find the credentials for that as well.

To install DistAMI, you run the (hopefully) familiar pip program

sudo pip install distami

(I include the sudo because that is what I need on my Macbook, and also what is needed on Ubuntu, but it is not strictly necessary)

There are many additional features that could be added to DistAMI, but being a big fan of Lean, I am not adding any of them unless other users tell me to. Feel free to create an Issue if you have an idea, or if you are comfortable with Python, fork the repository and submit a pull request. We are always interested in feedback.

I hope you find it useful.

comments powered by Disqus