DefaultVpc

Provides a resource to manage the default AWS VPC in the current region.

For AWS accounts created after 2013-12-04, each region comes with a Default VPC. This is an advanced resource, and has special caveats to be aware of when using it. Please read this document in its entirety before using this resource.

The aws.ec2.DefaultVpc behaves differently from normal resources, in that this provider does not create this resource, but instead “adopts” it into management.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var @default = new Aws.Ec2.DefaultVpc("default", new Aws.Ec2.DefaultVpcArgs
        {
            Tags = 
            {
                { "Name", "Default VPC" },
            },
        });
    }

}
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.NewDefaultVpc(ctx, "_default", &ec2.DefaultVpcArgs{
			Tags: pulumi.StringMap{
				"Name": pulumi.String("Default VPC"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

default = aws.ec2.DefaultVpc("default", tags={
    "Name": "Default VPC",
})
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const defaultDefaultVpc = new aws.ec2.DefaultVpc("default", {
    tags: {
        Name: "Default VPC",
    },
});

Create a DefaultVpc Resource

new DefaultVpc(name: string, args?: DefaultVpcArgs, opts?: CustomResourceOptions);
@overload
def DefaultVpc(resource_name: str,
               opts: Optional[ResourceOptions] = 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,
               tags: Optional[Mapping[str, str]] = None,
               tags_all: Optional[Mapping[str, str]] = None)
@overload
def DefaultVpc(resource_name: str,
               args: Optional[DefaultVpcArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewDefaultVpc(ctx *Context, name string, args *DefaultVpcArgs, opts ...ResourceOption) (*DefaultVpc, error)
public DefaultVpc(string name, DefaultVpcArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DefaultVpcArgs
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 DefaultVpcArgs
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 DefaultVpcArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DefaultVpcArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

DefaultVpc Resource Properties

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

Inputs

The DefaultVpc resource accepts the following input properties:

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
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.
Tags Dictionary<string, string>
A map of tags to assign to the resource.
TagsAll Dictionary<string, 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
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.
Tags map[string]string
A map of tags to assign to the resource.
TagsAll map[string]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
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.
tags {[key: string]: string}
A map of tags to assign to the resource.
tagsAll {[key: string]: string}
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
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.
tags Mapping[str, str]
A map of tags to assign to the resource.
tags_all Mapping[str, str]

Outputs

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

Arn string
Amazon Resource Name (ARN) of VPC
AssignGeneratedIpv6CidrBlock bool
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
CidrBlock string
The CIDR block of 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
Id string
The provider-assigned unique ID for this managed resource.
InstanceTenancy string
Tenancy of instances spin up within VPC.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
Ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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
AssignGeneratedIpv6CidrBlock bool
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
CidrBlock string
The CIDR block of 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
Id string
The provider-assigned unique ID for this managed resource.
InstanceTenancy string
Tenancy of instances spin up within VPC.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
Ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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
assignGeneratedIpv6CidrBlock boolean
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
cidrBlock string
The CIDR block of 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
id string
The provider-assigned unique ID for this managed resource.
instanceTenancy string
Tenancy of instances spin up within VPC.
ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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
assign_generated_ipv6_cidr_block bool
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
cidr_block str
The CIDR block of 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
id str
The provider-assigned unique ID for this managed resource.
instance_tenancy str
Tenancy of instances spin up within VPC.
ipv6_association_id str
The association ID for the IPv6 CIDR block of the VPC
ipv6_cidr_block str
The IPv6 CIDR block of the VPC
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 DefaultVpc Resource

Get an existing DefaultVpc 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?: DefaultVpcState, opts?: CustomResourceOptions): DefaultVpc
@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) -> DefaultVpc
func GetDefaultVpc(ctx *Context, name string, id IDInput, state *DefaultVpcState, opts ...ResourceOption) (*DefaultVpc, error)
public static DefaultVpc Get(string name, Input<string> id, DefaultVpcState? 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
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
CidrBlock string
The CIDR block of 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
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
Tenancy of instances spin up within VPC.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
Ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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.
TagsAll Dictionary<string, string>
Arn string
Amazon Resource Name (ARN) of VPC
AssignGeneratedIpv6CidrBlock bool
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
CidrBlock string
The CIDR block of 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
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
Tenancy of instances spin up within VPC.
Ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
Ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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.
TagsAll map[string]string
arn string
Amazon Resource Name (ARN) of VPC
assignGeneratedIpv6CidrBlock boolean
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
cidrBlock string
The CIDR block of 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
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
Tenancy of instances spin up within VPC.
ipv6AssociationId string
The association ID for the IPv6 CIDR block of the VPC
ipv6CidrBlock string
The IPv6 CIDR block of the VPC
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.
tagsAll {[key: string]: string}
arn str
Amazon Resource Name (ARN) of VPC
assign_generated_ipv6_cidr_block bool
Whether or not an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC was assigned
cidr_block str
The CIDR block of 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
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
Tenancy of instances spin up within VPC.
ipv6_association_id str
The association ID for the IPv6 CIDR block of the VPC
ipv6_cidr_block str
The IPv6 CIDR block of the VPC
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.
tags_all Mapping[str, str]

Import

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

 $ pulumi import aws:ec2/defaultVpc:DefaultVpc default 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.