Try AWS Native preview for resources not in the classic version.
aws.ec2.DefaultVpc
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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
The DefaultVpc resource accepts the following input properties:
- Assign
Generated boolIpv6Cidr Block - Enable
Dns boolHostnames - Enable
Dns boolSupport - Enable
Network boolAddress Usage Metrics - Force
Destroy bool - Whether destroying the resource deletes the default VPC. Default:
false
- Ipv6Cidr
Block string - Ipv6Cidr
Block stringNetwork Border Group - Ipv6Ipam
Pool stringId - Ipv6Netmask
Length int - Dictionary<string, string>
- Assign
Generated boolIpv6Cidr Block - Enable
Dns boolHostnames - Enable
Dns boolSupport - Enable
Network boolAddress Usage Metrics - Force
Destroy bool - Whether destroying the resource deletes the default VPC. Default:
false
- Ipv6Cidr
Block string - Ipv6Cidr
Block stringNetwork Border Group - Ipv6Ipam
Pool stringId - Ipv6Netmask
Length int - map[string]string
- assign
Generated BooleanIpv6Cidr Block - enable
Dns BooleanHostnames - enable
Dns BooleanSupport - enable
Network BooleanAddress Usage Metrics - force
Destroy Boolean - Whether destroying the resource deletes the default VPC. Default:
false
- ipv6Cidr
Block String - ipv6Cidr
Block StringNetwork Border Group - ipv6Ipam
Pool StringId - ipv6Netmask
Length Integer - Map<String,String>
- assign
Generated booleanIpv6Cidr Block - enable
Dns booleanHostnames - enable
Dns booleanSupport - enable
Network booleanAddress Usage Metrics - force
Destroy boolean - Whether destroying the resource deletes the default VPC. Default:
false
- ipv6Cidr
Block string - ipv6Cidr
Block stringNetwork Border Group - ipv6Ipam
Pool stringId - ipv6Netmask
Length number - {[key: string]: string}
- assign_
generated_ boolipv6_ cidr_ block - enable_
dns_ boolhostnames - enable_
dns_ boolsupport - enable_
network_ booladdress_ usage_ metrics - force_
destroy bool - Whether destroying the resource deletes the default VPC. Default:
false
- ipv6_
cidr_ strblock - ipv6_
cidr_ strblock_ network_ border_ group - ipv6_
ipam_ strpool_ id - ipv6_
netmask_ intlength - Mapping[str, str]
- assign
Generated BooleanIpv6Cidr Block - enable
Dns BooleanHostnames - enable
Dns BooleanSupport - enable
Network BooleanAddress Usage Metrics - force
Destroy Boolean - Whether destroying the resource deletes the default VPC. Default:
false
- ipv6Cidr
Block String - ipv6Cidr
Block StringNetwork Border Group - ipv6Ipam
Pool StringId - ipv6Netmask
Length Number - Map<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the DefaultVpc resource produces the following output properties:
- Arn string
- Cidr
Block string - The primary IPv4 CIDR block for the VPC
- Default
Network stringAcl Id - Default
Route stringTable Id - Default
Security stringGroup Id - Dhcp
Options stringId - Existing
Default boolVpc - Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- Ipv6Association
Id string - Main
Route stringTable Id - Owner
Id string - Dictionary<string, string>
- Arn string
- Cidr
Block string - The primary IPv4 CIDR block for the VPC
- Default
Network stringAcl Id - Default
Route stringTable Id - Default
Security stringGroup Id - Dhcp
Options stringId - Existing
Default boolVpc - Id string
- The provider-assigned unique ID for this managed resource.
- Instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- Ipv6Association
Id string - Main
Route stringTable Id - Owner
Id string - map[string]string
- arn String
- cidr
Block String - The primary IPv4 CIDR block for the VPC
- default
Network StringAcl Id - default
Route StringTable Id - default
Security StringGroup Id - dhcp
Options StringId - existing
Default BooleanVpc - id String
- The provider-assigned unique ID for this managed resource.
- instance
Tenancy String - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id String - main
Route StringTable Id - owner
Id String - Map<String,String>
- arn string
- cidr
Block string - The primary IPv4 CIDR block for the VPC
- default
Network stringAcl Id - default
Route stringTable Id - default
Security stringGroup Id - dhcp
Options stringId - existing
Default booleanVpc - id string
- The provider-assigned unique ID for this managed resource.
- instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id string - main
Route stringTable Id - owner
Id string - {[key: string]: string}
- arn str
- cidr_
block str - The primary IPv4 CIDR block for the VPC
- default_
network_ stracl_ id - default_
route_ strtable_ id - default_
security_ strgroup_ id - dhcp_
options_ strid - existing_
default_ boolvpc - 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_ strid - main_
route_ strtable_ id - owner_
id str - Mapping[str, str]
- arn String
- cidr
Block String - The primary IPv4 CIDR block for the VPC
- default
Network StringAcl Id - default
Route StringTable Id - default
Security StringGroup Id - dhcp
Options StringId - existing
Default BooleanVpc - id String
- The provider-assigned unique ID for this managed resource.
- instance
Tenancy String - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id String - main
Route StringTable Id - owner
Id String - Map<String>
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.
- Arn string
- Assign
Generated boolIpv6Cidr Block - Cidr
Block string - The primary IPv4 CIDR block for the VPC
- Default
Network stringAcl Id - Default
Route stringTable Id - Default
Security stringGroup Id - Dhcp
Options stringId - Enable
Dns boolHostnames - Enable
Dns boolSupport - Enable
Network boolAddress Usage Metrics - Existing
Default boolVpc - Force
Destroy bool - Whether destroying the resource deletes the default VPC. Default:
false
- Instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- Ipv6Association
Id string - Ipv6Cidr
Block string - Ipv6Cidr
Block stringNetwork Border Group - Ipv6Ipam
Pool stringId - Ipv6Netmask
Length int - Main
Route stringTable Id - Owner
Id string - Dictionary<string, string>
- Dictionary<string, string>
- Arn string
- Assign
Generated boolIpv6Cidr Block - Cidr
Block string - The primary IPv4 CIDR block for the VPC
- Default
Network stringAcl Id - Default
Route stringTable Id - Default
Security stringGroup Id - Dhcp
Options stringId - Enable
Dns boolHostnames - Enable
Dns boolSupport - Enable
Network boolAddress Usage Metrics - Existing
Default boolVpc - Force
Destroy bool - Whether destroying the resource deletes the default VPC. Default:
false
- Instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- Ipv6Association
Id string - Ipv6Cidr
Block string - Ipv6Cidr
Block stringNetwork Border Group - Ipv6Ipam
Pool stringId - Ipv6Netmask
Length int - Main
Route stringTable Id - Owner
Id string - map[string]string
- map[string]string
- arn String
- assign
Generated BooleanIpv6Cidr Block - cidr
Block String - The primary IPv4 CIDR block for the VPC
- default
Network StringAcl Id - default
Route StringTable Id - default
Security StringGroup Id - dhcp
Options StringId - enable
Dns BooleanHostnames - enable
Dns BooleanSupport - enable
Network BooleanAddress Usage Metrics - existing
Default BooleanVpc - force
Destroy Boolean - Whether destroying the resource deletes the default VPC. Default:
false
- instance
Tenancy String - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id String - ipv6Cidr
Block String - ipv6Cidr
Block StringNetwork Border Group - ipv6Ipam
Pool StringId - ipv6Netmask
Length Integer - main
Route StringTable Id - owner
Id String - Map<String,String>
- Map<String,String>
- arn string
- assign
Generated booleanIpv6Cidr Block - cidr
Block string - The primary IPv4 CIDR block for the VPC
- default
Network stringAcl Id - default
Route stringTable Id - default
Security stringGroup Id - dhcp
Options stringId - enable
Dns booleanHostnames - enable
Dns booleanSupport - enable
Network booleanAddress Usage Metrics - existing
Default booleanVpc - force
Destroy boolean - Whether destroying the resource deletes the default VPC. Default:
false
- instance
Tenancy string - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id string - ipv6Cidr
Block string - ipv6Cidr
Block stringNetwork Border Group - ipv6Ipam
Pool stringId - ipv6Netmask
Length number - main
Route stringTable Id - owner
Id string - {[key: string]: string}
- {[key: string]: string}
- arn str
- assign_
generated_ boolipv6_ cidr_ block - cidr_
block str - The primary IPv4 CIDR block for the VPC
- default_
network_ stracl_ id - default_
route_ strtable_ id - default_
security_ strgroup_ id - dhcp_
options_ strid - enable_
dns_ boolhostnames - enable_
dns_ boolsupport - enable_
network_ booladdress_ usage_ metrics - existing_
default_ boolvpc - 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_ strid - ipv6_
cidr_ strblock - ipv6_
cidr_ strblock_ network_ border_ group - ipv6_
ipam_ strpool_ id - ipv6_
netmask_ intlength - main_
route_ strtable_ id - owner_
id str - Mapping[str, str]
- Mapping[str, str]
- arn String
- assign
Generated BooleanIpv6Cidr Block - cidr
Block String - The primary IPv4 CIDR block for the VPC
- default
Network StringAcl Id - default
Route StringTable Id - default
Security StringGroup Id - dhcp
Options StringId - enable
Dns BooleanHostnames - enable
Dns BooleanSupport - enable
Network BooleanAddress Usage Metrics - existing
Default BooleanVpc - force
Destroy Boolean - Whether destroying the resource deletes the default VPC. Default:
false
- instance
Tenancy String - The allowed tenancy of instances launched into the VPC
- ipv6Association
Id String - ipv6Cidr
Block String - ipv6Cidr
Block StringNetwork Border Group - ipv6Ipam
Pool StringId - ipv6Netmask
Length Number - main
Route StringTable Id - owner
Id String - Map<String>
- Map<String>
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.
Try AWS Native preview for resources not in the classic version.