In addition to the standard route table, which is created when creating the transit gateway, you can also create additional route tables. Allows you to link a specific attachment to a specific route board. Attachments can extend their routes to one or more route tables. You can also add static routes to routing tables.
To find out if your transit gateway is connected to the default routing table, use the following command.
In the next output, DefaultRouteTableAssociation is set to a value that indicates that the default route table is linked to this transit gateway.
AssociationDefaultRouteTableId and PropagationDefaultRouteTableId have the same tgw-rtb values, indicating that the default routing table is used for both mapping and distribution.
$ TGW_ID=tgw-111122223333444
$ aws ec2 describe-transit-gateways –transit-gateway-ids ${TGW_ID}
Passage bridges. Passage bridges.
TransitGatewayId: tgw-11112222333344444,
…]
Options : {\an5}AmazonSideAsn. {\an5}AmazonSideAsn. 64512,
AutoAcceptSharedAttachments : Disable,
DefaultRouteTableAssociation : Enable,
AssociationDefaultRouteTableId: tgw-rtb-aaaaaaaaaabbccccccdddee,
DefaultRouteTablePropagation Enable,
PropagationDefaultRouteTableId: tgw-rtb-aaaaaaaaabbccccccccdddee,
…
]
}
If you are new to the AWS transit portal, read this section to understand how to manage both the transit portal and its attachments: 24 AWS Transit Gateway and CLI Attachment Control examples
1. Creation of a transit gateway route table with default values for
When creating a custom routing table for a transit gateway, you must specify for which transit gateway you are creating the routing table.
In the following example, a new TGW route table is created.
TGW_ID=tgw-11112222333344444
aws ec2 created-transit-gateway route table –transit-gateway-id ${TGW_ID}
The routing table we created above has a default mapping and progression set to false. As you have seen in the result below, the association and distribution are set to false by default for this new custom routing table.
{
TransitGatewayRouteTable.] {
TransitGatewayRouteTableId: tgw-rtb-111122223344455,
TransitGatewayId: tgw-1111222233334444,
Status: pending,
DefaultAssociationRouteTable: false,
DefaultPropagationRouteTable: false,
CreationTime : 2020-10-03T19:58:33+00:00
}
}
2. Creation of a transit gateway route table withbeacons
When creating the TGW route table, you can add tags using the tag specifications as shown below. In this example, the label name DevTGWForOnPrem is assigned.
TGW_ID=tgw-11112222333344444
aws ec2 create-transit-gateway table
–transit-gateway-id ${TGW_ID}
–tag specifications ResourceType=transit-gateway table,Tags=[{Key=Name,Value=DevTGWForOnPrem}]].
The results of this team will also reflect the benchmarks provided by us.
TransitGatewayRouteTableId: tgw-rtb-00011122233344455,TransitGatewayId: tgw-111122223344444,Status: pending,DefaultAssociationRouteTable: false,DefaultPropagationRouteTable: false,CreationTime : 2020-10-03T20:06:25+00:00,
Keywords :
[ Key
] Name, value
: DevTGWForOnPrem}]}}}
3. Show all Transit Gateway Route Tables
The following command displays all route tables of the transit gateway.
As you may have noticed in the following output, it shows the default routing table we created and the custom routing table.
$ Australian attribute ec2 Passage bridge route tables
TransitGatewayRouteTableId: tgw-rtb-11112222333344455,TransitGatewayId: tgw-1111222233334444,Status: available,DefaultAssociationRouteTable: incorrect,DefaultPropagationRouteTable: incorrect,CreationTime : 2020-10-03T19:58:33+00:00,
Keywords : []},{TransitGatewayRouteTableId: tgw-rtb-00011122233344455,TransitGatewayId: tgw-1111222233334444,Status: pending,DefaultAssociationRouteTable: false,CreationTime: false : 2020-10-03T20:06:25+00:00,
Keywords :
[ Key
] Name, value
: DevTGWForOnPrem
}
]
}
]
}
You can also view the details of a specific route by passing the route ID, as shown below.
TGW_RT_ID=tgw-rtb-00011122233344455
aws ec2 description-transit-gateway route tables
–transit-gateway route tables-ids ${TGW_RT_ID}
4. Clearance of the transit bridge route Table
To remove the route table from the transit portal, use the following command and enter the route table ID
TGW_RT_ID=tgw-rtb-00011122233344455
aws ec2 delete-transit-gateway routing table
–transit-gateway routing table-id ${TGW_RT_ID}
When the above command is given, the status is displayed as deleted. After a few seconds, this route table is no longer displayed in the route tables.
{
TransitGatewayRouteTable.] {
TransitGatewayRouteTableId: tgw-rtb-0001112222233344455,
TransitGatewayId: tgw-111122223344444,
Status : Clear,
DefaultAssociationRouteTable : False,
DefaultPropagationRouteTable : Wrong,
CreationTime: 2020-10-03T20:06:25+00:00
}
}
If you do not delete the commands first, you will receive the following error message: An error (IncorrectState) occurred when calling the DeleteTransitGatewayRouteTable operation: tgw-rtb-00011122233344455 has corresponding attachments.
As explained in one of the following examples, you must ensure that all attachments are separated as they were before the routing table was removed.
5. Table of gateways related to Annex
After creating the route table, you can use the following command to link an existing transit gateway to the route table.
TGW_RT_ID=tgw-rtb-00011122233344455
TGW_ATTACHMENT_ID=tgw-attach-00011122233344aaa
— Transit Gateway Port ID ${TGW_RT_ID}
— Transit Gateway Port ID ${TGW_ATTACHMENT_ID}.
When you exit the above command, the report is displayed as associative. In a few seconds, the gateway attribute indicates the status as assigned.
{
Association :
TransitGatewayRouteTableId: tgw-rtb-00011122233344455,
TransitGatewayAttachmentId: tgw-attach-00011122233344aaa,
ResourceId: vpc-111222344455566,
ResourceType: vpc,
Status: associative
}
.}.
You must first disconnect an existing routing table from an attachment before you can attach a new one. If this is not the case, you will receive the following error message:
An error occurred when calling up the AssociateTransitGatewayRouteTable process (Resource.Al-Associated): The Transit-Gateway connection tgw-attach-00011122233344aaaa is already linked to the routing table.
6. Delete the route table for the transit gateway from Appendix.
When describing the TransitGateway attachments, the output contains a link section to TransitGatewayRouteTableId, indicating that this link is linked to the routing table, as shown below.
$ TGW_ATTACHMENT_ID=tgw-attach-00011122233344aaa$ aws ec2 describe-transit-gateway-attachment-guide ${TGW_ATTACHMENT_ID}.
{
TransitGatewayAttachmentId: tgw-attach-00011122233344aaa,
TransitGatewayId: tgw-111222333444aaabb,
…
..
Association : {TransitGatewayRouteTableId: tgw-rtb-00011122233344455,Status: bijbehorend},…}}}}
The following command separates this routing table from the attachment.
TGW_RT_ID=tgw-rtb-00011122233344455
TGW_ATTACHMENT_ID=tgw-attach-00011122233344aaa
aws ec2 dissociated transit gateway routinetable
–Transit gateway routinetable id ${TGW_RT_ID}
–Transit gateway connection id ${TGW_ATTACHMENT_ID}
At the output, the status is displayed as disconnection.
{
Association : {
TransitGatewayRouteTableId: tgw-rtb-000111223344455,
TransitGatewayAttachmentId: tgw-attach-00011122233344aaa,
ResourceId: vpc-1112234455566,
ResourceType: vpc,
Status : Dissociation
}
}.
Once the route map is divided as shown below, you will not see the Association of TransitGatewayRouteTableId section in the exit.
$ aws ec2 describe-transit-gateway-attachment
–transit-gateway-attachment guide ${TGW_ATTACHMENT_ID}
{
TransitGateway-Attachments :
{
TransitGatewayAttachmentId: tgw-attach-00011122233344aaaaa,
TransitGatewayId: tgw-11122233344aaaaabb,
TransitGatewayOwnerId : 11111111,
ResourceOwnerId : 111111111111,
ResourceType: vpc,
ResourceId: vpc-11122233344455566,
Status : Available,
Creation Time : 2020-10-03T20:35:59+00:00,
Keywords :
[ Key
] Name, value
: LernenTGWAttachmentPublic
}
]
}
]
}
7. Directions
To display the distribution of the route table for a specific route table, select the following command.
TGW_RT_ID=tgw-rtb-00011122233344455
aws ec2 get-transit-gateway route-table-id ${TGW_RT_ID}
The following output shows the distribution of the routing table for the Mail Order Transit Gateway Annex.
TransitGatewayRoutePropagationTable].
{
TransitGatewayAttachmentId: tgw-attach-00011122233344aaa,
ResourceId: vpc-11122233344455566,
ResourceType: vpc,
Status: enabled
}
]
}.
If there are no routes in the route table, you will not see any output records, as shown below
TGW_RT_ID=tgw-rtb-00011122233344455
aws ec2 get-transit-gateway route-table-propagations
–transit-gateway route-table-id ${TGW_RT_ID}
{
TransitGatewayRouteTable-propagations : []
}
8. Deactivation of route marking in Table
To disable the distribution of the route table for a specific route table, follow this command. The common route is therefore removed from the Annex to the itinerary table.
If you disable the route-based distribution, you must also specify the specific installation for which you want to disable the distribution, as shown below.
TGW_RT_ID=tgw-rtb-00011122233344455
TGW_ATTACHMENT_ID=tgw-attach-00011122233344aaa
aws ec2 disable-gateway route table-propagation
–gateway route table-id ${TGW_RT_ID}
–gateway gateway-attachment-id ${TGW_ATTACHMENT_ID}
The following output means that the route table distribution for this connected mail order company is deactivated.
{
Propaganda.] {
TransitGatewayAttachmentId: tgw-attach-00011122233344aaaaa,
ResourceId: vpc-111223344455566,
ResourceType: vpc,
TransitGatewayRouteTableId: tgw-rtb-00011122233344455,
Status : Disabled
}
}
9. Track-laying authorisation Table
When recording the route distribution, you must also specify the specific installation for which you want to enable the distribution, as shown below. The idea is to add a route from the route table to this appendix.
TGW_RT_ID=tgw-rtb-00011122233344455
TGW_ATTACHMENT_ID=tgw-attach-00011122233344aaa
aws ec2 enable-transit-gateway-route-table-propagation
–transit-gateway-route-table-id ${TGW_RT_ID}
–transit-gateway-attachment-id ${TGW_ATTACHMENT_ID}
The following result shows that route table distribution has been activated for this mail order system.
{
Propaganda.] {
TransitGatewayAttachmentId: tgw-attach-00011122233344aaaaa,
ResourceId: vpc-111223344455566,
ResourceType: vpc,
TransitGatewayRouteTableId: tgw-rtb-00011122233344455,
Status : The
}
}
If you have not deactivated the deployment of an existing RT, you will receive the following error message:
An error has occurred when calling the EnableTransitGatewayRouteTablePropagation (TransitGatewayRouteTablePropagation.Duplicate) function: The distribution of the annex tgw-attach-00011122233344aaa already exists in the transit gateway route table tgw-rtb-000111223344455.
10. Create a static route for the Transit Gateway Demand Route Table.
For this appendix, you can create a static route to a specific CIDR unit, as shown below
The same command can also be used to create a black hole to reset the traffic corresponding to this CIDR block.
CIDR=192.168.0.0/32
TGW_RT_ID=tgw-rtb-00011122233344455
TGW_ATTACHMENT_ID=tgw-attach-000111223344aaa.
aws ec2 creat-transit-gateway routing-cidr block ${CIDR}-transit-gateway routing table-id ${TGW_RT_ID}-transit-gateway input ${TGW_ATTACHMENT_ID}}.
The next output shows the static route we just added, if it is active.
{A
Route.] {destination cidr block.} 192.168.0.0/32,
Transit Gateway Applications :
{
ResourceId: vpc-1112222233344455566,
TransitGatewayAttachmentId: tgw-attach-00011122233344aaa,
ResourceType: vpc
}
],
Type: static,
Status: active
}
}.
If you do not specify an asset ID for the transit gateway in the above command, you will receive the following error message:
An error has occurred while calling the CreateTransitGatewayRoute (MissingParameter) function: The application must contain exactly one of the following information: Blackhole, TransitGatewayAttachmentId or VpnConnectionId.
11. Distance from static route to pass bridge Table
To remove a previously added static route, use the following command and specify a CIDR block and a route table identifier
CIDR=192.168.0.0/32
TGW_RT_ID=tgw-rtb-00011122233344455
aws ec2 delete-transit-gateway-route
–transit-gateway-route table-id ${TGW_RT_ID}
– Allocation block-cider block ${CIDR}
The next output shows the cleared status, which means that the static route has been successfully cleared from the routing table.
{A
Route.] {destination cidr block.} 192.168.0.0/32,
Transit Gateway Applications : {ResourceId: vpc-111222222233344455566,TransitGatewayAttachmentId: tgw-attach-0001112222233344aaa,ResourceType: vpc}],Typ: statisch,Status: Deleted.}
If no route exists, you will receive this error message:
An error has occurred when calling the DeleteTransitGatewayRoute (InvalidRoute.NotFound) function: The table of passage bridge routes tgw-rtb-00011122233344455 does not show route 192.168.0/32.
12. Exporting route tables to an S3 container in JSONformat
If you have multiple static routes in your routing table, you can export them to a JSON file and save them to an S3 bucket. This can be done as a way to save static roads.
TGW_RT_ID=tgw-rtb-00011122233344455
S3_BUCKET=tgs-tgw-backup
aws ec2 export-transit-route
–transit-route-id ${TGW_RT_ID}
–s3-bucket ${S3_BUCKET}
The output shows the complete folder structure and the name of the export file created with the above command under this S3-container.
{
S3Location: s3://tgs-tgw-backup/VPCTransitGateway/TransitGatewayRouteTables/111111111111_us-east-1_tgw-rtb-00011122233344455_2020-10-03T21-12-06.json
}
Below is an example of the JSON content of the exported files mentioned above.
{\an5}Routes: {destinationCidrBlock: 10.0.0.0/20,transitGatewayAttachments: {resourceId: vpc-111223344455566,transitGatewayAttachmentId: tgw-attach-00011122233344aaa,resourceType: vpc}],type: common,status: active}].
If you like this article, you can also…
Related Tags: