CfnSubnetProps Struct
Properties for defining a CfnSubnet.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
declare const privateDnsNameOptionsOnLaunch: any;
const cfnSubnetProps: ec2.CfnSubnetProps = {
vpcId: 'vpcId',
// the properties below are optional
assignIpv6AddressOnCreation: false,
availabilityZone: 'availabilityZone',
availabilityZoneId: 'availabilityZoneId',
cidrBlock: 'cidrBlock',
enableDns64: false,
enableLniAtDeviceIndex: 123,
ipv4IpamPoolId: 'ipv4IpamPoolId',
ipv4NetmaskLength: 123,
ipv6CidrBlock: 'ipv6CidrBlock',
ipv6IpamPoolId: 'ipv6IpamPoolId',
ipv6Native: false,
ipv6NetmaskLength: 123,
mapPublicIpOnLaunch: false,
outpostArn: 'outpostArn',
privateDnsNameOptionsOnLaunch: privateDnsNameOptionsOnLaunch,
tags: [{
key: 'key',
value: 'value',
}],
};
Properties
assignIpv6AddressOnCreationboolean | IResolvableassign_ipv6_address_on_creationtyping.Union[bool, IResolvable]assignIpv6AddressOnCreationBooleanAssignIpv6AddressOnCreationboolAssignIpv6AddressOnCreationinterface{}#If you specify AssignIpv6AddressOnCreation , you must also specify an IPv6 CIDR block.
availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string#If you update this property, you must also update the CidrBlock property.
availabilityZoneIdstringavailability_zone_idstravailabilityZoneIdStringAvailabilityZoneIdstringAvailabilityZoneId*string#If you update this property, we create a new subnet, and then delete the existing one.
enableDns64boolean | IResolvableenable_dns64typing.Union[bool, IResolvable]enableDns64BooleanEnableDns64boolEnableDns64interface{}#notes
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
enableLniAtDeviceIndexnumberenable_lni_at_device_indexint | floatenableLniAtDeviceIndexNumberEnableLniAtDeviceIndexdoubleEnableLniAtDeviceIndex*float64#For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
ipv4IpamPoolIdstringipv4_ipam_pool_idstripv4IpamPoolIdStringIpv4IpamPoolIdstringIpv4IpamPoolId*string#ipv4NetmaskLengthnumberipv4_netmask_lengthint | floatipv4NetmaskLengthNumberIpv4NetmaskLengthdoubleIpv4NetmaskLength*float64#If you specify AssignIpv6AddressOnCreation , you must also specify an IPv6 CIDR block.
ipv6IpamPoolIdstringipv6_ipam_pool_idstripv6IpamPoolIdStringIpv6IpamPoolIdstringIpv6IpamPoolId*string#ipv6Nativeboolean | IResolvableipv6_nativetyping.Union[bool, IResolvable]ipv6NativeBooleanIpv6NativeboolIpv6Nativeinterface{}#For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
ipv6NetmaskLengthnumberipv6_netmask_lengthint | floatipv6NetmaskLengthNumberIpv6NetmaskLengthdoubleIpv6NetmaskLength*float64#mapPublicIpOnLaunchboolean | IResolvablemap_public_ip_on_launchtyping.Union[bool, IResolvable]mapPublicIpOnLaunchBooleanMapPublicIpOnLaunchboolMapPublicIpOnLaunchinterface{}#notes
AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page .
privateDnsNameOptionsOnLaunchanyprivate_dns_name_options_on_launchAnyprivateDnsNameOptionsOnLaunchObjectPrivateDnsNameOptionsOnLaunchobjectPrivateDnsNameOptionsOnLaunchinterface{}#notes
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)