# VpcSubnet

A subnet representation that the VPC provider uses.

- Source: [`cx-api/lib/legacy-moved.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/cx-api/lib/legacy-moved.ts#L858)
- Type last changed: v2.238.0 · 9 Feb 2026

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
};
```

Golang:

```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

- `availabilityZone`: string (required) — The code of the availability zone this subnet is in (for example, 'us-west-2a').

- `cidr`: string — CIDR range of the subnet.

  **Default:** CIDR information not available

- `routeTableId`: string (required) — The identifier of the route table for this subnet.

- `subnetId`: string (required) — The identifier of the subnet.
