@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.335Z") @Stability(value=Stable) public class CfnSubnet extends CfnResource implements IInspectable
Specifies a subnet for a VPC.
When you create each subnet, you provide the VPC ID and IPv4 CIDR block for the subnet. After you create a subnet, you can't change its CIDR block. The size of the subnet's IPv4 CIDR block can be the same as a VPC's IPv4 CIDR block, or a subset of a VPC's IPv4 CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest IPv4 subnet (and VPC) you can create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 netmask (65,536 IPv4 addresses).
If you've associated an IPv6 CIDR block with your VPC, you can create a subnet with an IPv6 CIDR block that uses a /64 prefix length.
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();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnSubnet.Builder
A fluent builder for
CfnSubnet. |
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnSubnet(software.constructs.Construct scope,
String id,
CfnSubnetProps props)
Create a new `AWS::EC2::Subnet`.
|
protected |
CfnSubnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnSubnet(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAssignIpv6AddressOnCreation()
Indicates whether a network interface created in this subnet receives an IPv6 address.
|
String |
getAttrAvailabilityZone()
The Availability Zone of this subnet.
|
List<String> |
getAttrIpv6CidrBlocks()
The IPv6 CIDR blocks that are associated with the subnet, such as `[ 2001:db8:1234:1a00::/64 ]` .
|
String |
getAttrNetworkAclAssociationId()
The ID of the network ACL that is associated with the subnet's VPC, such as `acl-5fb85d36` .
|
String |
getAttrOutpostArn()
The Amazon Resource Name (ARN) of the Outpost.
|
String |
getAttrSubnetId()
The ID of the subnet.
|
String |
getAttrVpcId()
The ID of the subnet's VPC, such as `vpc-11ad4878` .
|
String |
getAvailabilityZone()
The Availability Zone of the subnet.
|
String |
getAvailabilityZoneId()
The AZ ID of the subnet.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getCidrBlock()
The IPv4 CIDR block assigned to the subnet.
|
Object |
getEnableDns64()
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
|
String |
getIpv6CidrBlock()
The IPv6 CIDR block.
|
Object |
getIpv6Native()
Indicates whether this is an IPv6 only subnet.
|
Object |
getMapPublicIpOnLaunch()
Indicates whether instances launched in this subnet receive a public IPv4 address.
|
String |
getOutpostArn()
The Amazon Resource Name (ARN) of the Outpost.
|
Object |
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.
|
TagManager |
getTags()
Any tags assigned to the subnet.
|
String |
getVpcId()
The ID of the VPC the subnet is in.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAssignIpv6AddressOnCreation(Boolean value)
Indicates whether a network interface created in this subnet receives an IPv6 address.
|
void |
setAssignIpv6AddressOnCreation(IResolvable value)
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 |
setMapPublicIpOnLaunch(IResolvable value)
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 |
setPrivateDnsNameOptionsOnLaunch(Object value)
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 |
setVpcId(String value)
The ID of the VPC the subnet is in.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnSubnet(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnSubnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnSubnet(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnSubnetProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrAvailabilityZone()
{ "Fn::GetAtt" : [ "mySubnet", "AvailabilityZone" ] }
@Stability(value=Stable) @NotNull public List<String> getAttrIpv6CidrBlocks()
@Stability(value=Stable) @NotNull public String getAttrNetworkAclAssociationId()
@Stability(value=Stable) @NotNull public String getAttrOutpostArn()
@Stability(value=Stable) @NotNull public String getAttrSubnetId()
@Stability(value=Stable) @NotNull public String getAttrVpcId()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public TagManager getTags()
@Stability(value=Stable) @NotNull public Object getPrivateDnsNameOptionsOnLaunch()
For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
@Stability(value=Stable)
public void setPrivateDnsNameOptionsOnLaunch(@NotNull
Object value)
For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
@Stability(value=Stable) @NotNull public String getVpcId()
If you update this property, you must also update the CidrBlock property.
@Stability(value=Stable)
public void setVpcId(@NotNull
String value)
If you update this property, you must also update the CidrBlock property.
@Stability(value=Stable) @Nullable public Object getAssignIpv6AddressOnCreation()
If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .
@Stability(value=Stable)
public void setAssignIpv6AddressOnCreation(@Nullable
Boolean value)
If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .
@Stability(value=Stable)
public void setAssignIpv6AddressOnCreation(@Nullable
IResolvable value)
If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .
@Stability(value=Stable) @Nullable public String getAvailabilityZone()
If you update this property, you must also update the CidrBlock property.
@Stability(value=Stable)
public void setAvailabilityZone(@Nullable
String value)
If you update this property, you must also update the CidrBlock property.
@Stability(value=Stable) @Nullable public String getAvailabilityZoneId()
@Stability(value=Stable)
public void setAvailabilityZoneId(@Nullable
String value)
@Stability(value=Stable) @Nullable public String getCidrBlock()
If you update this property, we create a new subnet, and then delete the existing one.
@Stability(value=Stable)
public void setCidrBlock(@Nullable
String value)
If you update this property, we create a new subnet, and then delete the existing one.
@Stability(value=Stable) @Nullable public Object getEnableDns64()
For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable)
public void setEnableDns64(@Nullable
Boolean value)
For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable)
public void setEnableDns64(@Nullable
IResolvable value)
For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable) @Nullable public String getIpv6CidrBlock()
If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .
@Stability(value=Stable)
public void setIpv6CidrBlock(@Nullable
String value)
If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .
@Stability(value=Stable) @Nullable public Object getIpv6Native()
For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable)
public void setIpv6Native(@Nullable
Boolean value)
For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable)
public void setIpv6Native(@Nullable
IResolvable value)
For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
@Stability(value=Stable) @Nullable public Object getMapPublicIpOnLaunch()
The default value is false .
@Stability(value=Stable)
public void setMapPublicIpOnLaunch(@Nullable
Boolean value)
The default value is false .
@Stability(value=Stable)
public void setMapPublicIpOnLaunch(@Nullable
IResolvable value)
The default value is false .
@Stability(value=Stable) @Nullable public String getOutpostArn()
@Stability(value=Stable)
public void setOutpostArn(@Nullable
String value)
Copyright © 2022. All rights reserved.