Building EC2 Images from Scratch with ec2ubuntu-build-ami

Update: The process described here is deprecated for building Ubuntu AMIs. The Ubuntu vmbuilder software has replaced ec2ubuntu-build-ami. In addition I recommend starting with the Ubuntu images published by Canonical as described in this article:

Building EBS Boot AMIs Using Canonical’s Downloadable EC2 Images

The below information may be useful for building Debian AMIs, but EC2 kernels are slowly getting out of date for running modern Debian releases.

The Ubuntu and Debian images for EC2 which are published on were built with the ec2ubuntu-build-ami software. This program can also be used by advanced users who wish to build from scratch their own Ubuntu or Debian images for EC2.

The basic instructions for using this script are as follows:

  1. Pick which instance type and kernel version you want in your Ubuntu AMI. Start an instance of the matching Amazon Fedora Core AMI:

    • 32-bit: ami-f51aff9c
    • 64-bit: ami-f21aff9b
  2. Copy your certificate file and private key file to the EC2 instance ephemeral storage, then ssh to the EC2 instance HOSTNAME using your ssh IDENTITY file:

    scp -i IDENTITY {cert,pk}-*.pem root@HOSTNAME:/mnt/
    ssh -i IDENTITY root@HOSTNAME
  3. Download the build script.

  4. Run the build script passing options as desired. Read the comments at the top of the script for more options.

    bash ec2ubuntu-build-ami \
        --codename hardy     \
        --bucket NAME        \
        --prefix NAME        \
        --user ID            \
        --access-key ID      \
        --secret-key ID      \
        --private-key PATH   \
        --cert PATH
  5. Register the AMI from your local computer. Instructions will be provided when the build script completes.

Read the instructions at the top of the code for more details on available options including ways to plug in your own customization of the new image.

If you have questions or feedback about this software, please let us know through the EC2 Ubuntu group.