AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

PrivateSubnet

Represents a private VPC subnet resource.

Import

import { PrivateSubnet } from 'aws-cdk-lib/aws-ec2';

Or use the module namespace:

import * as ec2 from 'aws-cdk-lib/aws-ec2';
// ec2.PrivateSubnet

Properties

Configuration passed to the constructor as PrivateSubnetProps.

6 properties inherited from SubnetProps
availabilityZoneRequiredinherited from SubnetProps
string

The availability zone for the subnet.

cidrBlockRequiredinherited from SubnetProps
string

The CIDR notation for this subnet.

vpcIdRequiredinherited from SubnetProps
string

The VPC which this subnet is part of.

assignIpv6AddressOnCreationOptionalinherited from SubnetProps
boolean

Indicates whether a network interface created in this subnet receives an IPv6 address. If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.

Default: false

ipv6CidrBlockOptionalinherited from SubnetProps
string

The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.

Default: - no IPv6 CIDR block.

mapPublicIpOnLaunchOptionalinherited from SubnetProps
boolean

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

Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.

Get the Amazon EC2 Cheat Sheet

Everything you need to know about Amazon EC2 on one page. HD quality, print-friendly.

Download Free Infographic