interface SubnetV2Props
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ec2.Alpha.SubnetV2Props |
Go | github.com/aws/aws-cdk-go/awsec2alpha/v2#SubnetV2Props |
Java | software.amazon.awscdk.services.ec2.alpha.SubnetV2Props |
Python | aws_cdk.aws_ec2_alpha.SubnetV2Props |
TypeScript (source) | @aws-cdk/aws-ec2-alpha ยป SubnetV2Props |
Properties to define subnet for VPC.
Example
const myVpc = new VpcV2(this, 'Vpc');
const routeTable = new RouteTable(this, 'RouteTable', {
vpc: myVpc,
});
const subnet = new SubnetV2(this, 'Subnet', {
vpc: myVpc,
availabilityZone: 'eu-west-2a',
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
subnetType: SubnetType.PRIVATE_ISOLATED });
const natgw = new NatGateway(this, 'NatGW', {
subnet: subnet,
vpc: myVpc,
connectivityType: NatConnectivityType.PRIVATE,
privateIpAddress: '10.0.0.42',
});
new Route(this, 'NatGwRoute', {
routeTable,
destination: '0.0.0.0/0',
target: { gateway: natgw },
});
Properties
Name | Type | Description |
---|---|---|
availability | string | Custom AZ for the subnet. |
ipv4 | Ip | ipv4 cidr to assign to this subnet. |
subnet | Subnet | The type of Subnet to configure. |
vpc | IVpc | VPC Prop. |
assign | boolean | Indicates whether a network interface created in this subnet receives an IPv6 address. |
ipv6 | Ip | Ipv6 CIDR Range for subnet. |
route | IRoute | Custom Route for subnet. |
subnet | string | Subnet name. |
availabilityZone
Type:
string
Custom AZ for the subnet.
ipv4CidrBlock
Type:
Ip
ipv4 cidr to assign to this subnet.
subnetType
Type:
Subnet
The type of Subnet to configure.
The Subnet type will control the ability to route and connect to the Internet.
TODO: Add validation check subnetType
when adding resources (e.g. cannot add NatGateway to private)
vpc
Type:
IVpc
VPC Prop.
assignIpv6AddressOnCreation?
Type:
boolean
(optional, default: undefined in case not provided as an input)
Indicates whether a network interface created in this subnet receives an IPv6 address.
If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.
ipv6CidrBlock?
Type:
Ip
(optional, default: No Ipv6 address)
Ipv6 CIDR Range for subnet.
routeTable?
Type:
IRoute
(optional, default: a default route table created)
Custom Route for subnet.
subnetName?
Type:
string
(optional, default: provisioned with an autogenerated name by CDK)
Subnet name.