diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index 85c77c4395c96..ccb23517c4ff6 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -316,10 +316,15 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ public static readonly XRAY = new InterfaceVpcEndpointAwsService('xray'); /** - * The name of the service. + * The name of the service. e.g. com.amazonaws.us-east-1.ecs */ public readonly name: string; + /** + * The short name of the service. e.g. ecs + */ + public readonly shortName: string; + /** * The port of the service. */ @@ -348,6 +353,7 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ }); this.name = `${prefix || defaultEndpointPrefix}.${region}.${name}${defaultEndpointSuffix}`; + this.shortName = name; this.port = port || 443; } diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts index 9baa7c9e7e437..7ad9568478b51 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -268,6 +268,13 @@ describe('vpc endpoint', () => { }); + describe('interface endpoint retains service name in shortName property', () => { + test('shortName property', () => { + expect(InterfaceVpcEndpointAwsService.ECS.shortName).toBe('ecs'); + expect(InterfaceVpcEndpointAwsService.ECR_DOCKER.shortName).toBe('ecr.dkr'); + }); + }); + describe('add interface endpoint to looked-up VPC', () => { test('initial run', () => { // GIVEN