GetEC2PublicIPsForTaggedInstances

nicolaw 7th June 2019 at 12:47pm
AWS awscli EC2 TechnicalNotes
TF_WORKSPACE="MyIdentifier" aws ec2 describe-instances \
  --filter \
    "Name=instance-state-name,Values=running" \
    "Name=tag:deployment,Values=$TF_WORKSPACE" \
  --query \
    "Reservations[].Instances[].[PublicIpAddress, Tags[?Key=='Name'].Value|[0]]" \
  --output text