# GatewayVpcEndpointOptions

Options to add a gateway endpoint to a VPC.

- Source: [`aws-ec2/lib/vpc-endpoint.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts#L227)
- Type last changed: v2.265.0 · 13 Aug 2026

## Example

```ts
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint('ExampleEndpoint', {
  service: ec2.InterfaceVpcEndpointAwsService.ECR,
  ipAddressType: ec2.VpcEndpointIpAddressType.IPV6,
  dnsRecordIpType: ec2.VpcEndpointDnsRecordIpType.IPV6,
});

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint('S3DualstackEndpoint', {
  service: ec2.GatewayVpcEndpointAwsService.S3,
  ipAddressType: ec2.VpcEndpointIpAddressType.DUALSTACK,
  dnsRecordIpType: ec2.VpcEndpointDnsRecordIpType.DUALSTACK,
});
```

## Properties

- `dnsRecordIpType`: [VpcEndpointDnsRecordIpType](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcEndpointDnsRecordIpType.html) — Type of DNS records created for the VPC endpoint.

  **Default:** not specified

- `ipAddressType`: [VpcEndpointIpAddressType](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.VpcEndpointIpAddressType.html) — The IP address type for the endpoint.

  **Default:** not specified

- `service`: [IGatewayVpcEndpointService](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IGatewayVpcEndpointService.html) (required) — The service to use for this gateway VPC endpoint.

- `subnets`: [SubnetSelection](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html)[] — Where to add endpoint routing.

  **Default:** All subnets in the VPC

  By default, this endpoint will be routable from all subnets in the VPC.
  Specify a list of subnet selection objects here to be more specific.

  ```ts
  declare const vpc: ec2.Vpc;

  vpc.addGatewayEndpoint('DynamoDbEndpoint', {
    service: ec2.GatewayVpcEndpointAwsService.DYNAMODB,
    // Add only to ISOLATED subnets
    subnets: [
      { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }
    ]
  });
  ```
