Skip to content
v2.278.0

GatewayVpcEndpointOptions Struct ​

Options to add a gateway endpoint to a VPC.

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,
});
python
# Interface endpoint with IPv6
vpc.add_interface_endpoint("ExampleEndpoint",
    service=ec2.InterfaceVpcEndpointAwsService.ECR,
    ip_address_type=ec2.VpcEndpointIpAddressType.IPV6,
    dns_record_ip_type=ec2.VpcEndpointDnsRecordIpType.IPV6
)

# Gateway endpoint with dualstack
vpc.add_gateway_endpoint("S3DualstackEndpoint",
    service=ec2.GatewayVpcEndpointAwsService.S3,
    ip_address_type=ec2.VpcEndpointIpAddressType.DUALSTACK,
    dns_record_ip_type=ec2.VpcEndpointDnsRecordIpType.DUALSTACK
)
java
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint("ExampleEndpoint", InterfaceVpcEndpointOptions.builder()
        .service(InterfaceVpcEndpointAwsService.ECR)
        .ipAddressType(VpcEndpointIpAddressType.IPV6)
        .dnsRecordIpType(VpcEndpointDnsRecordIpType.IPV6)
        .build());

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint("S3DualstackEndpoint", GatewayVpcEndpointOptions.builder()
        .service(GatewayVpcEndpointAwsService.S3)
        .ipAddressType(VpcEndpointIpAddressType.DUALSTACK)
        .dnsRecordIpType(VpcEndpointDnsRecordIpType.DUALSTACK)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Interface endpoint with IPv6
vpc.AddInterfaceEndpoint("ExampleEndpoint", new InterfaceVpcEndpointOptions {
    Service = InterfaceVpcEndpointAwsService.ECR,
    IpAddressType = VpcEndpointIpAddressType.IPV6,
    DnsRecordIpType = VpcEndpointDnsRecordIpType.IPV6
});

// Gateway endpoint with dualstack
vpc.AddGatewayEndpoint("S3DualstackEndpoint", new GatewayVpcEndpointOptions {
    Service = GatewayVpcEndpointAwsService.S3,
    IpAddressType = VpcEndpointIpAddressType.DUALSTACK,
    DnsRecordIpType = VpcEndpointDnsRecordIpType.DUALSTACK
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Interface endpoint with IPv6
vpc.addInterfaceEndpoint(jsii.String("ExampleEndpoint"), &InterfaceVpcEndpointOptions{
	Service: ec2.InterfaceVpcEndpointAwsService_ECR(),
	IpAddressType: ec2.VpcEndpointIpAddressType_IPV6,
	DnsRecordIpType: ec2.VpcEndpointDnsRecordIpType_IPV6,
})

// Gateway endpoint with dualstack
vpc.addGatewayEndpoint(jsii.String("S3DualstackEndpoint"), &GatewayVpcEndpointOptions{
	Service: ec2.GatewayVpcEndpointAwsService_S3(),
	IpAddressType: ec2.VpcEndpointIpAddressType_DUALSTACK,
	DnsRecordIpType: ec2.VpcEndpointDnsRecordIpType_DUALSTACK,
})

Properties ​

dnsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypedns_record_ip_typeoptionalVpcEndpointDnsRecordIpTypednsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypeDnsRecordIpTypeoptionalVpcEndpointDnsRecordIpTypeDnsRecordIpTypeoptionalVpcEndpointDnsRecordIpType #
Type of DNS records created for the VPC endpoint.

Default: not specified

ipAddressTypeoptionalVpcEndpointIpAddressTypeip_address_typeoptionalVpcEndpointIpAddressTypeipAddressTypeoptionalVpcEndpointIpAddressTypeIpAddressTypeoptionalVpcEndpointIpAddressTypeIpAddressTypeoptionalVpcEndpointIpAddressType #
The IP address type for the endpoint.

Default: not specified

The service to use for this gateway VPC endpoint.
subnetsoptionalSubnetSelection[]subnetsoptionaltyping.List[SubnetSelection]subnetsoptionalList<SubnetSelection>SubnetsoptionalSubnetSelection[]Subnetsoptional*[]SubnetSelection #
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.

example
ts
declare const vpc: ec2.Vpc;

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