Capistrano plugin providing some useful utilities for interacting with EC2. Currently only provides management of security group ports.
NOTE: Uses Version 1 of the AWS SDK gem.
Add the gem to your Gemfile
and run bundle install
:
group :development do
gem 'capistrano-ec2-utils', github: 'elevation/capistrano-ec2-utils'
end
Then add the gem to your Capfile
:
require 'capistrano/ec2-utils'
AWS credentials will attempt to load from config/aws.yml
by default and
should be grouped by environment - the same format as the aws-sdk gem uses.
You can change the path to the yaml file if required:
set :ec2_config, "config/ec2.yml"
set :ec2_access_key_id, "YOUR_ACCESS_KEY"
set :ec2_secret_access_key, "YOUR_SECRET_ACCESS_KEY"
set :ec2_security_group, "YOUR_EC2_SECURITY_GROUP"
You can also optionally configure security group ports that are managed or your aws region
set :ec2_ports, [2222] # defaults to [22]
set :ec2_region, 'us-west-2'
cap production ec2:allow_ip # opens ports for your current ip
cap production ec2:revoke_ip # closes ports for your current ip
cap production ec2:cleanup_ips # closes ports for all ips except your current ip
- Allow configuration via yaml file
- Support region config
- Publish rubygem
- Add some tests