diff --git a/cloud/aws/custom/awscli.pm b/cloud/aws/custom/awscli.pm index c86e59b4f..231628e41 100644 --- a/cloud/aws/custom/awscli.pm +++ b/cloud/aws/custom/awscli.pm @@ -348,6 +348,7 @@ sub ec2_list_resources { InstanceType => $instance->{InstanceType}, State => $instance->{State}->{Name}, Tags => join(",", @instance_tags), + KeyName => $instance->{KeyName}, }; } diff --git a/cloud/aws/ec2/mode/listinstances.pm b/cloud/aws/ec2/mode/listinstances.pm index 83b211ae5..080157d08 100644 --- a/cloud/aws/ec2/mode/listinstances.pm +++ b/cloud/aws/ec2/mode/listinstances.pm @@ -54,8 +54,8 @@ sub run { $self->manage_selection(%options); foreach (@{$self->{instances}}) { next if ($_->{Type} !~ m/instance/); - $self->{output}->output_add(long_msg => sprintf("[Id = %s][AvailabilityZone = %s][InstanceType = %s][State = %s][Tags = %s]", - $_->{Name}, $_->{AvailabilityZone}, $_->{InstanceType}, $_->{State}, $_->{Tags})); + $self->{output}->output_add(long_msg => sprintf("[Id = %s][AvailabilityZone = %s][InstanceType = %s][State = %s][Tags = %s][KeyName = %s]", + $_->{Name}, $_->{AvailabilityZone}, $_->{InstanceType}, $_->{State}, $_->{Tags}, $_->{KeyName})); } $self->{output}->output_add(severity => 'OK', @@ -67,7 +67,7 @@ sub run { sub disco_format { my ($self, %options) = @_; - $self->{output}->add_disco_format(elements => ['id', 'availabilityzone', 'instancetype', 'state', 'tags']); + $self->{output}->add_disco_format(elements => ['id', 'availabilityzone', 'instancetype', 'state', 'tags', 'keyname']); } sub disco_show { @@ -82,6 +82,7 @@ sub disco_show { instancetype => $_->{InstanceType}, state => $_->{State}, tags => $_->{Tags}, + keyname => $_->{KeyName}, ); } }