Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Manage your EC2 instances from your bin folder
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Manage EC2 Instances with Pave


bin/pave launch production       # creates an ec2 instance using production config
bin/pave terminate i-5e09b621    # terminates ec2 instance i-5e09b621
bin/pave list                    # lists basic info for all ec2 instances
bin/pave --help                  # display usage instructions


cd to your rails app. Install pave with the following command:

 curl | sh

Now you'll have bin/pave in your app folder.


Pave uses Amazon's EC2 API Tools to interact with EC2. You'll need to make sure that those tools are installed properly and available in your $PATH before Pave will work. Check out Setting Up the Amazon EC2 Command Line Tools for help with this.

Once that's done, check out your .env.sample file to make sure you fill in the config settings.


I prefer to use my own ssh key rather than an ssh keypair that was generated by Amazon. However, Pave can handle any keypair as long as it is registered with Amazon. For more information on how to register your own ssh key with Amazon, read Uploading Personal ssh Keys to Amazon EC2.

Just tell me what to do!

Here are the steps that you could follow if you don't want to read the docs I linked above:

brew install ec2-api-tools

cat >> ~/.bash_profile <<EOF
export JAVA_HOME="$(/usr/libexec/java_home)"
export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
export EC2_URL=
export PATH=$PATH:$EC2_HOME/bin
export AWS_ACCESS_KEY=my_aws_access_key
export AWS_SECRET_KEY=my_aws_secret_key

source ~/.bash_profile

regions=$(ec2-describe-regions | cut -f2)

for region in $regions; do
  echo $region
  ec2-import-keypair --region $region --public-key-file $publickeyfile $keypair

cat >> .env <<EOF

Now just run the launch command to build your first instance!

bin/pave launch

What's with the .env files?

Storing your config settings in an .env file is something I first read about in the 12-Factor app docs. Foreman also supports the .env files. When I started looking for a place to store config settings, an .env file made more sense than something like a Capfile.

I've also pushed this a bit further when it comes to support multi-stage situations. If you are building a server for a staging environment, create an .env.staging file in your app with all of your staging settings. For production, create an env.production file.

Choosing an AMI

I prefer 64-bit instances and EBS Boot instances. I choose to use LTS releases of Ubuntu and take advantage of lower instance pricing in the US East region. That pretty much forces me into the following criteria when I search for an AMI: precise 64 us east ebs.

Something went wrong with that request. Please try again.