From ad425d004dd9154c367622733e2a2e36a38f1cef Mon Sep 17 00:00:00 2001 From: Derek Chen-Becker <61260622+dchenbec@users.noreply.github.com> Date: Fri, 3 Sep 2021 11:09:20 -0600 Subject: [PATCH] feat(ec2): vpc endpoint for aws keyspaces (#16306) Adds a static instance of InterfaceVpcEndpointAwsService for the AWS Keyspaces service so that users do not need to define it manually. Keyspaces uses a custom TCP port (9142), so this avoids confusion. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-ec2/README.md | 8 ++++++++ packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 1 + packages/@aws-cdk/aws-ec2/package.json | 1 + 3 files changed, 10 insertions(+) diff --git a/packages/@aws-cdk/aws-ec2/README.md b/packages/@aws-cdk/aws-ec2/README.md index 802b5fe9b3e0c..a9ac3794580b4 100644 --- a/packages/@aws-cdk/aws-ec2/README.md +++ b/packages/@aws-cdk/aws-ec2/README.md @@ -663,6 +663,14 @@ new InterfaceVpcEndpoint(stack, 'VPC Endpoint', { }); ``` +Pre-defined AWS services are defined in the [InterfaceVpcEndpointAwsService](lib/vpc-endpoint.ts) class, and can be used to +create VPC endpoints without having to configure name, ports, etc. For example, a Keyspaces endpoint can be created for +use in your VPC: + +``` ts +new InterfaceVpcEndpoint(stack, 'VPC Endpoint', { vpc, service: InterfaceVpcEndpointAwsService.KEYSPACES }); +``` + #### Security groups for interface VPC endpoints By default, interface VPC endpoints create a new security group and traffic is **not** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index f9cb70afea180..de64072868391 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -282,6 +282,7 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ public static readonly CODECOMMIT_GIT = new InterfaceVpcEndpointAwsService('git-codecommit'); public static readonly CODECOMMIT_GIT_FIPS = new InterfaceVpcEndpointAwsService('git-codecommit-fips'); public static readonly GLUE = new InterfaceVpcEndpointAwsService('glue'); + public static readonly KEYSPACES = new InterfaceVpcEndpointAwsService('cassandra', '', 9142); public static readonly KINESIS_STREAMS = new InterfaceVpcEndpointAwsService('kinesis-streams'); public static readonly KINESIS_FIREHOSE = new InterfaceVpcEndpointAwsService('kinesis-firehose'); public static readonly KMS = new InterfaceVpcEndpointAwsService('kms'); diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index 941d598075411..d7c8591357c7e 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -239,6 +239,7 @@ "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_INFERENCE_RUNTIME", "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_LOAD_BALANCING", "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GLUE", + "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KEYSPACES", "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KINESIS_STREAMS", "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KINESIS_FIREHOSE", "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KMS",