cap-ec2 icon indicating copy to clipboard operation
cap-ec2 copied to clipboard

Add support for ec2_filters

Open cheald opened this issue 8 years ago • 2 comments

@I've been finding myself needing ways to more specifically target classes of machines in my EC2 deploy, so I hacked this into my own copy of cap-ec2. The idea is that rather than specifying application and stage tags, you can provide your own list of filters. That is:

set :ec2_filters, { "tag:Project" => "*foo"*, "tag:Stages" => fetch(:stage) }

is functionally equivalent to the existing setup. However, I can also customize it with any filter supported by ec2-describe-instances.

set :ec2_filters, { "tag:Project" => "*foo"*, "tag:Stages" => fetch(:stage), "instance-type" => ["r3.xlarge" "r3.2xlarge"] }

Role filtering still applies with the previous strategy regardless (as Cap is pretty directly tied to the idea of roles).

I can compose an arbitrary set of filters to target specifically the machines I need to. It's been useful for me, and as a poweruser addition to the existing featureset, may find some use for other people too!

cheald avatar Mar 15 '16 19:03 cheald

@andytinycat ping. This feature would be really helpful for me as well!

korotovsky avatar Sep 07 '16 07:09 korotovsky

very cool Let's Get This Merged

AlexMorreale avatar Mar 20 '17 16:03 AlexMorreale