Class: Stax::Cmd::Ec2
- Inherits:
-
SubCommand
- Object
- Thor
- Base
- SubCommand
- Stax::Cmd::Ec2
- Defined in:
- lib/stax/mixin/ec2.rb
Constant Summary collapse
- COLORS =
{ ## instances running: :green, stopped: :yellow, terminated: :red, ## images available: :green, pending: :yellow, failed: :red, }
Instance Method Summary collapse
Methods inherited from SubCommand
#info, stax_info, stax_info_tasks
Instance Method Details
#ls ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/stax/mixin/ec2.rb', line 27 def ls debug("EC2 instances for #{my.stack_name}") print_table Aws::Ec2.instances(my.stack_name).map { |i| name = i..find { |t| t.key == 'Name' }&.value [ name, i.instance_id, i.instance_type, i.placement.availability_zone, color(i.state.name, COLORS), i.private_ip_address, i.public_ip_address ] } end |