Skip to content

Instantly share code, notes, and snippets.

@dustymabe
Created October 30, 2014 04:52
Show Gist options
  • Save dustymabe/3d53cfe6b9ae32c5e2fb to your computer and use it in GitHub Desktop.
Save dustymabe/3d53cfe6b9ae32c5e2fb to your computer and use it in GitHub Desktop.
ec2makeimage.txt
# Using ec2-api-tools cli to create ebs backed AMI
# get the cli from https://aws.amazon.com/developertools/Amazon-EC2/351
# Download image
wget https://kojipkgs.fedoraproject.org//work/tasks/8933/7978933/Fedora-Cloud-Base-20141029-21_Beta.i386.raw.xz --no-check-certificate
# Uncompress image
unxz Fedora-Cloud-Base-20141029-21_Beta.i386.raw.xz
# export keys to env
export AWS_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Create ebs volume from image
ec2-import-volume Fedora-Cloud-Base-20141029-21_Beta.i386.raw -b dustyfedoratesting --owner-akid $AWS_ACCESS_KEY --owner-sak $AWS_SECRET_KEY --prefix Fedora-20141029-21-Beta-i386 -f raw -z us-east-1a
# After upload, use import-vol taskid to periodically check for when the volume has been created
ec2-describe-conversion-tasks import-vol-xxxxxxxx
# Once volume is created there will be a volume that exists (volume id in output)
# Create a snapshot from this volume:
ec2-create-snapshot vol-xxxxxxxx
# Gather snapshot id and monitor for when snapshot is ready
ec2-describe-snapshots snap-xxxxxxxx
# Now register AMI from snapshot
ec2-register --name dustyf21i386 --virtualization-type hvm --snapshot snap-xxxxxxxx
# Make the image public:
ec2-modify-image-attribute ami-xxxxxxxx -l -a all
# Now you can share ami-xxxxxxxx with others to use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment