Class: Awry::Ec2

Inherits:
Cli
  • Object
show all
Defined in:
lib/awry/ec2.rb

Constant Summary collapse

COLORS =
{
  running: :green,
  terminated: :red,
}

Instance Method Summary collapse

Instance Method Details

#lsObject



17
18
19
20
21
22
23
# File 'lib/awry/ec2.rb', line 17

def ls
  client.describe_instances.map(&:reservations).flatten.map(&:instances).flatten.map do |i|
    [ tag_name(i), i.instance_id, color(i.state.name), i.instance_type, i.placement.availability_zone, i.private_ip_address, i.public_ip_address, i.launch_time ]
  end.tap do |list|
    print_table list.sort
  end
end