aws-cdk-lib.aws_ec2.SubnetConfiguration

interface SubnetConfiguration

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

Specify configuration parameters for a single subnet group in a VPC.

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';
const subnetConfiguration: ec2.SubnetConfiguration = {
  name: 'name',
  subnetType: ec2.SubnetType.PRIVATE_ISOLATED,

  // the properties below are optional
  cidrMask: 123,
  mapPublicIpOnLaunch: false,
  reserved: false,
};

Properties

NameTypeDescription
namestringLogical name for the subnet group.
subnetTypeSubnetTypeThe type of Subnet to configure.
cidrMask?numberThe number of leading 1 bits in the routing mask.
mapPublicIpOnLaunch?booleanControls if a public IP is associated to an instance at launch.
reserved?booleanControls if subnet IP space needs to be reserved.

name

Type: string

Logical name for the subnet group.

This name can be used when selecting VPC subnets to distinguish between different subnet groups of the same type.


subnetType

Type: SubnetType

The type of Subnet to configure.

The Subnet type will control the ability to route and connect to the Internet.


cidrMask?

Type: number (optional, default: Available IP space is evenly divided across subnets.)

The number of leading 1 bits in the routing mask.

The number of available IP addresses in each subnet of this group will be equal to 2^(32 - cidrMask) - 2.

Valid values are 16--28.


mapPublicIpOnLaunch?

Type: boolean (optional, default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.)

Controls if a public IP is associated to an instance at launch.


reserved?

Type: boolean (optional, default: false)

Controls if subnet IP space needs to be reserved.

When true, the IP space for the subnet is reserved but no actual resources are provisioned. This space is only dependent on the number of availability zones and on cidrMask - all other subnet properties are ignored.