Skip to content

Instantly share code, notes, and snippets.

@corck
Created March 26, 2012 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corck/2203135 to your computer and use it in GitHub Desktop.
Save corck/2203135 to your computer and use it in GitHub Desktop.
Create and upload AMI - Rake task
desc "create ami bundle and upload it to s3"
task :create_and_upload_bundle do |channel, stream, data|
set :user, 'app'
message = "Please enter platform [i386|x86_64]"
platform = Capistrano::CLI.ui.ask(message)
message = "Please enter a bundle name:"
bundle_name = Capistrano::CLI.ui.ask(message)
sudo "rm -r /mnt/image; true"
sudo "ec2-bundle-vol -e /volume1,/volume2 -d /mnt -k ~/.ssh/XXXXX.pem -c ~/.ssh/cert-XXXXX.pem -u USERID -r #{platform}"
#sudo "ec2-bundle-vol -d /mnt -k ~/.ssh/XXXXX.pem -c ~/.ssh/cert-XXXX.pem -u USERID -r #{platform}"
sudo "ec2-upload-bundle -b #{bundle_name} -m /mnt/image.manifest.xml -a KEY -s SECRET"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment