List subnets with VPC names
Just one-liner to print VPC and subnet IDs with a tag, Name
, of VPC.
Easy to see them without logging into management console of AWS.
join -a1 \
<(aws ec2 describe-subnets | \
jq -r '.Subnets[]|[.VpcId,.SubnetId,.CidrBlock]|@tsv' | sort) \
<(aws ec2 describe-vpcs | \
jq -r '.Vpcs[]|[.VpcId,(select(.Tags!=null)|.Tags[]|select(.Key=="Name").Value)]|@tsv' | sort)