Thanks for letting us know we're doing a good job!
If you've got a moment, please tell us what we did right so we can do more of it.
Associates a CIDR block with your VPC. You can only associate a single IPv6 CIDR block with your VPC. The IPv6 CIDR block size is fixed at /56.
For more information about associating CIDR blocks with your VPC and applicable restrictions, see VPC and Subnet Sizing in the Amazon Virtual Private Cloud User Guide.
To declare this entity in your AWS CloudFormation template, use the following syntax:
{ "Type" : "AWS::EC2::VPCCidrBlock", "Properties" : { "AmazonProvidedIpv6CidrBlock" :Boolean, "CidrBlock" :String, "VpcId" :String} }
Type: AWS::EC2::VPCCidrBlock Properties: AmazonProvidedIpv6CidrBlock:BooleanCidrBlock:StringVpcId:String
AmazonProvidedIpv6CidrBlockRequests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IPv6 addresses, or the size of the CIDR block.
Required: No
Type: Boolean
Update requires: Replacement
CidrBlockAn IPv4 CIDR block to associate with the VPC.
Required: No
Type: String
Update requires: Replacement
VpcIdThe ID of the VPC.
Required: Yes
Type: String
Update requires: Replacement
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the VPC CIDR block.
For more information about using the Ref function, see Ref.
The following example associates an Amazon-provided IPv6 CIDR block (with a prefix length of /56) with the TestVPCIpv6 VPC.
"Ipv6VPCCidrBlock": { "Type": "AWS::EC2::VPCCidrBlock", "Properties": { "AmazonProvidedIpv6CidrBlock": true, "VpcId": { "Ref" : "TestVPCIpv6" } } }
Ipv6VPCCidrBlock: Type: AWS::EC2::VPCCidrBlock Properties: AmazonProvidedIpv6CidrBlock: true VpcId: !Ref TestVPCIpv6
The following example associates an IPv4 CIDR block and an Amazon-provided IPv6 CIDR block with a VPC. It also outputs the list of IPv4 CIDR block association IDs and IPv6 CIDR blocks that are associated with the VPC.
{ "Resources": { "VPC": { "Type": "AWS::EC2::VPC", "Properties": { "CidrBlock": "10.0.0.0/24" } }, "VpcCidrBlock": { "Type": "AWS::EC2::VPCCidrBlock", "Properties": { "VpcId": { "Ref": "VPC" }, "CidrBlock": "192.0.0.0/24" } }, "VpcCidrBlockIpv6": { "Type": "AWS::EC2::VPCCidrBlock", "Properties": { "VpcId": { "Ref": "VPC" }, "AmazonProvidedIpv6CidrBlock": true } } }, "Outputs": { "VpcId": { "Value": { "Ref": "VPC" } }, "PrimaryCidrBlock": { "Value": { "Fn::GetAtt": [ "VPC", "CidrBlock" ] } }, "Ipv6CidrBlock": { "Value": { "Fn::Select": [ 0, { "Fn::GetAtt": [ "VPC", "Ipv6CidrBlocks" ] } ] } }, "CidrBlockAssociation": { "Value": { "Fn::Select": [ 0, { "Fn::GetAtt": [ "VPC", "CidrBlockAssociations" ] } ] } } } }
Resources: VPC: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0/24 VpcCidrBlock: Type: AWS::EC2::VPCCidrBlock Properties: VpcId: !Ref VPC CidrBlock: 192.0.0.0/24 VpcCidrBlockIpv6: Type: AWS::EC2::VPCCidrBlock Properties: VpcId: !Ref VPC AmazonProvidedIpv6CidrBlock: true Outputs: VpcId: Value: !Ref VPC PrimaryCidrBlock: Value: !GetAtt VPC.CidrBlock Ipv6CidrBlock: Value: !Select [ 0, !GetAtt VPC.Ipv6CidrBlocks ] CidrBlockAssociation: Value: !Select [ 0, !GetAtt VPC.CidrBlockAssociations ]