Class CfnSubnet
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::EC2::Subnet
.
Specifies a subnet for the specified VPC.
For an IPv4 only subnet, specify an IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can create an IPv6 only subnet or a dual stack subnet instead. For an IPv6 only subnet, specify an IPv6 CIDR block. For a dual stack subnet, specify both an IPv4 CIDR block and an IPv6 CIDR block.
For more information, see Subnets for your VPC in the Amazon VPC User Guide .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.ec2.*; Object privateDnsNameOptionsOnLaunch; CfnSubnet cfnSubnet = CfnSubnet.Builder.create(this, "MyCfnSubnet") .vpcId("vpcId") // the properties below are optional .assignIpv6AddressOnCreation(false) .availabilityZone("availabilityZone") .availabilityZoneId("availabilityZoneId") .cidrBlock("cidrBlock") .enableDns64(false) .ipv6CidrBlock("ipv6CidrBlock") .ipv6Native(false) .mapPublicIpOnLaunch(false) .outpostArn("outpostArn") .privateDnsNameOptionsOnLaunch(privateDnsNameOptionsOnLaunch) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A fluent builder forCfnSubnet
.static interface
Describes the options for instance hostnames.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 TypeMethodDescriptionIndicates whether a network interface created in this subnet receives an IPv6 address.The Availability Zone of this subnet.The IPv6 CIDR blocks that are associated with the subnet, such as[ 2001:db8:1234:1a00::/64 ]
.The ID of the network ACL that is associated with the subnet's VPC, such asacl-5fb85d36
.The Amazon Resource Name (ARN) of the Outpost.The ID of the subnet.The ID of the subnet's VPC, such asvpc-11ad4878
.The Availability Zone of the subnet.The AZ ID of the subnet.The IPv4 CIDR block assigned to the subnet.Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.The IPv6 CIDR block.Indicates whether this is an IPv6 only subnet.Indicates whether instances launched in this subnet receive a public IPv4 address.The Amazon Resource Name (ARN) of the Outpost.The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.getTags()
Any tags assigned to the subnet.getVpcId()
The ID of the VPC the subnet is in.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
Indicates whether a network interface created in this subnet receives an IPv6 address.void
Indicates whether a network interface created in this subnet receives an IPv6 address.void
setAvailabilityZone
(String value) The Availability Zone of the subnet.void
setAvailabilityZoneId
(String value) The AZ ID of the subnet.void
setCidrBlock
(String value) The IPv4 CIDR block assigned to the subnet.void
setEnableDns64
(Boolean value) Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.void
setEnableDns64
(IResolvable value) Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.void
setIpv6CidrBlock
(String value) The IPv6 CIDR block.void
setIpv6Native
(Boolean value) Indicates whether this is an IPv6 only subnet.void
setIpv6Native
(IResolvable value) Indicates whether this is an IPv6 only subnet.void
setMapPublicIpOnLaunch
(Boolean value) Indicates whether instances launched in this subnet receive a public IPv4 address.void
Indicates whether instances launched in this subnet receive a public IPv4 address.void
setOutpostArn
(String value) The Amazon Resource Name (ARN) of the Outpost.void
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.void
The ID of the VPC the subnet is in.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
-
CfnSubnet
protected CfnSubnet(software.amazon.jsii.JsiiObjectRef objRef) -
CfnSubnet
protected CfnSubnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnSubnet
@Stability(Stable) public CfnSubnet(@NotNull Construct scope, @NotNull String id, @NotNull CfnSubnetProps props) Create a newAWS::EC2::Subnet
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
-
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.
-
getAttrAvailabilityZone
The Availability Zone of this subnet. For example:.{ "Fn::GetAtt" : [ "mySubnet", "AvailabilityZone" ] }
-
getAttrIpv6CidrBlocks
The IPv6 CIDR blocks that are associated with the subnet, such as[ 2001:db8:1234:1a00::/64 ]
. -
getAttrNetworkAclAssociationId
The ID of the network ACL that is associated with the subnet's VPC, such asacl-5fb85d36
. -
getAttrOutpostArn
The Amazon Resource Name (ARN) of the Outpost. -
getAttrSubnetId
The ID of the subnet. -
getAttrVpcId
The ID of the subnet's VPC, such asvpc-11ad4878
. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Any tags assigned to the subnet. -
getPrivateDnsNameOptionsOnLaunch
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
Available options:
- EnableResourceNameDnsAAAARecord (true | false)
- EnableResourceNameDnsARecord (true | false)
- HostnameType (ip-name | resource-name)
-
setPrivateDnsNameOptionsOnLaunch
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
Available options:
- EnableResourceNameDnsAAAARecord (true | false)
- EnableResourceNameDnsARecord (true | false)
- HostnameType (ip-name | resource-name)
-
getVpcId
The ID of the VPC the subnet is in.If you update this property, you must also update the
CidrBlock
property. -
setVpcId
The ID of the VPC the subnet is in.If you update this property, you must also update the
CidrBlock
property. -
getAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address. The default value isfalse
.If you specify
AssignIpv6AddressOnCreation
, you must also specifyIpv6CidrBlock
. -
setAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address. The default value isfalse
.If you specify
AssignIpv6AddressOnCreation
, you must also specifyIpv6CidrBlock
. -
setAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address. The default value isfalse
.If you specify
AssignIpv6AddressOnCreation
, you must also specifyIpv6CidrBlock
. -
getAvailabilityZone
The Availability Zone of the subnet.If you update this property, you must also update the
CidrBlock
property. -
setAvailabilityZone
The Availability Zone of the subnet.If you update this property, you must also update the
CidrBlock
property. -
getAvailabilityZoneId
The AZ ID of the subnet. -
setAvailabilityZoneId
The AZ ID of the subnet. -
getCidrBlock
The IPv4 CIDR block assigned to the subnet.If you update this property, we create a new subnet, and then delete the existing one.
-
setCidrBlock
The IPv4 CIDR block assigned to the subnet.If you update this property, we create a new subnet, and then delete the existing one.
-
getEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
-
setEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
-
setEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
-
getIpv6CidrBlock
The IPv6 CIDR block.If you specify
AssignIpv6AddressOnCreation
, you must also specifyIpv6CidrBlock
. -
setIpv6CidrBlock
The IPv6 CIDR block.If you specify
AssignIpv6AddressOnCreation
, you must also specifyIpv6CidrBlock
. -
getIpv6Native
Indicates whether this is an IPv6 only subnet.For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
-
setIpv6Native
Indicates whether this is an IPv6 only subnet.For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
-
setIpv6Native
Indicates whether this is an IPv6 only subnet.For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
-
getMapPublicIpOnLaunch
Indicates whether instances launched in this subnet receive a public IPv4 address.The default value is
false
. -
setMapPublicIpOnLaunch
Indicates whether instances launched in this subnet receive a public IPv4 address.The default value is
false
. -
setMapPublicIpOnLaunch
Indicates whether instances launched in this subnet receive a public IPv4 address.The default value is
false
. -
getOutpostArn
The Amazon Resource Name (ARN) of the Outpost. -
setOutpostArn
The Amazon Resource Name (ARN) of the Outpost.
-