Skip to content

Instantly share code, notes, and snippets.

@goonoo
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save goonoo/01d934801b75d60d52b1 to your computer and use it in GitHub Desktop.

Select an option

Save goonoo/01d934801b75d60d52b1 to your computer and use it in GitHub Desktop.
EC2 Build Image script
#!/bin/bash
PATH=path/to/images
IMAGE=Image-`date +%Y%m%d-%H%M`
AWS_ACCESS_KEY=AGWEGAWEGAWEGAWEG
AWS_SECRET_KEY=waWG#reH5452HE23raWy432%
echo "building image ${IMAGE}"
sudo ec2-bundle-vol -k /home/ubuntu/.ssh/id_rsa -c /home/ubuntu/keys/server.crt -u USER_ID -r x86_64 --no-filter
ec2-upload-bundle -a ${AWS_ACCESS_KEY} -s ${AWS_SECRET_KEY} --bucket ${PATH}/${IMAGE} -m /tmp/image.manifest.xml
ec2-register ${PATH}/${IMAGE}/image.manifest.xml -region ap-northeast-1 -O ${AWS_ACCESS_KEY} -W ${AWS_SECRET_KEY} -n $IMAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment