1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. DefaultVpc
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.ec2.DefaultVpc

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

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

    If you created your AWS account after 2013-12-04 you have a default VPC in each AWS Region.

    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 resource behaves differently from normal resources in that if a default VPC exists, this provider does not create this resource, but instead “adopts” it into management. If no default VPC exists, the provider creates a new default VPC, which leads to the implicit creation of other resources. By default, pulumi destroy does not delete the default VPC but does remove the resource from the state. Set the force_destroy argument to true to delete the default VPC.

    Example Usage

    Basic usage with tags:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const _default = new aws.ec2.DefaultVpc("default", {tags: {
        Name: "Default VPC",
    }});
    
    import pulumi
    import pulumi_aws as aws
    
    default = aws.ec2.DefaultVpc("default", tags={
        "Name": "Default VPC",
    })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Aws.Ec2.DefaultVpc("default", new()
        {
            Tags = 
            {
                { "Name", "Default VPC" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.DefaultVpc;
    import com.pulumi.aws.ec2.DefaultVpcArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var default_ = new DefaultVpc("default", DefaultVpcArgs.builder()
                .tags(Map.of("Name", "Default VPC"))
                .build());
    
        }
    }
    
    resources:
      default:
        type: aws:ec2:DefaultVpc
        properties:
          tags:
            Name: Default VPC
    

    Create DefaultVpc Resource

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

    Constructor syntax

    new DefaultVpc(name: string, args?: DefaultVpcArgs, opts?: CustomResourceOptions);
    @overload
    def DefaultVpc(resource_name: str,
                   args: Optional[DefaultVpcArgs] = None,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def DefaultVpc(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   assign_generated_ipv6_cidr_block: Optional[bool] = None,
                   enable_dns_hostnames: Optional[bool] = None,
                   enable_dns_support: Optional[bool] = None,
                   enable_network_address_usage_metrics: Optional[bool] = None,
                   force_destroy: Optional[bool] = None,
                   ipv6_cidr_block: Optional[str] = None,
                   ipv6_cidr_block_network_border_group: Optional[str] = None,
                   ipv6_ipam_pool_id: Optional[str] = None,
                   ipv6_netmask_length: Optional[int] = None,
                   tags: Optional[Mapping[str, str]] = None)
    func NewDefaultVpc(ctx *Context, name string, args *DefaultVpcArgs, opts ...ResourceOption) (*DefaultVpc, error)
    public DefaultVpc(string name, DefaultVpcArgs? args = null, CustomResourceOptions? opts = null)
    public DefaultVpc(String name, DefaultVpcArgs args)
    public DefaultVpc(String name, DefaultVpcArgs args, CustomResourceOptions options)
    
    type: aws:ec2:DefaultVpc
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.
    name String
    The unique name of the resource.
    args DefaultVpcArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var defaultVpcResource = new Aws.Ec2.DefaultVpc("defaultVpcResource", new()
    {
        AssignGeneratedIpv6CidrBlock = false,
        EnableDnsHostnames = false,
        EnableDnsSupport = false,
        EnableNetworkAddressUsageMetrics = false,
        ForceDestroy = false,
        Ipv6CidrBlock = "string",
        Ipv6CidrBlockNetworkBorderGroup = "string",
        Ipv6IpamPoolId = "string",
        Ipv6NetmaskLength = 0,
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := ec2.NewDefaultVpc(ctx, "defaultVpcResource", &ec2.DefaultVpcArgs{
    	AssignGeneratedIpv6CidrBlock:     pulumi.Bool(false),
    	EnableDnsHostnames:               pulumi.Bool(false),
    	EnableDnsSupport:                 pulumi.Bool(false),
    	EnableNetworkAddressUsageMetrics: pulumi.Bool(false),
    	ForceDestroy:                     pulumi.Bool(false),
    	Ipv6CidrBlock:                    pulumi.String("string"),
    	Ipv6CidrBlockNetworkBorderGroup:  pulumi.String("string"),
    	Ipv6IpamPoolId:                   pulumi.String("string"),
    	Ipv6NetmaskLength:                pulumi.Int(0),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var defaultVpcResource = new DefaultVpc("defaultVpcResource", DefaultVpcArgs.builder()
        .assignGeneratedIpv6CidrBlock(false)
        .enableDnsHostnames(false)
        .enableDnsSupport(false)
        .enableNetworkAddressUsageMetrics(false)
        .forceDestroy(false)
        .ipv6CidrBlock("string")
        .ipv6CidrBlockNetworkBorderGroup("string")
        .ipv6IpamPoolId("string")
        .ipv6NetmaskLength(0)
        .tags(Map.of("string", "string"))
        .build());
    
    default_vpc_resource = aws.ec2.DefaultVpc("defaultVpcResource",
        assign_generated_ipv6_cidr_block=False,
        enable_dns_hostnames=False,
        enable_dns_support=False,
        enable_network_address_usage_metrics=False,
        force_destroy=False,
        ipv6_cidr_block="string",
        ipv6_cidr_block_network_border_group="string",
        ipv6_ipam_pool_id="string",
        ipv6_netmask_length=0,
        tags={
            "string": "string",
        })
    
    const defaultVpcResource = new aws.ec2.DefaultVpc("defaultVpcResource", {
        assignGeneratedIpv6CidrBlock: false,
        enableDnsHostnames: false,
        enableDnsSupport: false,
        enableNetworkAddressUsageMetrics: false,
        forceDestroy: false,
        ipv6CidrBlock: "string",
        ipv6CidrBlockNetworkBorderGroup: "string",
        ipv6IpamPoolId: "string",
        ipv6NetmaskLength: 0,
        tags: {
            string: "string",
        },
    });
    
    type: aws:ec2:DefaultVpc
    properties:
        assignGeneratedIpv6CidrBlock: false
        enableDnsHostnames: false
        enableDnsSupport: false
        enableNetworkAddressUsageMetrics: false
        forceDestroy: false
        ipv6CidrBlock: string
        ipv6CidrBlockNetworkBorderGroup: string
        ipv6IpamPoolId: string
        ipv6NetmaskLength: 0
        tags:
            string: string
    

    DefaultVpc 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 DefaultVpc resource accepts the following input properties:

    AssignGeneratedIpv6CidrBlock bool
    EnableDnsHostnames bool
    EnableDnsSupport bool
    EnableNetworkAddressUsageMetrics bool
    ForceDestroy bool
    Whether destroying the resource deletes the default VPC. Default: false
    Ipv6CidrBlock string
    Ipv6CidrBlockNetworkBorderGroup string
    Ipv6IpamPoolId string
    Ipv6NetmaskLength int
    Tags Dictionary<string, string>
    AssignGeneratedIpv6CidrBlock bool
    EnableDnsHostnames bool
    EnableDnsSupport bool
    EnableNetworkAddressUsageMetrics bool
    ForceDestroy bool
    Whether destroying the resource deletes the default VPC. Default: false
    Ipv6CidrBlock string
    Ipv6CidrBlockNetworkBorderGroup string
    Ipv6IpamPoolId string
    Ipv6NetmaskLength int
    Tags map[string]string
    assignGeneratedIpv6CidrBlock Boolean
    enableDnsHostnames Boolean
    enableDnsSupport Boolean
    enableNetworkAddressUsageMetrics Boolean
    forceDestroy Boolean
    Whether destroying the resource deletes the default VPC. Default: false
    ipv6CidrBlock String
    ipv6CidrBlockNetworkBorderGroup String
    ipv6IpamPoolId String
    ipv6NetmaskLength Integer
    tags Map<String,String>
    assignGeneratedIpv6CidrBlock boolean
    enableDnsHostnames boolean
    enableDnsSupport boolean
    enableNetworkAddressUsageMetrics boolean
    forceDestroy boolean
    Whether destroying the resource deletes the default VPC. Default: false
    ipv6CidrBlock string
    ipv6CidrBlockNetworkBorderGroup string
    ipv6IpamPoolId string
    ipv6NetmaskLength number
    tags {[key: string]: string}
    assignGeneratedIpv6CidrBlock Boolean
    enableDnsHostnames Boolean
    enableDnsSupport Boolean
    enableNetworkAddressUsageMetrics Boolean
    forceDestroy Boolean
    Whether destroying the resource deletes the default VPC. Default: false
    ipv6CidrBlock String
    ipv6CidrBlockNetworkBorderGroup String
    ipv6IpamPoolId String
    ipv6NetmaskLength Number
    tags Map<String>

    Outputs

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

    Arn string
    CidrBlock string
    The primary IPv4 CIDR block for the VPC
    DefaultNetworkAclId string
    DefaultRouteTableId string
    DefaultSecurityGroupId string
    DhcpOptionsId string
    ExistingDefaultVpc bool
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceTenancy string
    The allowed tenancy of instances launched into the VPC
    Ipv6AssociationId string
    MainRouteTableId string
    OwnerId string
    TagsAll Dictionary<string, string>

    Deprecated: Please use tags instead.

    Arn string
    CidrBlock string
    The primary IPv4 CIDR block for the VPC
    DefaultNetworkAclId string
    DefaultRouteTableId string
    DefaultSecurityGroupId string
    DhcpOptionsId string
    ExistingDefaultVpc bool
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceTenancy string
    The allowed tenancy of instances launched into the VPC
    Ipv6AssociationId string
    MainRouteTableId string
    OwnerId string
    TagsAll map[string]string

    Deprecated: Please use tags instead.

    arn String
    cidrBlock String
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId String
    defaultRouteTableId String
    defaultSecurityGroupId String
    dhcpOptionsId String
    existingDefaultVpc Boolean
    id String
    The provider-assigned unique ID for this managed resource.
    instanceTenancy String
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId String
    mainRouteTableId String
    ownerId String
    tagsAll Map<String,String>

    Deprecated: Please use tags instead.

    arn string
    cidrBlock string
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId string
    defaultRouteTableId string
    defaultSecurityGroupId string
    dhcpOptionsId string
    existingDefaultVpc boolean
    id string
    The provider-assigned unique ID for this managed resource.
    instanceTenancy string
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId string
    mainRouteTableId string
    ownerId string
    tagsAll {[key: string]: string}

    Deprecated: Please use tags instead.

    arn str
    cidr_block str
    The primary IPv4 CIDR block for the VPC
    default_network_acl_id str
    default_route_table_id str
    default_security_group_id str
    dhcp_options_id str
    existing_default_vpc bool
    id str
    The provider-assigned unique ID for this managed resource.
    instance_tenancy str
    The allowed tenancy of instances launched into the VPC
    ipv6_association_id str
    main_route_table_id str
    owner_id str
    tags_all Mapping[str, str]

    Deprecated: Please use tags instead.

    arn String
    cidrBlock String
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId String
    defaultRouteTableId String
    defaultSecurityGroupId String
    dhcpOptionsId String
    existingDefaultVpc Boolean
    id String
    The provider-assigned unique ID for this managed resource.
    instanceTenancy String
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId String
    mainRouteTableId String
    ownerId String
    tagsAll Map<String>

    Deprecated: Please use tags instead.

    Look up 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_dns_hostnames: Optional[bool] = None,
            enable_dns_support: Optional[bool] = None,
            enable_network_address_usage_metrics: Optional[bool] = None,
            existing_default_vpc: Optional[bool] = None,
            force_destroy: Optional[bool] = None,
            instance_tenancy: Optional[str] = None,
            ipv6_association_id: Optional[str] = None,
            ipv6_cidr_block: Optional[str] = None,
            ipv6_cidr_block_network_border_group: Optional[str] = None,
            ipv6_ipam_pool_id: Optional[str] = None,
            ipv6_netmask_length: Optional[int] = 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)
    public static DefaultVpc get(String name, Output<String> id, DefaultVpcState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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
    AssignGeneratedIpv6CidrBlock bool
    CidrBlock string
    The primary IPv4 CIDR block for the VPC
    DefaultNetworkAclId string
    DefaultRouteTableId string
    DefaultSecurityGroupId string
    DhcpOptionsId string
    EnableDnsHostnames bool
    EnableDnsSupport bool
    EnableNetworkAddressUsageMetrics bool
    ExistingDefaultVpc bool
    ForceDestroy bool
    Whether destroying the resource deletes the default VPC. Default: false
    InstanceTenancy string
    The allowed tenancy of instances launched into the VPC
    Ipv6AssociationId string
    Ipv6CidrBlock string
    Ipv6CidrBlockNetworkBorderGroup string
    Ipv6IpamPoolId string
    Ipv6NetmaskLength int
    MainRouteTableId string
    OwnerId string
    Tags Dictionary<string, string>
    TagsAll Dictionary<string, string>

    Deprecated: Please use tags instead.

    Arn string
    AssignGeneratedIpv6CidrBlock bool
    CidrBlock string
    The primary IPv4 CIDR block for the VPC
    DefaultNetworkAclId string
    DefaultRouteTableId string
    DefaultSecurityGroupId string
    DhcpOptionsId string
    EnableDnsHostnames bool
    EnableDnsSupport bool
    EnableNetworkAddressUsageMetrics bool
    ExistingDefaultVpc bool
    ForceDestroy bool
    Whether destroying the resource deletes the default VPC. Default: false
    InstanceTenancy string
    The allowed tenancy of instances launched into the VPC
    Ipv6AssociationId string
    Ipv6CidrBlock string
    Ipv6CidrBlockNetworkBorderGroup string
    Ipv6IpamPoolId string
    Ipv6NetmaskLength int
    MainRouteTableId string
    OwnerId string
    Tags map[string]string
    TagsAll map[string]string

    Deprecated: Please use tags instead.

    arn String
    assignGeneratedIpv6CidrBlock Boolean
    cidrBlock String
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId String
    defaultRouteTableId String
    defaultSecurityGroupId String
    dhcpOptionsId String
    enableDnsHostnames Boolean
    enableDnsSupport Boolean
    enableNetworkAddressUsageMetrics Boolean
    existingDefaultVpc Boolean
    forceDestroy Boolean
    Whether destroying the resource deletes the default VPC. Default: false
    instanceTenancy String
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId String
    ipv6CidrBlock String
    ipv6CidrBlockNetworkBorderGroup String
    ipv6IpamPoolId String
    ipv6NetmaskLength Integer
    mainRouteTableId String
    ownerId String
    tags Map<String,String>
    tagsAll Map<String,String>

    Deprecated: Please use tags instead.

    arn string
    assignGeneratedIpv6CidrBlock boolean
    cidrBlock string
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId string
    defaultRouteTableId string
    defaultSecurityGroupId string
    dhcpOptionsId string
    enableDnsHostnames boolean
    enableDnsSupport boolean
    enableNetworkAddressUsageMetrics boolean
    existingDefaultVpc boolean
    forceDestroy boolean
    Whether destroying the resource deletes the default VPC. Default: false
    instanceTenancy string
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId string
    ipv6CidrBlock string
    ipv6CidrBlockNetworkBorderGroup string
    ipv6IpamPoolId string
    ipv6NetmaskLength number
    mainRouteTableId string
    ownerId string
    tags {[key: string]: string}
    tagsAll {[key: string]: string}

    Deprecated: Please use tags instead.

    arn str
    assign_generated_ipv6_cidr_block bool
    cidr_block str
    The primary IPv4 CIDR block for the VPC
    default_network_acl_id str
    default_route_table_id str
    default_security_group_id str
    dhcp_options_id str
    enable_dns_hostnames bool
    enable_dns_support bool
    enable_network_address_usage_metrics bool
    existing_default_vpc bool
    force_destroy bool
    Whether destroying the resource deletes the default VPC. Default: false
    instance_tenancy str
    The allowed tenancy of instances launched into the VPC
    ipv6_association_id str
    ipv6_cidr_block str
    ipv6_cidr_block_network_border_group str
    ipv6_ipam_pool_id str
    ipv6_netmask_length int
    main_route_table_id str
    owner_id str
    tags Mapping[str, str]
    tags_all Mapping[str, str]

    Deprecated: Please use tags instead.

    arn String
    assignGeneratedIpv6CidrBlock Boolean
    cidrBlock String
    The primary IPv4 CIDR block for the VPC
    defaultNetworkAclId String
    defaultRouteTableId String
    defaultSecurityGroupId String
    dhcpOptionsId String
    enableDnsHostnames Boolean
    enableDnsSupport Boolean
    enableNetworkAddressUsageMetrics Boolean
    existingDefaultVpc Boolean
    forceDestroy Boolean
    Whether destroying the resource deletes the default VPC. Default: false
    instanceTenancy String
    The allowed tenancy of instances launched into the VPC
    ipv6AssociationId String
    ipv6CidrBlock String
    ipv6CidrBlockNetworkBorderGroup String
    ipv6IpamPoolId String
    ipv6NetmaskLength Number
    mainRouteTableId String
    ownerId String
    tags Map<String>
    tagsAll Map<String>

    Deprecated: Please use tags instead.

    Import

    Using pulumi import, import Default VPCs using the VPC id. For example:

    $ pulumi import aws:ec2/defaultVpc:DefaultVpc default vpc-a01106c2
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi