How Do You Use the AWS CLI to View the Targets of Routes in Route Tables in a VPC?

Problem scenario
You have a VPC with route tables. You want to search the targets to find a given value. What should you do?

Solution
As of early 2020, the output of aws describe-route-tables --filters --route-table-id abcd1234 --region us-west-2 will not include the word "target". The value of the target in the JSON output will be the ID of the given target. Targets can be Egress Only Internet Gateway, Instance, Internet Gateway, Nat Gateway, Network Interface, Outpost Local Gateway, Peering Connection, Transit Gateway, or Virtual Private Gateway. Search for those keys or the value itself; do not search for the word "target" (regardless of how it is capitalized).

Leave a comment

Your email address will not be published. Required fields are marked *