transit_gateway_routes
Creates, updates, deletes, gets or lists a transit_gateway_routes resource.
Overview
| Name | transit_gateway_routes |
| Type | Resource |
| Id | aws.ec2.transit_gateway_routes |
Fields
The following fields are returned by SELECT queries:
- search_transit_gateway_routes
| Name | Datatype | Description |
|---|---|---|
destination_cidr_block | string | The CIDR block used for destination matches. |
prefix_list_id | string | The ID of the prefix list used for destination matches. |
state | string | The state of the route. |
transit_gateway_attachments | string | The attachments. |
transit_gateway_route_table_announcement_id | string | The ID of the transit gateway route table announcement. |
type | string | The route type. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
search_transit_gateway_routes | select | TransitGatewayRouteTableId, Filter, region | MaxResults, DryRun, NextToken | Searches for routes in the specified transit gateway route table. |
create_transit_gateway_route | insert | DestinationCidrBlock, TransitGatewayRouteTableId, region | TransitGatewayAttachmentId, Blackhole, DryRun | Creates a static route for the specified transit gateway route table. |
replace_transit_gateway_route | replace | DestinationCidrBlock, TransitGatewayRouteTableId, region | TransitGatewayAttachmentId, Blackhole, DryRun | Replaces the specified route in the specified transit gateway route table. |
delete_transit_gateway_route | delete | TransitGatewayRouteTableId, DestinationCidrBlock, region | DryRun | Deletes the specified route from the specified transit gateway route table. |
export_transit_gateway_routes | exec | TransitGatewayRouteTableId, S3Bucket, region | Filter, DryRun | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
DestinationCidrBlock | string | The CIDR range for the route. This must match the CIDR for the route exactly. |
Filter | array | One 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). |
S3Bucket | string | The name of the S3 bucket. |
TransitGatewayRouteTableId | string | The ID of the route table. |
region | string | AWS region (default: us-east-1) |
Blackhole | boolean | Indicates whether traffic matching this route is to be dropped. |
DryRun | boolean | Checks 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. |
Filter | array | One 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). |
MaxResults | integer | The maximum number of routes to return. If a value is not provided, the default is 1000. |
NextToken | string | The token for the next page of results. |
TransitGatewayAttachmentId | string | The ID of the attachment. |
SELECT examples
- search_transit_gateway_routes
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
- create_transit_gateway_route
- Manifest
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
;
# Description fields are for documentation purposes
- name: transit_gateway_routes
props:
- name: DestinationCidrBlock
value: "{{ DestinationCidrBlock }}"
description: Required parameter for the transit_gateway_routes resource.
- name: TransitGatewayRouteTableId
value: "{{ TransitGatewayRouteTableId }}"
description: Required parameter for the transit_gateway_routes resource.
- name: region
value: "{{ region }}"
description: Required parameter for the transit_gateway_routes resource.
- name: TransitGatewayAttachmentId
value: "{{ TransitGatewayAttachmentId }}"
description: The ID of the attachment.
description: The ID of the attachment.
- name: Blackhole
value: {{ Blackhole }}
description: Indicates whether to drop traffic that matches this route.
description: Indicates whether to drop traffic that matches this route.
- name: DryRun
value: {{ DryRun }}
description: Checks 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.
description: Checks 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.
REPLACE examples
- replace_transit_gateway_route
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
- delete_transit_gateway_route
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
- export_transit_gateway_routes
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 }}
;