Skip to main content

transit_gateway_routes

Creates, updates, deletes, gets or lists a transit_gateway_routes resource.

Overview

Nametransit_gateway_routes
TypeResource
Idaws.ec2.transit_gateway_routes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
destination_cidr_blockstringThe CIDR block used for destination matches.
prefix_list_idstringThe ID of the prefix list used for destination matches.
statestringThe state of the route.
transit_gateway_attachmentsstringThe attachments.
transit_gateway_route_table_announcement_idstringThe ID of the transit gateway route table announcement.
typestringThe route type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
search_transit_gateway_routesselectTransitGatewayRouteTableId, Filter, regionMaxResults, DryRun, NextTokenSearches for routes in the specified transit gateway route table.
create_transit_gateway_routeinsertDestinationCidrBlock, TransitGatewayRouteTableId, regionTransitGatewayAttachmentId, Blackhole, DryRunCreates a static route for the specified transit gateway route table.
replace_transit_gateway_routereplaceDestinationCidrBlock, TransitGatewayRouteTableId, regionTransitGatewayAttachmentId, Blackhole, DryRunReplaces the specified route in the specified transit gateway route table.
delete_transit_gateway_routedeleteTransitGatewayRouteTableId, DestinationCidrBlock, regionDryRunDeletes the specified route from the specified transit gateway route table.
export_transit_gateway_routesexecTransitGatewayRouteTableId, S3Bucket, regionFilter, DryRunExports routes from the specified transit gateway route table to the specified S3 bucket. By default, all routes are exported. Alternatively, you can filter by CIDR range. The routes are saved to the specified bucket in a JSON file. For more information, see Export route tables to Amazon S3 in the Amazon Web Services Transit Gateways Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
DestinationCidrBlockstringThe CIDR range for the route. This must match the CIDR for the route exactly.
FilterarrayOne or more filters. The possible values are: attachment.transit-gateway-attachment-id- The id of the transit gateway attachment. attachment.resource-id - The resource id of the transit gateway attachment. attachment.resource-type - The attachment resource type. Valid values are vpc | vpn | direct-connect-gateway | peering | connect. prefix-list-id - The ID of the prefix list. route-search.exact-match - The exact match of the specified filter. route-search.longest-prefix-match - The longest prefix that matches the route. route-search.subnet-of-match - The routes with a subnet that match the specified CIDR filter. route-search.supernet-of-match - The routes with a CIDR that encompass the CIDR filter. For example, if you have 10.0.1.0/29 and 10.0.1.0/31 routes in your route table and you specify supernet-of-match as 10.0.1.0/30, then the result returns 10.0.1.0/29. state - The state of the route (active | blackhole). type - The type of route (propagated | static).
S3BucketstringThe name of the S3 bucket.
TransitGatewayRouteTableIdstringThe ID of the route table.
regionstringAWS region (default: us-east-1)
BlackholebooleanIndicates whether traffic matching this route is to be dropped.
DryRunbooleanChecks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
FilterarrayOne or more filters. The possible values are: attachment.transit-gateway-attachment-id - The id of the transit gateway attachment. attachment.resource-id - The resource id of the transit gateway attachment. route-search.exact-match - The exact match of the specified filter. route-search.longest-prefix-match - The longest prefix that matches the route. route-search.subnet-of-match - The routes with a subnet that match the specified CIDR filter. route-search.supernet-of-match - The routes with a CIDR that encompass the CIDR filter. For example, if you have 10.0.1.0/29 and 10.0.1.0/31 routes in your route table and you specify supernet-of-match as 10.0.1.0/30, then the result returns 10.0.1.0/29. state - The state of the route (active | blackhole). transit-gateway-route-destination-cidr-block - The CIDR range. type - The type of route (propagated | static).
MaxResultsintegerThe maximum number of routes to return. If a value is not provided, the default is 1000.
NextTokenstringThe token for the next page of results.
TransitGatewayAttachmentIdstringThe ID of the attachment.

SELECT examples

Searches for routes in the specified transit gateway route table.

SELECT
destination_cidr_block,
prefix_list_id,
state,
transit_gateway_attachments,
transit_gateway_route_table_announcement_id,
type
FROM aws.ec2.transit_gateway_routes
WHERE TransitGatewayRouteTableId = '{{ TransitGatewayRouteTableId }}' -- required
AND Filter = '{{ Filter }}' -- required
AND region = '{{ region }}' -- required
AND MaxResults = '{{ MaxResults }}'
AND DryRun = '{{ DryRun }}'
AND NextToken = '{{ NextToken }}'
;

INSERT examples

Creates a static route for the specified transit gateway route table.

INSERT INTO aws.ec2.transit_gateway_routes (
DestinationCidrBlock,
TransitGatewayRouteTableId,
region,
TransitGatewayAttachmentId,
Blackhole,
DryRun
)
SELECT
'{{ DestinationCidrBlock }}',
'{{ TransitGatewayRouteTableId }}',
'{{ region }}',
'{{ TransitGatewayAttachmentId }}',
'{{ Blackhole }}',
'{{ DryRun }}'
RETURNING
destination_cidr_block,
prefix_list_id,
state,
transit_gateway_attachments,
transit_gateway_route_table_announcement_id,
type
;

REPLACE examples

Replaces the specified route in the specified transit gateway route table.

REPLACE aws.ec2.transit_gateway_routes
SET
-- No updatable properties
WHERE
DestinationCidrBlock = '{{ DestinationCidrBlock }}' --required
AND TransitGatewayRouteTableId = '{{ TransitGatewayRouteTableId }}' --required
AND region = '{{ region }}' --required
AND TransitGatewayAttachmentId = '{{ TransitGatewayAttachmentId}}'
AND Blackhole = {{ Blackhole}}
AND DryRun = {{ DryRun}}
RETURNING
destination_cidr_block,
prefix_list_id,
state,
transit_gateway_attachments,
transit_gateway_route_table_announcement_id,
type;

DELETE examples

Deletes the specified route from the specified transit gateway route table.

DELETE FROM aws.ec2.transit_gateway_routes
WHERE TransitGatewayRouteTableId = '{{ TransitGatewayRouteTableId }}' --required
AND DestinationCidrBlock = '{{ DestinationCidrBlock }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;

Lifecycle Methods

Exports routes from the specified transit gateway route table to the specified S3 bucket. By default, all routes are exported. Alternatively, you can filter by CIDR range. The routes are saved to the specified bucket in a JSON file. For more information, see Export route tables to Amazon S3 in the Amazon Web Services Transit Gateways Guide.

EXEC aws.ec2.transit_gateway_routes.export_transit_gateway_routes
@TransitGatewayRouteTableId='{{ TransitGatewayRouteTableId }}' --required,
@S3Bucket='{{ S3Bucket }}' --required,
@region='{{ region }}' --required,
@Filter='{{ Filter }}',
@DryRun={{ DryRun }}
;