AWS Amazon EC2 Transit Gateway Route Table Association
This page shows how to write Terraform and CloudFormation for Amazon EC2 Transit Gateway Route Table Association and write them securely.
aws_ec2_transit_gateway_route_table_association_table_association (Terraform)
The Transit Gateway Route Table Association in Amazon EC2 can be configured in Terraform with the resource name aws_ec2_transit_gateway_route_table_association_table_association
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
The following arguments are supported:
transit_gateway_attachment_id
- (Required) Identifier of EC2 Transit Gateway Attachment.transit_gateway_route_table_id
- (Required) Identifier of EC2 Transit Gateway Route Table.
In addition to all arguments above, the following attributes are exported:
id
- EC2 Transit Gateway Route Table identifier combined with EC2 Transit Gateway Attachment identifierresource_id
- Identifier of the resourceresource_type
- Type of the resource
Explanation in Terraform Registry
Manages an EC2 Transit Gateway Route Table association.
Tips: Best Practices for The Other AWS Amazon EC2 Resources
In addition to the aws_default_vpc, AWS Amazon EC2 has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_default_vpc
Ensure to avoid using default VPC
It is better to define the own VPC and use it.
aws_network_acl_rule
Ensure your network ACL rule blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
aws_ebs_volume
Ensure to use a customer-managed key for EBS volume encryption
It is better to use a customer-managed key for EBS volume encryption. It can be gain more control over the encryption by using customer-managed keys (CMK).
aws_instance
Ensure to avoid storing AWS access keys in user data
It is better to avoid storing AWS access keys in user data. `aws_iam_instance_profile` could be used instead.
aws_security_group
Ensure your security group blocks unwanted inbound traffic
It is better to block unwanted inbound traffic.
AWS::EC2::TransitGatewayRouteTableAssociation (CloudFormation)
The TransitGatewayRouteTableAssociation in EC2 can be configured in CloudFormation with the resource name AWS::EC2::TransitGatewayRouteTableAssociation
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: "AWS::EC2::TransitGatewayRouteTableAssociation"
Properties:
TransitGatewayAttachmentId: !Ref AttachAOCTANK
TransitGatewayRouteTableId: !Ref RTRed
PropagateAOCTANKRed:
Type: "AWS::EC2::TransitGatewayRouteTableAssociation"
Properties:
TransitGatewayAttachmentId: !Ref TransitGatewayAttachmentSeoulVPCHQ
TransitGatewayRouteTableId: !Ref TransitGatewayRouteTableNorthToSouth
TransitGatewayRouteTablePropagationSeoulVPCHQNorthToSouth:
Type: "AWS::EC2::TransitGatewayRouteTableAssociation"
Properties:
TransitGatewayAttachmentId: !Ref TransitGatewayAttachmentSeoulVPCHQ
TransitGatewayRouteTableId: !Ref TransitGatewayRouteTableNorthToSouth
TransitGatewayRouteTablePropagationSeoulVPCHQNorthToSouth:
Type: AWS::EC2::TransitGatewayRouteTableAssociation
Properties:
TransitGatewayAttachmentId: !Ref pFirewallVpcTgwAttachId
TransitGatewayRouteTableId: !Ref pFirewallRtId
# Future: Causes 'Internal Failure' - Can be done using CLI / Custom Resource
Type: "AWS::EC2::TransitGatewayRouteTableAssociation"
Properties:
TransitGatewayRouteTableId: !Ref DevRouteTable
TransitGatewayAttachmentId: !Ref VPC64Attachment
VPC65Association:
"Type" : "AWS::EC2::TransitGatewayRouteTableAssociation",
"Properties" : {
"TransitGatewayAttachmentId" : { "Ref" : "tgwattachment" },
"TransitGatewayRouteTableId" : { "Ref" : "tgwroutetable" }
}
},
"AWS::EC2::TransitGatewayRouteTableAssociation": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html",
"Properties": {
"TransitGatewayRouteTableId": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid",
"AWS::EC2::TransitGatewayRouteTableAssociation": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html",
"Properties": {
"TransitGatewayRouteTableId": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid",
"AWS::EC2::TransitGatewayRouteTableAssociation": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html",
"Properties": {
"TransitGatewayRouteTableId": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid",
"AWS::EC2::TransitGatewayRouteTableAssociation": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html",
"Properties": {
"TransitGatewayRouteTableId": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid",
Parameters
-
TransitGatewayRouteTableId
required - String -
TransitGatewayAttachmentId
required - String
Explanation in CloudFormation Registry
Associates the specified attachment with the specified transit gateway route table. You can associate one route table with an attachment.
Before you can update the route table associated with an attachment, you must disassociate the transit gateway route table that is currently associated with the attachment. First update the stack to remove the associated transit gateway route table, and then update the stack with the ID of the new transit gateway route table to associate.
Frequently asked questions
What is AWS Amazon EC2 Transit Gateway Route Table Association?
AWS Amazon EC2 Transit Gateway Route Table Association is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon EC2 Transit Gateway Route Table Association?
For CloudFormation, the whchoi98/TGW_CF, whchoi98/buildernet and whchoi98/tgw source code examples are useful. See the CloudFormation Example section for further details.