Class CfnVPC
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::EC2::VPC
.
Specifies a virtual private cloud (VPC).
You can optionally request an IPv6 CIDR block for the VPC. You can request an Amazon-provided IPv6 CIDR block from Amazon's pool of IPv6 addresses, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP).
For more information, see Virtual private clouds (VPC) in the Amazon VPC User Guide .
Example:
CfnInclude cfnTemplate; // using from*Attributes() CfnSubnet privateCfnSubnet1; CfnSubnet privateCfnSubnet2; // using from*Name() CfnBucket cfnBucket = (CfnBucket)cfnTemplate.getResource("Bucket"); IBucket bucket = Bucket.fromBucketName(this, "L2Bucket", cfnBucket.getRef()); // using from*Arn() CfnKey cfnKey = (CfnKey)cfnTemplate.getResource("Key"); IKey key = Key.fromKeyArn(this, "L2Key", cfnKey.getAttrArn()); CfnVPC cfnVpc = (CfnVPC)cfnTemplate.getResource("Vpc"); IVpc vpc = Vpc.fromVpcAttributes(this, "L2Vpc", VpcAttributes.builder() .vpcId(cfnVpc.getRef()) .availabilityZones(Fn.getAzs()) .privateSubnetIds(List.of(privateCfnSubnet1.getRef(), privateCfnSubnet2.getRef())) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe primary IPv4 CIDR block for the VPC.The association IDs of the IPv4 CIDR blocks for the VPC.The ID of the default network ACL for the VPC.The ID of the default security group for the VPC.The IPv6 CIDR blocks for the VPC.The ID of the VPC.The IPv4 network range for the VPC, in CIDR notation.Indicates whether the instances launched in the VPC get DNS hostnames.Indicates whether the DNS resolution is supported for the VPC.The allowed tenancy of instances launched into the VPC.The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR.The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool.getTags()
The tags for the VPC.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setCidrBlock
(String value) The IPv4 network range for the VPC, in CIDR notation.void
setEnableDnsHostnames
(Boolean value) Indicates whether the instances launched in the VPC get DNS hostnames.void
setEnableDnsHostnames
(IResolvable value) Indicates whether the instances launched in the VPC get DNS hostnames.void
setEnableDnsSupport
(Boolean value) Indicates whether the DNS resolution is supported for the VPC.void
setEnableDnsSupport
(IResolvable value) Indicates whether the DNS resolution is supported for the VPC.void
setInstanceTenancy
(String value) The allowed tenancy of instances launched into the VPC.void
setIpv4IpamPoolId
(String value) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR.void
setIpv4NetmaskLength
(Number value) The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnVPC
protected CfnVPC(software.amazon.jsii.JsiiObjectRef objRef) -
CfnVPC
protected CfnVPC(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnVPC
@Stability(Stable) public CfnVPC(@NotNull Construct scope, @NotNull String id, @Nullable CfnVPCProps props) Create a newAWS::EC2::VPC
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
CfnVPC
Create a newAWS::EC2::VPC
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrCidrBlock
The primary IPv4 CIDR block for the VPC.For example, 10.0.0.0/16.
-
getAttrCidrBlockAssociations
The association IDs of the IPv4 CIDR blocks for the VPC.For example, [ vpc-cidr-assoc-0280ab6b ].
-
getAttrDefaultNetworkAcl
The ID of the default network ACL for the VPC.For example, acl-814dafe3.
-
getAttrDefaultSecurityGroup
The ID of the default security group for the VPC.For example, sg-b178e0d3.
-
getAttrIpv6CidrBlocks
The IPv6 CIDR blocks for the VPC.For example, [ 2001:db8:1234:1a00::/56 ].
-
getAttrVpcId
The ID of the VPC. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
The tags for the VPC. -
getCidrBlock
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 specify100.68.0.18/18
, we modify it to100.68.0.0/18
.You must specify either
CidrBlock
orIpv4IpamPoolId
. -
setCidrBlock
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 specify100.68.0.18/18
, we modify it to100.68.0.0/18
.You must specify either
CidrBlock
orIpv4IpamPoolId
. -
getEnableDnsHostnames
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.
-
setEnableDnsHostnames
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.
-
setEnableDnsHostnames
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.
-
getEnableDnsSupport
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 .
-
setEnableDnsSupport
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 .
-
setEnableDnsSupport
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 .
-
getInstanceTenancy
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 ofhost
during instance launch. You cannot specify a tenancy ofdefault
during instance launch.
Updating
InstanceTenancy
requires no replacement only if you are updating its value fromdedicated
todefault
. UpdatingInstanceTenancy
fromdefault
todedicated
requires replacement. -
setInstanceTenancy
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 ofhost
during instance launch. You cannot specify a tenancy ofdefault
during instance launch.
Updating
InstanceTenancy
requires no replacement only if you are updating its value fromdedicated
todefault
. UpdatingInstanceTenancy
fromdefault
todedicated
requires replacement. -
getIpv4IpamPoolId
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 either
CidrBlock
orIpv4IpamPoolId
. -
setIpv4IpamPoolId
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 either
CidrBlock
orIpv4IpamPoolId
. -
getIpv4NetmaskLength
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 .
-
setIpv4NetmaskLength
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 .
-