AWS Fundamentals Logo
AWS Fundamentals
AWS::EC2::SubnetRouteTableAssociation

EC2 SubnetRouteTableAssociation

Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. A route table can be associated with multiple subnets. To create a route table, see [AWS::EC2::RouteTable](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-routetable.html).

Properties

2 configurable properties. 2 required. Click a row to see details.

Filter:
PropertyTypeFlags
RouteTableId
string
RequiredCreate-only
SubnetId
string
RequiredCreate-only

Return Values

Values returned after the resource is created. Access these with Fn::GetAtt.

AttributeTypeDescription
Idstring-

Sample CloudFormation Template

A minimal template with required properties and common optional ones.

template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::EC2::SubnetRouteTableAssociation

Resources:
  MyResource:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: "my-routetableid"
      SubnetId: "my-subnetid"

Required IAM Permissions

Permissions CloudFormation needs in your IAM role to manage this resource.

read

ec2:DescribeRouteTables

create

ec2:AssociateRouteTableec2:ReplaceRouteTableAssociationec2:DescribeSubnetsec2:DescribeRouteTables

list

ec2:DescribeRouteTables

delete

ec2:DisassociateRouteTableec2:DescribeSubnetsec2:DescribeRouteTables

Get the EC2 Cheat Sheet

Everything you need to know about EC2 on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

ServiceEC2
Properties3
Required2
TaggingNot supported
Primary IDId

Supported Operations

ReadCreateListDelete

Immutable After Creation

These properties cannot be changed after the resource is created. Updating them triggers a replacement.

SubnetIdRouteTableId

External Links