Skip to content

Commit

Permalink
Update describe-instances for awscli 1.11 (thanks @mikegcoleman for f…
Browse files Browse the repository at this point in the history
…inding that bug!)
  • Loading branch information
jpetazzo committed Apr 27, 2017
1 parent acab2f9 commit 37242c0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions prepare-vms/scripts/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,24 @@ aws_display_instances_by_tag() {
fi
}

aws_get_instance_ids_by_filter() {
FILTER=$1
aws ec2 describe-instances --filters $FILTER \
--query Reservations[*].Instances[*].InstanceId \
--output text | tr "\t" "\n"
}


aws_get_instance_ids_by_client_token() {
TOKEN=$1
need_tag $TOKEN
aws ec2 describe-instances --filters "Name=client-token,Values=$TOKEN" \
| grep ^INSTANCE \
| awk '{print $8}'
aws_get_instance_ids_by_filter Name=client-token,Values=$TOKEN
}

aws_get_instance_ids_by_tag() {
TAG=$1
need_tag $TAG
aws ec2 describe-instances --filters "Name=tag:Name,Values=$TAG" \
| grep ^INSTANCE \
| awk '{print $8}'
aws_get_instance_ids_by_filter Name=tag:Name,Values=$TAG
}

aws_get_instance_ips_by_tag() {
Expand Down

0 comments on commit 37242c0

Please sign in to comment.