interface CfnSubnetProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.CfnSubnetProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnSubnetProps |
![]() | software.amazon.awscdk.services.ec2.CfnSubnetProps |
![]() | aws_cdk.aws_ec2.CfnSubnetProps |
![]() | aws-cdk-lib » aws_ec2 » CfnSubnetProps |
Properties for defining a CfnSubnet
.
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
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
Name | Type | Description |
---|---|---|
vpc | string | The ID of the VPC the subnet is in. |
assign | boolean | IResolvable | Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false . |
availability | string | The Availability Zone of the subnet. |
availability | string | The AZ ID of the subnet. |
cidr | string | The IPv4 CIDR block assigned to the subnet. |
enable | boolean | IResolvable | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. |
enable | number | Indicates the device position for local network interfaces in this subnet. |
ipv4 | string | An IPv4 IPAM pool ID for the subnet. |
ipv4 | number | An IPv4 netmask length for the subnet. |
ipv6 | string | The IPv6 CIDR block. |
ipv6 | string | An IPv6 IPAM pool ID for the subnet. |
ipv6 | boolean | IResolvable | Indicates whether this is an IPv6 only subnet. |
ipv6 | number | An IPv6 netmask length for the subnet. |
map | boolean | IResolvable | Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false . |
outpost | string | The Amazon Resource Name (ARN) of the Outpost. |
private | any | The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. |
tags? | Cfn [] | Any tags assigned to the subnet. |
vpcId
Type:
string
The ID of the VPC the subnet is in.
If you update this property, you must also update the CidrBlock
property.
assignIpv6AddressOnCreation?
Type:
boolean |
IResolvable
(optional)
Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false
.
If you specify AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block.
availabilityZone?
Type:
string
(optional)
The Availability Zone of the subnet.
If you update this property, you must also update the CidrBlock
property.
availabilityZoneId?
Type:
string
(optional)
The AZ ID of the subnet.
cidrBlock?
Type:
string
(optional)
The IPv4 CIDR block assigned to the subnet.
If you update this property, we create a new subnet, and then delete the existing one.
enableDns64?
Type:
boolean |
IResolvable
(optional)
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
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/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
enableLniAtDeviceIndex?
Type:
number
(optional)
Indicates the device position for local network interfaces in this subnet.
For example, 1
indicates local network interfaces in this subnet are the secondary network interface (eth1).
ipv4IpamPoolId?
Type:
string
(optional)
An IPv4 IPAM pool ID for the subnet.
ipv4NetmaskLength?
Type:
number
(optional)
An IPv4 netmask length for the subnet.
ipv6CidrBlock?
Type:
string
(optional)
The IPv6 CIDR block.
If you specify AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block.
ipv6IpamPoolId?
Type:
string
(optional)
An IPv6 IPAM pool ID for the subnet.
ipv6Native?
Type:
boolean |
IResolvable
(optional)
Indicates whether this is an IPv6 only subnet.
For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
ipv6NetmaskLength?
Type:
number
(optional)
An IPv6 netmask length for the subnet.
mapPublicIpOnLaunch?
Type:
boolean |
IResolvable
(optional)
Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false
.
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 .
outpostArn?
Type:
string
(optional)
The Amazon Resource Name (ARN) of the Outpost.
privateDnsNameOptionsOnLaunch?
Type:
any
(optional)
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)
tags?
Type:
Cfn
[]
(optional)
Any tags assigned to the subnet.