Bootstrap FreeKB - Amazon Web Services (AWS) - List Route Tables using the AWS CLI
Amazon Web Services (AWS) - List Route Tables using the AWS CLI

Updated:   |  Amazon Web Services (AWS) articles

This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

The aws ec2 describe-route-tables command can be used to list your Route Tables.

aws ec2 describe-route-tables

 

And here is an example of how to limit the output using the --query option to list the route table in a specific Virtual Private Cloud (VPC).

aws ec2 describe-route-tables --query 'RouteTables[?VpcId==`vpc-014d2fcfa335d3c01`]'

 

Something like this should be returned.

[
    {
        "Associations": [
            {
                "AssociationState": {
                    "State": "associated"
                },
                "RouteTableAssociationId": "rtbassoc-03d88b8f543d22956",
                "Main": true,
                "RouteTableId": "rtb-0587dc78ea0f59472"
            }
        ],
        "RouteTableId": "rtb-0587dc78ea0f59472",
        "VpcId": "vpc-014d2fcfa335d3c01",
        "PropagatingVgws": [],
        "Tags": [
            {
                "Value": "ManagedByAmazonFSx",
                "Key": "AmazonFSx"
            }
        ],
        "Routes": [
            {
                "GatewayId": "local",
                "DestinationCidrBlock": "172.31.0.0/16",
                "State": "active",
                "Origin": "CreateRouteTable"
            },
            {
                "GatewayId": "igw-020c1f7ec148352b3",
                "DestinationCidrBlock": "0.0.0.0/0",
                "State": "active",
                "Origin": "CreateRoute"
            }
        ],
        "OwnerId": "123456789012"
    }
]

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 806e7a in the box below so that we can be sure you are a human.