Class: Soror::EC2::Instance

Inherits:
Object
  • Object
show all
Extended by:
Soror::EC2
Defined in:
lib/soror/ec2/instance.rb

Class Method Summary collapse

Methods included from Soror::EC2

client, resource

Class Method Details

.search_by(tags) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/soror/ec2/instance.rb', line 7

def search_by(tags)
  filters = [].tap do |array|
    array << { name: 'instance-state-name', values: ['running'] }
    tags.each do |k, v|
      array << { name: "tag:#{k}", values: [v] }
    end
  end
  resource.instances(filters: filters).to_a
end