# VpcContextResponse

Properties of a discovered VPC.

- 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#L902)
- 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 vpcContextResponse: cx_api.VpcContextResponse = {
  availabilityZones: ['availabilityZones'],
  vpcId: 'vpcId',

  // the properties below are optional
  isolatedSubnetIds: ['isolatedSubnetIds'],
  isolatedSubnetNames: ['isolatedSubnetNames'],
  isolatedSubnetRouteTableIds: ['isolatedSubnetRouteTableIds'],
  ownerAccountId: 'ownerAccountId',
  privateSubnetIds: ['privateSubnetIds'],
  privateSubnetNames: ['privateSubnetNames'],
  privateSubnetRouteTableIds: ['privateSubnetRouteTableIds'],
  publicSubnetIds: ['publicSubnetIds'],
  publicSubnetNames: ['publicSubnetNames'],
  publicSubnetRouteTableIds: ['publicSubnetRouteTableIds'],
  region: 'region',
  subnetGroups: [{
    name: 'name',
    subnets: [{
      availabilityZone: 'availabilityZone',
      routeTableId: 'routeTableId',
      subnetId: 'subnetId',

      // the properties below are optional
      cidr: 'cidr',
    }],
    type: cx_api.VpcSubnetGroupType.PUBLIC,
  }],
  vpcCidrBlock: 'vpcCidrBlock',
  vpnGatewayId: 'vpnGatewayId',
};
```

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_context_response = cx_api.VpcContextResponse(
    availability_zones=["availabilityZones"],
    vpc_id="vpcId",

    # the properties below are optional
    isolated_subnet_ids=["isolatedSubnetIds"],
    isolated_subnet_names=["isolatedSubnetNames"],
    isolated_subnet_route_table_ids=["isolatedSubnetRouteTableIds"],
    owner_account_id="ownerAccountId",
    private_subnet_ids=["privateSubnetIds"],
    private_subnet_names=["privateSubnetNames"],
    private_subnet_route_table_ids=["privateSubnetRouteTableIds"],
    public_subnet_ids=["publicSubnetIds"],
    public_subnet_names=["publicSubnetNames"],
    public_subnet_route_table_ids=["publicSubnetRouteTableIds"],
    region="region",
    subnet_groups=[cx_api.VpcSubnetGroup(
        name="name",
        subnets=[cx_api.VpcSubnet(
            availability_zone="availabilityZone",
            route_table_id="routeTableId",
            subnet_id="subnetId",

            # the properties below are optional
            cidr="cidr"
        )],
        type=cx_api.VpcSubnetGroupType.PUBLIC
    )],
    vpc_cidr_block="vpcCidrBlock",
    vpn_gateway_id="vpnGatewayId"
)
```

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.*;

