AWS Amazon EC2 Association

This page shows how to write Terraform and CloudFormation for Amazon EC2 Association and write them securely.

aws_route_table_association (Terraform)

The Association in Amazon EC2 can be configured in Terraform with the resource name aws_route_table_association. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

resource "aws_route_table_association" "tappo1-public-1b-rtbassoc-0127c825ff6654db8" {
    route_table_id = "rtb-0aa19f1b4bab76874"
    subnet_id = "subnet-07fc1cb0c3b60c9ea"

resource "aws_route_table_association" "tappo1-db-1a-rtbassoc-02b62b697b221f82e" {


Explanation in Terraform Registry

Provides a resource to create an association between a route table and a subnet or a route table and an internet gateway or virtual private gateway.

AWS::EC2::Route (CloudFormation)

The Route in EC2 can be configured in CloudFormation with the resource name AWS::EC2::Route. The following sections describe how to use the resource and its parameters.


Explanation in CloudFormation Registry

Specifies a route in a route table within a VPC.

You must specify either DestinationCidrBlock or DestinationIpv6CidrBlock, plus the ID of one of the target resources.

If you create a route that references a transit gateway in the same template where you create the transit gateway, you must declare a dependency on the transit gateway attachment. The route table cannot use the transit gateway until it has successfully attached to the VPC. Add a DependsOn Attribute in the AWS::EC2::Route resource to explicitly declare a dependency on the AWS::EC2::TransitGatewayAttachment resource.

Frequently asked questions

What is AWS Amazon EC2 Association?

AWS Amazon EC2 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 Association?

For Terraform, the tappoflw/tappo1 source code example is useful. See the Terraform Example section for further details.