Difference between revisions of "Aws ec2 describe-route-tables"

From wikieduonline
Jump to navigation Jump to search
(Created page with "{{lc}} aws ec2 describe-route-tables == See also == * {{aws ec2}} Category:AWS")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  [[aws ec2]] describe-route-tables
+
* https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-route-tables.html
 +
  [[aws ec2]] describe-[[route]]-tables
  
 +
aws ec2 describe-route-tables | [[jq -r]] '.RouteTables[] | select(.[[Tags]][].Value=="YOUR_TAG/PublicRouteTable") | .RouteTableId'
 +
 +
== Official example ==
 +
<pre>
 +
{
 +
    "RouteTables": [
 +
        {
 +
            "Associations": [
 +
                {
 +
                    "Main": true,
 +
                    "RouteTableAssociationId": "rtbassoc-0df3f54e06EXAMPLE",
 +
                    "RouteTableId": "rtb-09ba434c1bEXAMPLE"
 +
                }
 +
            ],
 +
            "PropagatingVgws": [],
 +
            "RouteTableId": "rtb-09ba434c1bEXAMPLE",
 +
            "Routes": [
 +
                {
 +
                    "DestinationCidrBlock": "10.0.0.0/16",
 +
                    "GatewayId": "local",
 +
                    "Origin": "CreateRouteTable",
 +
                    "State": "active"
 +
                },
 +
                {
 +
                    "DestinationCidrBlock": "0.0.0.0/0",
 +
                    "NatGatewayId": "nat-06c018cbd8EXAMPLE",
 +
                    "Origin": "CreateRoute",
 +
                    "State": "blackhole"
 +
                }
 +
            ],
 +
            "Tags": [],
 +
            "VpcId": "vpc-0065acced4EXAMPLE",
 +
            "OwnerId": "111122223333"
 +
        },
 +
        {
 +
            "Associations": [
 +
                {
 +
                    "Main": true,
 +
                    "RouteTableAssociationId": "rtbassoc-9EXAMPLE",
 +
                    "RouteTableId": "rtb-a1eec7de"
 +
                }
 +
            ],
 +
            "PropagatingVgws": [],
 +
            "RouteTableId": "rtb-a1eec7de",
 +
            "Routes": [
 +
                {
 +
                    "DestinationCidrBlock": "172.31.0.0/16",
 +
                    "GatewayId": "local",
 +
                    "Origin": "CreateRouteTable",
 +
                    "State": "active"
 +
                },
 +
                {
 +
                    "DestinationCidrBlock": "0.0.0.0/0",
 +
                    "GatewayId": "igw-fEXAMPLE",
 +
                    "Origin": "CreateRoute",
 +
                    "State": "active"
 +
                }
 +
            ],
 +
            "Tags": [],
 +
            "VpcId": "vpc-3EXAMPLE",
 +
            "OwnerId": "111122223333"
 +
        },
 +
        {
 +
            "Associations": [
 +
                {
 +
                    "Main": false,
 +
                    "RouteTableAssociationId": "rtbassoc-0b100c28b2EXAMPLE",
 +
                    "RouteTableId": "rtb-07a98f76e5EXAMPLE",
 +
                    "SubnetId": "subnet-0d3d002af8EXAMPLE"
 +
                }
 +
            ],
 +
            "PropagatingVgws": [],
 +
            "RouteTableId": "rtb-07a98f76e5EXAMPLE",
 +
            "Routes": [
 +
                {
 +
                    "DestinationCidrBlock": "10.0.0.0/16",
 +
                    "GatewayId": "local",
 +
                    "Origin": "CreateRouteTable",
 +
                    "State": "active"
 +
                },
 +
                {
 +
                    "DestinationCidrBlock": "0.0.0.0/0",
 +
                    "GatewayId": "igw-06cf664d80EXAMPLE",
 +
                    "Origin": "CreateRoute",
 +
                    "State": "active"
 +
                }
 +
            ],
 +
            "Tags": [],
 +
            "VpcId": "vpc-0065acced4EXAMPLE",
 +
            "OwnerId": "111122223333"
 +
        }
 +
    ]
 +
}
 +
</pre>
 +
 +
== Related ==
 +
* <code>[[netstat -rn]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{aws ec2 route}}
 
* {{aws ec2}}
 
* {{aws ec2}}
  
 
[[Category:AWS]]
 
[[Category:AWS]]

Latest revision as of 07:00, 4 July 2022

aws ec2 describe-route-tables
aws ec2 describe-route-tables | jq -r '.RouteTables[] | select(.Tags[].Value=="YOUR_TAG/PublicRouteTable") | .RouteTableId'

Official example[edit]

{
    "RouteTables": [
        {
            "Associations": [
                {
                    "Main": true,
                    "RouteTableAssociationId": "rtbassoc-0df3f54e06EXAMPLE",
                    "RouteTableId": "rtb-09ba434c1bEXAMPLE"
                }
            ],
            "PropagatingVgws": [],
            "RouteTableId": "rtb-09ba434c1bEXAMPLE",
            "Routes": [
                {
                    "DestinationCidrBlock": "10.0.0.0/16",
                    "GatewayId": "local",
                    "Origin": "CreateRouteTable",
                    "State": "active"
                },
                {
                    "DestinationCidrBlock": "0.0.0.0/0",
                    "NatGatewayId": "nat-06c018cbd8EXAMPLE",
                    "Origin": "CreateRoute",
                    "State": "blackhole"
                }
            ],
            "Tags": [],
            "VpcId": "vpc-0065acced4EXAMPLE",
            "OwnerId": "111122223333"
        },
        {
            "Associations": [
                {
                    "Main": true,
                    "RouteTableAssociationId": "rtbassoc-9EXAMPLE",
                    "RouteTableId": "rtb-a1eec7de"
                }
            ],
            "PropagatingVgws": [],
            "RouteTableId": "rtb-a1eec7de",
            "Routes": [
                {
                    "DestinationCidrBlock": "172.31.0.0/16",
                    "GatewayId": "local",
                    "Origin": "CreateRouteTable",
                    "State": "active"
                },
                {
                    "DestinationCidrBlock": "0.0.0.0/0",
                    "GatewayId": "igw-fEXAMPLE",
                    "Origin": "CreateRoute",
                    "State": "active"
                }
            ],
            "Tags": [],
            "VpcId": "vpc-3EXAMPLE",
            "OwnerId": "111122223333"
        },
        {
            "Associations": [
                {
                    "Main": false,
                    "RouteTableAssociationId": "rtbassoc-0b100c28b2EXAMPLE",
                    "RouteTableId": "rtb-07a98f76e5EXAMPLE",
                    "SubnetId": "subnet-0d3d002af8EXAMPLE"
                }
            ],
            "PropagatingVgws": [],
            "RouteTableId": "rtb-07a98f76e5EXAMPLE",
            "Routes": [
                {
                    "DestinationCidrBlock": "10.0.0.0/16",
                    "GatewayId": "local",
                    "Origin": "CreateRouteTable",
                    "State": "active"
                },
                {
                    "DestinationCidrBlock": "0.0.0.0/0",
                    "GatewayId": "igw-06cf664d80EXAMPLE",
                    "Origin": "CreateRoute",
                    "State": "active"
                }
            ],
            "Tags": [],
            "VpcId": "vpc-0065acced4EXAMPLE",
            "OwnerId": "111122223333"
        }
    ]
}

Related[edit]

See also[edit]

Advertising: