Skip to content
v2.277.0

VpcSubnet Struct ​

A subnet representation that the VPC provider uses.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cx_api } from 'aws-cdk-lib';
const vpcSubnet: cx_api.VpcSubnet = {
  availabilityZone: 'availabilityZone',
  routeTableId: 'routeTableId',
  subnetId: 'subnetId',

  // the properties below are optional
  cidr: 'cidr',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cx_api

vpc_subnet = cx_api.VpcSubnet(
    availability_zone="availabilityZone",
    route_table_id="routeTableId",
    subnet_id="subnetId",

    # the properties below are optional
    cidr="cidr"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cxapi.*;

VpcSubnet vpcSubnet = VpcSubnet.builder()
        .availabilityZone("availabilityZone")
        .routeTableId("routeTableId")
        .subnetId("subnetId")

        // the properties below are optional
        .cidr("cidr")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.CXAPI;

var vpcSubnet = new VpcSubnet {
    AvailabilityZone = "availabilityZone",
    RouteTableId = "routeTableId",
    SubnetId = "subnetId",

    // the properties below are optional
    Cidr = "cidr"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

vpcSubnet := &VpcSubnet{
	AvailabilityZone: jsii.String("availabilityZone"),
	RouteTableId: jsii.String("routeTableId"),
	SubnetId: jsii.String("subnetId"),

	// the properties below are optional
	Cidr: jsii.String("cidr"),
}

Properties ​

availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*stringrequired#
The code of the availability zone this subnet is in (for example, 'us-west-2a').
cidroptionalstringcidroptionalstrcidroptionalStringCidroptionalstringCidroptional*string#
CIDR range of the subnet.

Default: CIDR information not available

routeTableIdstringroute_table_idstrrouteTableIdStringRouteTableIdstringRouteTableId*stringrequired#
The identifier of the route table for this subnet.
subnetIdstringsubnet_idstrsubnetIdStringSubnetIdstringSubnetId*stringrequired#
The identifier of the subnet.