class AWS

Public Class Methods

new() click to toggle source
# File lib/lanes/aws.rb, line 6
def initialize
  @conn = Awscli::Connection.new.request_ec2('us-west-2')
end

Public Instance Methods

fetchServers(lane=nil) click to toggle source

Fetch any servers in a given lane

# File lib/lanes/aws.rb, line 11
def fetchServers(lane=nil)
  servers = []

  @conn.servers.each{ |server|
    s = {
        :ip => server.public_ip_address,
        :lane => server.tags['Lane'],
        :name => server.tags['Name'],
        :id => server.id
    }
    if s[:ip]
      if lane == nil or lane == s[:lane]
        servers.push s
      end
    end
  };

  servers.sort_by!{ |s| [s[:lane] ? s[:lane] : "zzz", s[:name]] }

  return servers
end