aws-cdk-lib.aws_ec2.CfnSubnetProps

interface CfnSubnetProps

LanguageType name
.NETAmazon.CDK.AWS.EC2.CfnSubnetProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnSubnetProps
Javasoftware.amazon.awscdk.services.ec2.CfnSubnetProps
Pythonaws_cdk.aws_ec2.CfnSubnetProps
TypeScript aws-cdk-lib » aws_ec2 » CfnSubnetProps

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,
  ipv6CidrBlock: 'ipv6CidrBlock',
  ipv6Native: false,
  mapPublicIpOnLaunch: false,
  outpostArn: 'outpostArn',
  privateDnsNameOptionsOnLaunch: privateDnsNameOptionsOnLaunch,
  tags: [{
    key: 'key',
    value: 'value',
  }],
};

Properties

NameTypeDescription
vpcIdstringThe ID of the VPC the subnet is in.
assignIpv6AddressOnCreation?boolean | IResolvableIndicates whether a network interface created in this subnet receives an IPv6 address. The default value is false .
availabilityZone?stringThe Availability Zone of the subnet.
availabilityZoneId?stringThe AZ ID of the subnet.
cidrBlock?stringThe IPv4 CIDR block assigned to the subnet.
enableDns64?boolean | IResolvableIndicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
ipv6CidrBlock?stringThe IPv6 CIDR block.
ipv6Native?boolean | IResolvableIndicates whether this is an IPv6 only subnet.
mapPublicIpOnLaunch?boolean | IResolvableIndicates whether instances launched in this subnet receive a public IPv4 address.
outpostArn?stringThe Amazon Resource Name (ARN) of the Outpost.
privateDnsNameOptionsOnLaunch?anyThe hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.
tags?CfnTag[]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 Ipv6CidrBlock .


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.

For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .


ipv6CidrBlock?

Type: string (optional)

The IPv6 CIDR block.

If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .


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 .


mapPublicIpOnLaunch?

Type: boolean | IResolvable (optional)

Indicates whether instances launched in this subnet receive a public IPv4 address.

The default value is false .


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: CfnTag[] (optional)

Any tags assigned to the subnet.