Class CfnSubnet
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.ec2.CfnSubnet
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-27T16:50:56.440Z")
@Stability(Stable)
public class CfnSubnet
extends CfnResource
implements IInspectable, ITaggable
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:
Vpc vpc; public void associateSubnetWithV6Cidr(Vpc vpc, Number count, ISubnet subnet) { CfnSubnet cfnSubnet = (CfnSubnet)subnet.getNode().getDefaultChild(); cfnSubnet.getIpv6CidrBlock() = Fn.select(count, Fn.cidr(Fn.select(0, vpc.getVpcIpv6CidrBlocks()), 256, (128 - 64).toString())); cfnSubnet.getAssignIpv6AddressOnCreation() = true; } // make an ipv6 cidr CfnVPCCidrBlock ipv6cidr = CfnVPCCidrBlock.Builder.create(this, "CIDR6") .vpcId(vpc.getVpcId()) .amazonProvidedIpv6CidrBlock(true) .build(); // connect the ipv6 cidr to all vpc subnets Number subnetcount = 0; ISubnet[] subnets = vpc.publicSubnets.concat(vpc.getPrivateSubnets()); for (Object subnet : subnets) { // Wait for the ipv6 cidr to complete subnet.node.addDependency(ipv6cidr); associateSubnetWithV6Cidr(vpc, subnetcount, subnet); subnetcount = subnetcount + 1; } Cluster cluster = Cluster.Builder.create(this, "hello-eks") .version(KubernetesVersion.V1_31) .vpc(vpc) .ipFamily(IpFamily.IP_V6) .vpcSubnets(List.of(SubnetSelection.builder().subnets(vpc.getPublicSubnets()).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.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnSubnet
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnSubnet
(software.amazon.jsii.JsiiObjectRef objRef) CfnSubnet
(software.constructs.Construct scope, String id, CfnSubnetProps props) -
Method Summary
Modifier and TypeMethodDescriptionIndicates whether a network interface created in this subnet receives an IPv6 address.The Availability Zone of this subnet.The Availability Zone ID of this subnet.The IPv4 CIDR blocks that are associated with the subnet.The IPv6 CIDR blocks that are associated with the subnet.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.Indicates the device position for local network interfaces in this subnet.An IPv4 IPAM pool ID for the subnet.An IPv4 netmask length for the subnet.The IPv6 CIDR block.An IPv6 IPAM pool ID for the subnet.Indicates whether this is an IPv6 only subnet.An IPv6 netmask length for the 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()
Tag Manager which manages the tags for this resource.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
setEnableLniAtDeviceIndex
(Number value) Indicates the device position for local network interfaces in this subnet.void
setIpv4IpamPoolId
(String value) An IPv4 IPAM pool ID for the subnet.void
setIpv4NetmaskLength
(Number value) An IPv4 netmask length for the subnet.void
setIpv6CidrBlock
(String value) The IPv6 CIDR block.void
setIpv6IpamPoolId
(String value) An IPv6 IPAM pool ID for the subnet.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
setIpv6NetmaskLength
(Number value) An IPv6 netmask length for the 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
setTagsRaw
(List<CfnTag> value) Any tags assigned to the subnet.void
The ID of the VPC the subnet is in.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
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 software.constructs.Construct scope, @NotNull String id, @NotNull CfnSubnetProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
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,
us-east-1a
. -
getAttrAvailabilityZoneId
The Availability Zone ID of this subnet.For example,
use1-az1
. -
getAttrCidrBlock
The IPv4 CIDR blocks that are associated with the subnet. -
getAttrIpv6CidrBlocks
The IPv6 CIDR blocks that are associated with the subnet. -
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
Tag Manager which manages the tags for this resource. -
getVpcId
The ID of the VPC the subnet is in. -
setVpcId
The ID of the VPC the subnet is in. -
getAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address.The default value is
false
. -
setAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address.The default value is
false
. -
setAssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address.The default value is
false
. -
getAvailabilityZone
The Availability Zone of the subnet. -
setAvailabilityZone
The Availability Zone of the subnet. -
getAvailabilityZoneId
The AZ ID of the subnet. -
setAvailabilityZoneId
The AZ ID of the subnet. -
getCidrBlock
The IPv4 CIDR block assigned to the subnet. -
setCidrBlock
The IPv4 CIDR block assigned to the subnet. -
getEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. -
setEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. -
setEnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. -
getEnableLniAtDeviceIndex
Indicates the device position for local network interfaces in this subnet. -
setEnableLniAtDeviceIndex
Indicates the device position for local network interfaces in this subnet. -
getIpv4IpamPoolId
An IPv4 IPAM pool ID for the subnet. -
setIpv4IpamPoolId
An IPv4 IPAM pool ID for the subnet. -
getIpv4NetmaskLength
An IPv4 netmask length for the subnet. -
setIpv4NetmaskLength
An IPv4 netmask length for the subnet. -
getIpv6CidrBlock
The IPv6 CIDR block. -
setIpv6CidrBlock
The IPv6 CIDR block. -
getIpv6IpamPoolId
An IPv6 IPAM pool ID for the subnet. -
setIpv6IpamPoolId
An IPv6 IPAM pool ID for the subnet. -
getIpv6Native
Indicates whether this is an IPv6 only subnet. -
setIpv6Native
Indicates whether this is an IPv6 only subnet. -
setIpv6Native
Indicates whether this is an IPv6 only subnet. -
getIpv6NetmaskLength
An IPv6 netmask length for the subnet. -
setIpv6NetmaskLength
An IPv6 netmask length for the subnet. -
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. -
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. -
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. -
getTagsRaw
Any tags assigned to the subnet. -
setTagsRaw
Any tags assigned to the subnet.
-