# ConnectionNetwork

VPC network placement for a Glue `Connection`.

A Glue connection targets a single subnet. Choose the placement with one of
the mutually-exclusive factories — an explicit subnet, or a VPC to select one
from — so a subnet paired with a VPC, or a subnet selection without a VPC,
cannot be expressed.

- Source: [`aws-glue/lib/connection.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-glue/lib/connection.ts#L264)
- Type last changed: v2.270.0 · 17 Sep 2026

## Example

```ts
declare const securityGroup: ec2.SecurityGroup;
declare const vpc: ec2.Vpc;
new glue.Connection(this, 'MyConnection', {
  type: glue.ConnectionType.NETWORK,
  securityGroups: [securityGroup],
  // vpcSubnets is optional - defaults to private subnets
  network: glue.ConnectionNetwork.vpc(vpc, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }),
});
```

## Methods

- `subnet(subnet: ISubnet): ConnectionNetwork // chainable` (static) — Pin the connection to a specific subnet.

  **Parameters**

  - `subnet` — the subnet the connection targets.

- `vpc(vpc: IVpc, vpcSubnets?: SubnetSelection): ConnectionNetwork // chainable` (static) — Select the connection's subnet from a VPC.

  Since a Glue connection targets
  a single subnet, the first subnet of the selection is used.

  **Parameters**

  - `vpc` — the VPC to select a subnet from.
  - `vpcSubnets` — which subnets to select from.
