Class: Dploy::EC2Client
- Inherits:
-
Object
- Object
- Dploy::EC2Client
- Defined in:
- lib/dploy/ec2_client.rb
Instance Method Summary collapse
- #get_instances_by_tags(search_tags = {}) ⇒ Object
-
#initialize(access_key_id, access_key, ec2_endpoint) ⇒ EC2Client
constructor
A new instance of EC2Client.
Constructor Details
#initialize(access_key_id, access_key, ec2_endpoint) ⇒ EC2Client
Returns a new instance of EC2Client.
7 8 9 10 11 12 13 |
# File 'lib/dploy/ec2_client.rb', line 7 def initialize(access_key_id, access_key, ec2_endpoint) @ec2 = AWS::EC2.new( :access_key_id => access_key_id, :secret_access_key => access_key, :ec2_endpoint => ec2_endpoint ) end |
Instance Method Details
#get_instances_by_tags(search_tags = {}) ⇒ Object
15 16 17 |
# File 'lib/dploy/ec2_client.rb', line 15 def ( = {}) .map{|k,v| {k => v}}.reduce(@ec2.instances){|filtered_result,search_tag | filtered_result.tagged(search_tag.keys).tagged_values(search_tag.values)} end |