Skip to content

awscc.ec2.subnet_route_table_association

CloudFormation Type: AWS::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.

Example

let vpc = awscc.ec2.vpc {
cidr_block = '10.0.0.0/16'
enable_dns_support = true
enable_dns_hostnames = true
}
let subnet = awscc.ec2.subnet {
vpc_id = vpc.vpc_id
cidr_block = '10.0.1.0/24'
availability_zone = 'ap-northeast-1a'
}
let rt = awscc.ec2.route_table {
vpc_id = vpc.vpc_id
}
awscc.ec2.subnet_route_table_association {
subnet_id = subnet.subnet_id
route_table_id = rt.route_table_id
}

Argument Reference

route_table_id

  • Type: RouteTableId
  • Required: Yes
  • Create-only: Yes

The ID of the route table. The physical ID changes when the route table ID is changed.

subnet_id

  • Type: SubnetId
  • Required: Yes
  • Create-only: Yes

The ID of the subnet.

Attribute Reference

id

  • Type: SubnetRouteTableAssociationId