Document
AWS::EC2::VPC

AWS::EC2::VPC

aws::ec2::vpcSpecifies a virtual private cloud (VPC).To add an IPv6 CIDR block to the VPC, see aws::ec2::vpcCidrBlock.For more information, see Virtua

Related articles

Rust with Visual Studio Code Tips & Tricks to Play Rise of Kingdoms on LDCloud Dragon In The Clouds Hot Sauce Review VPN o que é e por que você precisa de uma em 2024 Satellite Images

aws::ec2::vpc

Specifies a virtual private cloud (VPC).

To add an IPv6 CIDR block to the VPC, see aws::ec2::vpcCidrBlock.

For more information, see Virtual private clouds (VPC)
in the Amazon VPC User Guide.

Syntax

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

property

CidrBlock

The IPv4 network range for the VPC, in CIDR notation. For example,
10.0.0.0/16. We modify the specified CIDR block to its canonical form; for example, if you specify 100.68.0.18/18, we modify it to 100.68.0.0/18.

You must specify eitherCidrBlock orIpv4IpamPoolId.

require: Conditional

type: string

Update is requires require: replacement

enablednshostname

Indicates whether the instances launched in the VPC get DNS hostnames. If enabled,
instances in the VPC get DNS hostnames; otherwise, they do not. Disabled by default for
nondefault VPCs. For more information, see DNS attributes in your
VPC.

You can only enable DNS hostnames if you’ve enabled DNS support.

require: No

type: Boolean

Update is requires require: No interruption

EnableDnsSupport

Indicates whether the DNS resolution is supported for the VPC. If enabled, queries to
the Amazon provided DNS server at the 169.254.169.253 IP address, orthe reserved IP
address at the base of the VPC network range “plus two” succeed. If disabled, the Amazon
provided DNS service in the VPC that resolves public DNS hostnames to IP addresses is not
enabled. Enabled by default. For more information, see DNS attributes in your VPC.

require: No

type: Boolean

Update is requires require: No interruption

instancetenancy

The allowed tenancy of instances launched into the VPC.

  • default: An instance launched into the VPC runs on shared hardware
    by default, unless you explicitly specify a different tenancy during instance
    launch.

  • dedicate: An instance launched into the VPC runs on dedicate
    hardware by default, unless you explicitly specify a tenancy of host
    during instance launch. You cannot specify a tenancy of default during
    instance launch.

Updating instancetenancy require no replacement only if you are update
its value fromdedicate to default. update
instancetenancy from default to dedicate
requires replacement.

require: No

type: string

Allowed values: default | dedicate | host

Update is requires require: Some interruptions

Ipv4IpamPoolId

The ID of an IPv4 IPAM pool you want to use for allocating this VPC’s CIDR. For more information, see
What is IPAM? in the Amazon VPC IPAM User Guide.

You must specify eitherCidrBlock orIpv4IpamPoolId.

require: Conditional

type: string

Update is requires require: replacement

Ipv4NetmaskLength

The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see What is IPAM? in the Amazon VPC IPAM User Guide.

require: No

type: Integer

Update is requires require: replacement

Tags

The tags for the VPC.

require: No

type: Array of Tag

Update is requires require: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref return the ID of the vpc .

For more information about using theRef function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using theFn::GetAtt intrinsic function, see Fn::GetAtt.

CidrBlock

The primary ipv4 CIDR block for the vpc . For example , 10.0.0.0/16 .

CidrBlockAssociations

The association IDs of the IPv4 CIDR blocks for the VPC. For example,
[ vpc-cidr-assoc-0280ab6b ].

DefaultNetworkAcl

The ID of the default network ACL for the vpc . For example , acl-814dafe3 .

DefaultSecurityGroup

The ID of the default security group for the vpc . For example , sg – b178e0d3 .

Ipv6CidrBlocks

The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].

VpcId

The ID of the vpc .

Examples

create a vpc with an IPv4 CIDR block

The following example specifies a VPC with an IPv4 address.

JSON

{
    " resource " :{
       "myVPC" : {
           "type" : "aws::ec2::vpc",
           "property" : {
               "CidrBlock" : "10.0.0.0/16",
               "EnableDnsSupport" : "true",
               "enablednshostname" : "true",
               "Tags" : [ 
                   {"Key" : "stack", "Value" : "production"} 
               ]
           }
       }
   }
}

YAML

Resources:
  myVPC:
    type: aws::ec2::vpc
    property:
      CidrBlock: 10.0.0.0/16
      EnableDnsSupport: 'true'
      enablednshostname: 'true'
      Tags:
       - Key: stack
         Value: production

create a vpc with an IPv4 CIDR block and an IPv6 CIDR block

The following example specifies a VPC with an IPv4 address range and an IPv6 address range.

JSON

{
    " resource " :{
       "myVPC" : {
           "type" : "aws::ec2::vpc",
           "property" : {
               "CidrBlock" : "10.0.0.0/16",
               "EnableDnsSupport" : "true",
               "enablednshostname" : "true",
               "Tags" : [ 
                   {"Key" : "stack", "Value" : "production"} 
               ]
           }
       },
       "ipv6CidrBlock": {
           "type": "aws::ec2::vpcCidrBlock",
           "property": {
                "VpcId": {
                     " ref " : " myVPC " 
                 } , 
                 " amazonprovidedipv6cidrblock " : true 
             } 
        } 
    } 
 }

YAML

Resources:
  myVPC:
    type: aws::ec2::vpc
    property:
      CidrBlock: 10.0.0.0/16
      EnableDnsSupport: 'true'
      enablednshostname: 'true'
      Tags:
       - Key: stack
         Value: production
  ipv6CidrBlock:
    type: aws::ec2::vpcCidrBlock
    property:
      VpcId: !Ref myVPC
      AmazonProvidedIpv6CidrBlock: true

See also