Class: Lakitu::Provider::Aws

Inherits:
Lakitu::Provider show all
Defined in:
lib/lakitu/providers/aws.rb

Instance Method Summary collapse

Methods inherited from Lakitu::Provider

inherited, providers

Instance Method Details

#instances(profile, region) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lakitu/providers/aws.rb', line 10

def instances profile, region
  result = ec2(profile, region)
    .instances
    .to_a
    .select { |x| x.state.name == "running" }
    .map { |x| to_hash x }

  result.each do |x|
    x[:profile] = profile
    x[:region] = region
    x[:provider] = 'aws'
  end
end

#profilesObject



6
7
8
# File 'lib/lakitu/providers/aws.rb', line 6

def profiles
  IniParse.parse(File.read(File.expand_path('~/.aws/credentials'))).to_hash.keys.reject() do |x| x == '__anonymous__' end
end

#regionsObject



24
25
26
# File 'lib/lakitu/providers/aws.rb', line 24

def regions
  [ 'us-east-1', 'us-west-1', 'us-west-2' ]
end