Difference between revisions of "Aws ec2 describe-route-tables"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
+ | * https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-route-tables.html | ||
[[aws ec2]] describe-[[route]]-tables | [[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 == |
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]
aws ec2 [ create-route | describe-route-tables ]
- AWS EC2, AWS::EC2,
aws ec2
[describe-instances | describe-instance-status
|run-instances | terminate-instances | stop-instances
|tags
|describe-vpcs
|describe-addresses
|describe-availability-zones
|describe-subnets
|import-key-pair
|create-key-pair
|create-vpc
|create-internet-gateway
|modify-instance-attribute | ec2-instance-connect | get-console-output
]
Advertising: