Vpc

Provides a VPC resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var main = new Aws.Ec2.Vpc("main", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.0.0.0/16",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

main = aws.ec2.Vpc("main", cidr_block="10.0.0.0/16")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const main = new aws.ec2.Vpc("main", {
    cidrBlock: "10.0.0.0/16",
});

Create a Vpc Resource

new Vpc(name: string, args: VpcArgs, opts?: CustomResourceOptions);
@overload
def Vpc(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        assign_generated_ipv6_cidr_block: Optional[bool] = None,
        cidr_block: Optional[str] = None,
        enable_classiclink: Optional[bool] = None,
        enable_classiclink_dns_support: Optional[bool] = None,
        enable_dns_hostnames: Optional[bool] = None,
        enable_dns_support: Optional[bool] = None,
        instance_tenancy: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None)
@overload
def Vpc(resource_name: str,
        args: VpcArgs,
        opts: Optional[ResourceOptions] = None)
func NewVpc(ctx *Context, name string, args VpcArgs, opts ...ResourceOption) (*Vpc, error)
public Vpc(string name, VpcArgs args, CustomResourceOptions? opts = null)
name 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 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 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 string
The unique name of the resource.
args VpcArgs
The arguments to resource properties.
opts 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 Programming Model docs.

Inputs

The Vpc resource accepts the following input properties:

CidrBlock string
The CIDR block for the VPC.
AssignGeneratedIpv6CidrBlock bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
EnableClassiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
EnableClassiclinkDnsSupport bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
EnableDnsHostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
EnableDnsSupport bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
InstanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider .
CidrBlock string
The CIDR block for the VPC.
AssignGeneratedIpv6CidrBlock bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
EnableClassiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
EnableClassiclinkDnsSupport bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
EnableDnsHostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
EnableDnsSupport bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
InstanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider .
cidrBlock string
The CIDR block for the VPC.
assignGeneratedIpv6CidrBlock boolean
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
enableClassiclink boolean
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
enableClassiclinkDnsSupport boolean
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
enableDnsHostnames boolean
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
enableDnsSupport boolean
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
instanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider .
cidr_block str
The CIDR block for the VPC.
assign_generated_ipv6_cidr_block bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
enable_classiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
enable_classiclink_dns_support bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
enable_dns_hostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
enable_dns_support bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
instance_tenancy str
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider .

Outputs

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

Arn string
Amazon Resource Name (ARN) of VPC
DefaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
DefaultRouteTableId string
The ID of the route table created by default on VPC creation
DefaultSecurityGroupId string
The ID of the security group created by default on VPC creation
DhcpOptionsId string
Id string
The provider-assigned unique ID for this managed resource.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block.
Ipv6CidrBlock string
The IPv6 CIDR block.
MainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
OwnerId string
The ID of the AWS account that owns the VPC.
Arn string
Amazon Resource Name (ARN) of VPC
DefaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
DefaultRouteTableId string
The ID of the route table created by default on VPC creation
DefaultSecurityGroupId string
The ID of the security group created by default on VPC creation
DhcpOptionsId string
Id string
The provider-assigned unique ID for this managed resource.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block.
Ipv6CidrBlock string
The IPv6 CIDR block.
MainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
OwnerId string
The ID of the AWS account that owns the VPC.
arn string
Amazon Resource Name (ARN) of VPC
defaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
defaultRouteTableId string
The ID of the route table created by default on VPC creation
defaultSecurityGroupId string
The ID of the security group created by default on VPC creation
dhcpOptionsId string
id string
The provider-assigned unique ID for this managed resource.
ipv6AssociationId string
The association ID for the IPv6 CIDR block.
ipv6CidrBlock string
The IPv6 CIDR block.
mainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
ownerId string
The ID of the AWS account that owns the VPC.
arn str
Amazon Resource Name (ARN) of VPC
default_network_acl_id str
The ID of the network ACL created by default on VPC creation
default_route_table_id str
The ID of the route table created by default on VPC creation
default_security_group_id str
The ID of the security group created by default on VPC creation
dhcp_options_id str
id str
The provider-assigned unique ID for this managed resource.
ipv6_association_id str
The association ID for the IPv6 CIDR block.
ipv6_cidr_block str
The IPv6 CIDR block.
main_route_table_id str
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
owner_id str
The ID of the AWS account that owns the VPC.

Look up an Existing Vpc Resource

Get an existing Vpc resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VpcState, opts?: CustomResourceOptions): Vpc
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        assign_generated_ipv6_cidr_block: Optional[bool] = None,
        cidr_block: Optional[str] = None,
        default_network_acl_id: Optional[str] = None,
        default_route_table_id: Optional[str] = None,
        default_security_group_id: Optional[str] = None,
        dhcp_options_id: Optional[str] = None,
        enable_classiclink: Optional[bool] = None,
        enable_classiclink_dns_support: Optional[bool] = None,
        enable_dns_hostnames: Optional[bool] = None,
        enable_dns_support: Optional[bool] = None,
        instance_tenancy: Optional[str] = None,
        ipv6_association_id: Optional[str] = None,
        ipv6_cidr_block: Optional[str] = None,
        main_route_table_id: Optional[str] = None,
        owner_id: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> Vpc
