interface SubnetProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.SubnetProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#SubnetProps |
Java | software.amazon.awscdk.services.ec2.SubnetProps |
Python | aws_cdk.aws_ec2.SubnetProps |
TypeScript (source) | aws-cdk-lib » aws_ec2 » SubnetProps |
Specify configuration parameters for a VPC subnet.
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 subnetProps: ec2.SubnetProps = {
availabilityZone: 'availabilityZone',
cidrBlock: 'cidrBlock',
vpcId: 'vpcId',
// the properties below are optional
assignIpv6AddressOnCreation: false,
ipv6CidrBlock: 'ipv6CidrBlock',
mapPublicIpOnLaunch: false,
};
Properties
Name | Type | Description |
---|---|---|
availability | string | The availability zone for the subnet. |
cidr | string | The CIDR notation for this subnet. |
vpc | string | The VPC which this subnet is part of. |
assign | boolean | Indicates whether a network interface created in this subnet receives an IPv6 address. |
ipv6 | string | The IPv6 CIDR block. |
map | boolean | Controls if a public IP is associated to an instance at launch. |
availabilityZone
Type:
string
The availability zone for the subnet.
cidrBlock
Type:
string
The CIDR notation for this subnet.
vpcId
Type:
string
The VPC which this subnet is part of.
assignIpv6AddressOnCreation?
Type:
boolean
(optional, default: false)
Indicates whether a network interface created in this subnet receives an IPv6 address.
If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.
ipv6CidrBlock?
Type:
string
(optional, default: no IPv6 CIDR block.)
The IPv6 CIDR block.
If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.
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.