Carina

Resource

awscc.ec2.SubnetRouteTableAssociation

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.RouteTable {
  vpc_id = vpc.vpc_id
}

awscc.ec2.SubnetRouteTableAssociation {
  subnet_id      = subnet.subnet_id
  route_table_id = rt.route_table_id
}

Argument Reference

route_table_id

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

subnet_id

The ID of the subnet.

Attribute Reference

id