VpcContextResponse vpcContextResponse = VpcContextResponse.builder()
        .availabilityZones(List.of("availabilityZones"))
        .vpcId("vpcId")

        // the properties below are optional
        .isolatedSubnetIds(List.of("isolatedSubnetIds"))
        .isolatedSubnetNames(List.of("isolatedSubnetNames"))
        .isolatedSubnetRouteTableIds(List.of("isolatedSubnetRouteTableIds"))
        .ownerAccountId("ownerAccountId")
        .privateSubnetIds(List.of("privateSubnetIds"))
        .privateSubnetNames(List.of("privateSubnetNames"))
        .privateSubnetRouteTableIds(List.of("privateSubnetRouteTableIds"))
        .publicSubnetIds(List.of("publicSubnetIds"))
        .publicSubnetNames(List.of("publicSubnetNames"))
        .publicSubnetRouteTableIds(List.of("publicSubnetRouteTableIds"))
        .region("region")
        .subnetGroups(List.of(VpcSubnetGroup.builder()
                .name("name")
                .subnets(List.of(VpcSubnet.builder()
                        .availabilityZone("availabilityZone")
                        .routeTableId("routeTableId")
                        .subnetId("subnetId")

                        // the properties below are optional
                        .cidr("cidr")
                        .build()))
                .type(VpcSubnetGroupType.PUBLIC)
                .build()))
        .vpcCidrBlock("vpcCidrBlock")
        .vpnGatewayId("vpnGatewayId")
        .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 vpcContextResponse = new VpcContextResponse {
    AvailabilityZones = new [] { "availabilityZones" },
    VpcId = "vpcId",

    // the properties below are optional
    IsolatedSubnetIds = new [] { "isolatedSubnetIds" },
    IsolatedSubnetNames = new [] { "isolatedSubnetNames" },
    IsolatedSubnetRouteTableIds = new [] { "isolatedSubnetRouteTableIds" },
    OwnerAccountId = "ownerAccountId",
    PrivateSubnetIds = new [] { "privateSubnetIds" },
    PrivateSubnetNames = new [] { "privateSubnetNames" },
    PrivateSubnetRouteTableIds = new [] { "privateSubnetRouteTableIds" },
    PublicSubnetIds = new [] { "publicSubnetIds" },
    PublicSubnetNames = new [] { "publicSubnetNames" },
    PublicSubnetRouteTableIds = new [] { "publicSubnetRouteTableIds" },
    Region = "region",
    SubnetGroups = new [] { new VpcSubnetGroup {
        Name = "name",
        Subnets = new [] { new VpcSubnet {
            AvailabilityZone = "availabilityZone",
            RouteTableId = "routeTableId",
            SubnetId = "subnetId",

            // the properties below are optional
            Cidr = "cidr"
        } },
        Type = VpcSubnetGroupType.PUBLIC
    } },
    VpcCidrBlock = "vpcCidrBlock",
    VpnGatewayId = "vpnGatewayId"
};
```

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"

vpcContextResponse := &VpcContextResponse{
	AvailabilityZones: []*string{
		jsii.String("availabilityZones"),
	},
	VpcId: jsii.String("vpcId"),

	// the properties below are optional
	IsolatedSubnetIds: []*string{
		jsii.String("isolatedSubnetIds"),
	},
	IsolatedSubnetNames: []*string{
		jsii.String("isolatedSubnetNames"),
	},
	IsolatedSubnetRouteTableIds: []*string{
		jsii.String("isolatedSubnetRouteTableIds"),
	},
	OwnerAccountId: jsii.String("ownerAccountId"),
	PrivateSubnetIds: []*string{
		jsii.String("privateSubnetIds"),
	},
	PrivateSubnetNames: []*string{
		jsii.String("privateSubnetNames"),
	},
	PrivateSubnetRouteTableIds: []*string{
		jsii.String("privateSubnetRouteTableIds"),
	},
	PublicSubnetIds: []*string{
		jsii.String("publicSubnetIds"),
	},
	PublicSubnetNames: []*string{
		jsii.String("publicSubnetNames"),
	},
	PublicSubnetRouteTableIds: []*string{
		jsii.String("publicSubnetRouteTableIds"),
	},
	Region: jsii.String("region"),
	SubnetGroups: []VpcSubnetGroup{
		&VpcSubnetGroup{
			Name: jsii.String("name"),
			Subnets: []VpcSubnet{
				&VpcSubnet{
					AvailabilityZone: jsii.String("availabilityZone"),
					RouteTableId: jsii.String("routeTableId"),
					SubnetId: jsii.String("subnetId"),

					// the properties below are optional
					Cidr: jsii.String("cidr"),
				},
			},
			Type: awscdk.Cx_api.VpcSubnetGroupType_PUBLIC,
		},
	},
	VpcCidrBlock: jsii.String("vpcCidrBlock"),
	VpnGatewayId: jsii.String("vpnGatewayId"),
}
```

## Properties

- `availabilityZones`: string[] (required) — AZs.

- `isolatedSubnetIds`: string[] — IDs of all isolated subnets.

  Element count: #(availabilityZones) · #(isolatedGroups)

- `isolatedSubnetNames`: string[] — Name of isolated subnet groups.

  Element count: #(isolatedGroups)

- `isolatedSubnetRouteTableIds`: string[] — Route Table IDs of isolated subnet groups.

  Element count: #(availabilityZones) · #(isolatedGroups)

- `ownerAccountId`: string — The ID of the AWS account that owns the VPC.

  **Default:** the account id of the parent stack

- `privateSubnetIds`: string[] — IDs of all private subnets.

  Element count: #(availabilityZones) · #(privateGroups)

- `privateSubnetNames`: string[] — Name of private subnet groups.

  Element count: #(privateGroups)

- `privateSubnetRouteTableIds`: string[] — Route Table IDs of private subnet groups.

  Element count: #(availabilityZones) · #(privateGroups)

- `publicSubnetIds`: string[] — IDs of all public subnets.

  Element count: #(availabilityZones) · #(publicGroups)

- `publicSubnetNames`: string[] — Name of public subnet groups.

  Element count: #(publicGroups)

- `publicSubnetRouteTableIds`: string[] — Route Table IDs of public subnet groups.

  Element count: #(availabilityZones) · #(publicGroups)

- `region`: string — The region in which the VPC is in.

  **Default:** Region of the parent stack

- `subnetGroups`: [VpcSubnetGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.cx_api.VpcSubnetGroup.html)[] — The subnet groups discovered for the given VPC.

  **Default:** no subnet groups will be returned unless `VpcContextQuery.returnAsymmetricSubnets` is true

  Unlike the above properties, this will include asymmetric subnets,
  if the VPC has any.
  This property will only be populated if `VpcContextQuery.returnAsymmetricSubnets`
  is true.

- `vpcCidrBlock`: string — VPC cidr.

  **Default:** CIDR information not available

- `vpcId`: string (required) — VPC id.

- `vpnGatewayId`: string — The VPN gateway ID.
