forward3d/cap-ec2 — pull request #7 by rjocoleman (2014-02-11 20:21:07+00:00)
Title: Multiple Regions + questions

@andytinycat: I've got a couple of questions about some of the functionality in this gem, I'm going to propose some changes but I'm keen to retain backwards compatibility so I'd like to understand the supported use cases.

* You've got multiple regions here https://github.com/forward3d/cap-ec2/blob/master/lib/cap-ec2/ec2-handler.rb#L8 and https://github.com/forward3d/cap-ec2/blob/master/lib/cap-ec2/ec2-handler.rb#L69
What's the use case for this?

* https://github.com/forward3d/cap-ec2/blob/master/lib/cap-ec2/capistrano.rb#L20 what the purpose of `ec2.yml` rather than defining these as Capistrano variables?

The AWS SDK out of the box supports credentials via ENV so currently if `config/ec2.yml` is blank (except for regions due to the lines mentioned above) and the AWS ENV exist they are used for the credentials. This is also how IAM roles work so they'd be supported too.

I keep all of my secrets in files `.env` files per stage and use [capistrano-env-config](https://github.com/rjocoleman/capistrano-env-config) to push them into the Capistrano environment to avoid pollution of the ENV and automatically manage different credentials per stage.

If you're open to it I'd like to submit a pull request that will:

1. Make `config/ec2.yml` optional (for backward compatibly) and define `:access_key_id` and `:secret_access_key` as Capistrano variables.

2. When listing instances iterate through all the regions available to the configured AWS account, rather than a pre-defined set.

3. Move the config for `stages_tag`, `roles_tag` and `project_tag` to Capistrano variables too.