Last Updated: February 25, 2016
·
261
· ddossot

Bash function to easily lookup EC2 instances in one region

Pretty ugly but very convenient:

function ec2-lookup() {
  aws ec2 describe-instances --region $1 --filters "Name=tag:Name,Values=*$2*" --query='Reservations[*].Instances[*].[PublicDnsName,Tags[*].Value]' --output text
}

Usage: ec2-lookup us-east-1 fizzbuzz