Skip to content

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

License

Notifications You must be signed in to change notification settings

uriagassi/capistrano-ec2tag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, '...'

Remember to set your region if it is not the AWS's default one (us-east-1)

set :aws_region, 'eu-west-1'

Alternatively you can use an AWS_CREDENTIAL_FILE

#aws
export AWS_CREDENTIAL_FILE='...'

or

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

# new hotness
invoke 'ec2tag:tag', 'github-staging', :web
 
# on old capistrano DSL (v2.x)
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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%