AWS::EC2::SubnetCidrBlock - AWS CloudFormation

AWS::EC2::SubnetCidrBlock

Associates a CIDR block with your subnet. You can only associate a single IPv6 CIDR block with your subnet. An IPv6 CIDR block must have a prefix length of /64.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::EC2::SubnetCidrBlock", "Properties" : { "Ipv6CidrBlock" : String, "SubnetId" : String } }

YAML

Type: AWS::EC2::SubnetCidrBlock Properties: Ipv6CidrBlock: String SubnetId: String

Properties

Ipv6CidrBlock

The IPv6 network range for the subnet, in CIDR notation. The subnet size must use a /64 prefix length.

Required: Yes

Type: String

Update requires: Replacement

SubnetId

The ID of the subnet.

Required: Yes

Type: String

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the subnet CIDR block.

For more information about using the Ref function, see Ref.

Examples

Subnet CIDR Block Association

The following example associates an IPv6 CIDR block by using the Ref function to specify the IPv6 of the Ipv6SubnetCidrBlock resource (with a prefix length of /64) with the Ipv6TestSubnet subnet.

JSON

"Ipv6TestSubnetCidrBlock": { "Type": "AWS::EC2::SubnetCidrBlock", "Properties": { "Ipv6CidrBlock": { "Ref" : "Ipv6SubnetCidrBlock" }, "SubnetId": { "Ref" : "Ipv6TestSubnet" } } }

YAML

Ipv6TestSubnetCidrBlock: Type: AWS::EC2::SubnetCidrBlock Properties: Ipv6CidrBlock: !Ref Ipv6SubnetCidrBlock SubnetId: !Ref Ipv6TestSubnet