1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. ec2
  5. Vpc

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

aws-native.ec2.Vpc

Explore with Pulumi AI

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

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.

Create Vpc Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Vpc(name: string, args?: VpcArgs, opts?: CustomResourceOptions);
@overload
def Vpc(resource_name: str,
        args: Optional[VpcArgs] = None,
        opts: Optional[ResourceOptions] = None)

@overload
def Vpc(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        cidr_block: Optional[str] = None,
        enable_dns_hostnames: Optional[bool] = None,
        enable_dns_support: Optional[bool] = None,
        instance_tenancy: Optional[str] = None,
        ipv4_ipam_pool_id: Optional[str] = None,
        ipv4_netmask_length: Optional[int] = None,
        tags: Optional[Sequence[_root_inputs.TagArgs]] = None)
func NewVpc(ctx *Context, name string, args *VpcArgs, opts ...ResourceOption) (*Vpc, error)
public Vpc(string name, VpcArgs? args = null, CustomResourceOptions? opts = null)
public Vpc(String name, VpcArgs args)
public Vpc(String name, VpcArgs args, CustomResourceOptions options)
type: aws-native:ec2:Vpc
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args VpcArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args VpcArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args VpcArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args VpcArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VpcArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Vpc Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Vpc resource accepts the following input properties:

CidrBlock string
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 or Ipv4IpamPoolId.
EnableDnsHostnames bool
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.
EnableDnsSupport bool
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, or the 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.
InstanceTenancy string

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

Ipv4IpamPoolId string
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 or Ipv4IpamPoolId.
Ipv4NetmaskLength int
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.
Tags List<Pulumi.AwsNative.Inputs.Tag>
The tags for the VPC.
CidrBlock string
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 or Ipv4IpamPoolId.
EnableDnsHostnames bool
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.
EnableDnsSupport bool
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, or the 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.
InstanceTenancy string

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

Ipv4IpamPoolId string
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 or Ipv4IpamPoolId.
Ipv4NetmaskLength int
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.
Tags TagArgs
The tags for the VPC.
cidrBlock String
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 or Ipv4IpamPoolId.
enableDnsHostnames Boolean
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.
enableDnsSupport Boolean
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, or the 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.
instanceTenancy String

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

ipv4IpamPoolId String
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 or Ipv4IpamPoolId.
ipv4NetmaskLength Integer
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.
tags List<Tag>
The tags for the VPC.
cidrBlock string
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 or Ipv4IpamPoolId.
enableDnsHostnames boolean
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.
enableDnsSupport boolean
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, or the 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.
instanceTenancy string

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

ipv4IpamPoolId string
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 or Ipv4IpamPoolId.
ipv4NetmaskLength number
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.
tags Tag[]
The tags for the VPC.
cidr_block str
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 or Ipv4IpamPoolId.
enable_dns_hostnames bool
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.
enable_dns_support bool
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, or the 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.
instance_tenancy str

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

ipv4_ipam_pool_id str
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 or Ipv4IpamPoolId.
ipv4_netmask_length int
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.
tags Sequence[TagArgs]
The tags for the VPC.
cidrBlock String
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 or Ipv4IpamPoolId.
enableDnsHostnames Boolean
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.
enableDnsSupport Boolean
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, or the 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.
instanceTenancy String

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.
  • dedicated: An instance launched into the VPC runs on dedicated 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 requires no replacement only if you are updating its value from dedicated to default. Updating InstanceTenancy from default to dedicated requires replacement.

ipv4IpamPoolId String
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 or Ipv4IpamPoolId.
ipv4NetmaskLength Number
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.
tags List<Property Map>
The tags for the VPC.

Outputs

All input properties are implicitly available as output properties. Additionally, the Vpc resource produces the following output properties:

CidrBlockAssociations List<string>
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
DefaultNetworkAcl string
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
DefaultSecurityGroup string
The ID of the default security group for the VPC. For example, sg-b178e0d3.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlocks List<string>
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
VpcId string
The ID of the VPC.
CidrBlockAssociations []string
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
DefaultNetworkAcl string
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
DefaultSecurityGroup string
The ID of the default security group for the VPC. For example, sg-b178e0d3.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlocks []string
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
VpcId string
The ID of the VPC.
cidrBlockAssociations List<String>
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
defaultNetworkAcl String
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
defaultSecurityGroup String
The ID of the default security group for the VPC. For example, sg-b178e0d3.
id String
The provider-assigned unique ID for this managed resource.
ipv6CidrBlocks List<String>
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
vpcId String
The ID of the VPC.
cidrBlockAssociations string[]
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
defaultNetworkAcl string
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
defaultSecurityGroup string
The ID of the default security group for the VPC. For example, sg-b178e0d3.
id string
The provider-assigned unique ID for this managed resource.
ipv6CidrBlocks string[]
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
vpcId string
The ID of the VPC.
cidr_block_associations Sequence[str]
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
default_network_acl str
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
default_security_group str
The ID of the default security group for the VPC. For example, sg-b178e0d3.
id str
The provider-assigned unique ID for this managed resource.
ipv6_cidr_blocks Sequence[str]
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
vpc_id str
The ID of the VPC.
cidrBlockAssociations List<String>
The association IDs of the IPv4 CIDR blocks for the VPC. For example, [ vpc-cidr-assoc-0280ab6b ].
defaultNetworkAcl String
The ID of the default network ACL for the VPC. For example, acl-814dafe3.
defaultSecurityGroup String
The ID of the default security group for the VPC. For example, sg-b178e0d3.
id String
The provider-assigned unique ID for this managed resource.
ipv6CidrBlocks List<String>
The IPv6 CIDR blocks for the VPC. For example, [ 2001:db8:1234:1a00::/56 ].
vpcId String
The ID of the VPC.

Supporting Types

Tag
, TagArgs

Key This property is required. string
The key name of the tag
Value This property is required. string
The value of the tag
Key This property is required. string
The key name of the tag
Value This property is required. string
The value of the tag
key This property is required. String
The key name of the tag
value This property is required. String
The value of the tag
key This property is required. string
The key name of the tag
value This property is required. string
The value of the tag
key This property is required. str
The key name of the tag
value This property is required. str
The value of the tag
key This property is required. String
The key name of the tag
value This property is required. String
The value of the tag

Package Details

Repository
AWS Native pulumi/pulumi-aws-native
License
Apache-2.0

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi