Skip to content

Instantly share code, notes, and snippets.

@sdepold
Created June 12, 2010 20:58
Show Gist options
  • Save sdepold/436072 to your computer and use it in GitHub Desktop.
Save sdepold/436072 to your computer and use it in GitHub Desktop.
ec2-add-keypair <name>-keypair
# copy the result to ./~ssh/id_rsa-<name>-keypair
chmod 700 ./~ssh/id_rsa-<name>-keypair
ec2-run-instances <instance-identifier, e.g.: ami-0d729464> -k <name>-keypair
# copy the value behind INSTANCE (should be smth. like i-64d4c00f)
ec2-describe-instances <copied value> (refresh until instance has booted)
# once it's running you will get an url which we use for ssh
ssh -i ~/.ssh/id_rsa-<name>-keypair root@<url>
sudo apt-get update
sudo apt-get install ruby-full build-essential
sudo apt-get install rubygems1.8
sudo gem install right_aws
require "rubygems"
require "right_aws"
KEY = "xx"
SECRET = "xx"
SOURCE_BUCKET = "xx"
TARGET_BUCKET = "xx"
s3 = RightAws::S3.new(KEY, SECRET)
source = s3.bucket(SOURCE_BUCKET)
target = s3.bucket(TARGET_BUCKET, true)
source.keys.each{ |key| target.put(key.name, key.data) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment