Reputation: 33
I can get to the subnet id though not the subnet name, I don't see this in the metadata either...
I need to switch based the subnet name on a script, don't want to have ids mapped to logical names...
Wondering how/if I can get the subnet name somehow
Upvotes: 1
Views: 1564
Reputation: 1471
If you can use the CLI you can use ec2 describe-subnets
, like so:
aws ec2 describe-subnets --subnet-ids $SUBNET_ID --query "Subnets[*].Tags[?Key=='Name'].Value" --output text
Upvotes: 4