func GetVpc(ctx *Context, name string, id IDInput, state *VpcState, opts ...ResourceOption) (*Vpc, error)
public static Vpc Get(string name, Input<string> id, VpcState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Arn string
Amazon Resource Name (ARN) of VPC
AssignGeneratedIpv6CidrBlock bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
CidrBlock string
The CIDR block for the VPC.
DefaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
DefaultRouteTableId string
The ID of the route table created by default on VPC creation
DefaultSecurityGroupId string
The ID of the security group created by default on VPC creation
DhcpOptionsId string
EnableClassiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
EnableClassiclinkDnsSupport bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
EnableDnsHostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
EnableDnsSupport bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
InstanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block.
Ipv6CidrBlock string
The IPv6 CIDR block.
MainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
OwnerId string
The ID of the AWS account that owns the VPC.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider .
Arn string
Amazon Resource Name (ARN) of VPC
AssignGeneratedIpv6CidrBlock bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
CidrBlock string
The CIDR block for the VPC.
DefaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
DefaultRouteTableId string
The ID of the route table created by default on VPC creation
DefaultSecurityGroupId string
The ID of the security group created by default on VPC creation
DhcpOptionsId string
EnableClassiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
EnableClassiclinkDnsSupport bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
EnableDnsHostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
EnableDnsSupport bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
InstanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block.
Ipv6CidrBlock string
The IPv6 CIDR block.
MainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
OwnerId string
The ID of the AWS account that owns the VPC.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider .
arn string
Amazon Resource Name (ARN) of VPC
assignGeneratedIpv6CidrBlock boolean
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
cidrBlock string
The CIDR block for the VPC.
defaultNetworkAclId string
The ID of the network ACL created by default on VPC creation
defaultRouteTableId string
The ID of the route table created by default on VPC creation
defaultSecurityGroupId string
The ID of the security group created by default on VPC creation
dhcpOptionsId string
enableClassiclink boolean
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
enableClassiclinkDnsSupport boolean
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
enableDnsHostnames boolean
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
enableDnsSupport boolean
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
instanceTenancy string
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
ipv6AssociationId string
The association ID for the IPv6 CIDR block.
ipv6CidrBlock string
The IPv6 CIDR block.
mainRouteTableId string
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
ownerId string
The ID of the AWS account that owns the VPC.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider .
arn str
Amazon Resource Name (ARN) of VPC
assign_generated_ipv6_cidr_block bool
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is false.
cidr_block str
The CIDR block for the VPC.
default_network_acl_id str
The ID of the network ACL created by default on VPC creation
default_route_table_id str
The ID of the route table created by default on VPC creation
default_security_group_id str
The ID of the security group created by default on VPC creation
dhcp_options_id str
enable_classiclink bool
A boolean flag to enable/disable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic. See the ClassicLink documentation for more information. Defaults false.
enable_classiclink_dns_support bool
A boolean flag to enable/disable ClassicLink DNS Support for the VPC. Only valid in regions and accounts that support EC2 Classic.
enable_dns_hostnames bool
A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
enable_dns_support bool
A boolean flag to enable/disable DNS support in the VPC. Defaults true.
instance_tenancy str
A tenancy option for instances launched into the VPC. Default is default, which makes your instances shared on the host. Using either of the other options (dedicated or host) costs at least $2/hr.
ipv6_association_id str
The association ID for the IPv6 CIDR block.
ipv6_cidr_block str
The IPv6 CIDR block.
main_route_table_id str
The ID of the main route table associated with this VPC. Note that you can change a VPC’s main route table by using an aws.ec2.MainRouteTableAssociation.
owner_id str
The ID of the AWS account that owns the VPC.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider .

Import

VPCs can be imported using the vpc id, e.g.

 $ pulumi import aws:ec2/vpc:Vpc test_vpc vpc-a01106c2

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.