make ec2ami

As my regular readers will be aware, I have been working on bringing FreeBSD to the Amazon EC2 platform for many years. While I have been providing pre-built FreeBSD/EC2 AMIs for a while, and last year I wrote about my process for building images, I have been told repeatedly that FreeBSD users would like to have a more streamlined process for building images. As of a few minutes ago, this is now available in the FreeBSD src tree: make ec2ami

This code makes use of the FreeBSD release-building framework — in particular the work done by Glen Barber to create virtual-machine images — and the bsdec2-image-upload tool I wrote a few months ago. Once you have installed bsdec2-image-upload (from pkg or the ports tree) and set some AWS parameters (AWS key file, region, and S3 bucket to be used for staging) in /etc/make.conf, building an AMI takes just two commands:

# cd /usr/src && make buildworld buildkernel
# cd /usr/src/release && make ec2ami

EDIT 2023-07-13: That should be make WITH_CLOUDWARE=YES ec2ami; the code for building cloudware disk images (including the disk image uploaded to create an AMI) is only enabled with the extra flag.

This will build an AMI in the EC2 region you specified; if you want to copy the AMI out to all EC2 regions and make it public, you can do this by adding an extra option:

# cd /usr/src && make buildworld buildkernel
# cd /usr/src/release && make ec2ami EC2PUBLIC=YES

I did this a few hours ago, and after about an hour of bits being copied around, I had this on my console:

Created AMI in us-east-1 region: ami-aa0532c2
Created AMI in us-west-1 region: ami-bb2cccff
Created AMI in us-west-2 region: ami-534b6263
Created AMI in sa-east-1 region: ami-1315ae0e
Created AMI in eu-west-1 region: ami-55b12b22
Created AMI in eu-central-1 region: ami-4a97aa57
Created AMI in ap-northeast-1 region: ami-1de21f1d
Created AMI in ap-southeast-1 region: ami-a66f5cf4
Created AMI in ap-southeast-2 region: ami-2df98a17

Building an AMI in one command: Could it really get any easier?

Posted at 2015-04-01 00:00 | Permanent link | Comments
blog comments powered by Disqus

Recent posts

Monthly Archives

Yearly Archives


RSS