douglasjarquin / capistrano-ec2tag

A Capistrano plugin to deploy to Amazon EC2 instances based on their tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

capistrano-ec2tag is a Capistrano plugin designed to simplify the task of deploying to infrastructure hosted on Amazon EC2. It was inspired by the capistrano-ec2group plugin, to which all credit is due.

While the original capistrano-ec2group plugin served me well, I started to run into cases where I wanted more flexibility. More specifically, in order to change security groups, instances have to be restarted.

I created capistrano-ec2tag to bypass this limitation. Now, modifying the list of instances that are deployable is as easy as modifying tags.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-ec2tag'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-ec2tag

Configuration

Tag your instances, using deploy as the key. For example:

tag-example

The tag value can be any string, but I suggest using something like APP-ENVIRONMENT.

Usage

Add this to the top of your deploy.rb:

require 'capistrano/ec2tag'

Then supply your AWS credentials with the environment variables (default):

# aws
export AWS_ACCESS_KEY_ID='...'
export AWS_SECRET_ACCESS_KEY='...'

Or in your deploy.rb with capistrano variables:

set :aws_access_key_id, '...'
set :aws_secret_access_key, '...'
# old & busted
server 'web1.example.com', :web

# new hotness
tag 'github-staging', :web

License

capistrano-ec2tag is copyright 2013 by Douglas Jarquin, released under the MIT License (see LICENSE for details).`

About

A Capistrano plugin to deploy to Amazon EC2 instances based on their tags

License:MIT License


Languages

Language:Ruby 100.0%