Skip to content
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,14 @@ export class InterfaceVpcEndpointService implements IInterfaceVpcEndpointService
export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointService {
public static readonly SAGEMAKER_NOTEBOOK = new InterfaceVpcEndpointAwsService('notebook', 'aws.sagemaker');
public static readonly ATHENA = new InterfaceVpcEndpointAwsService('athena');
public static readonly APPLICATION_AUTOSCALING = new InterfaceVpcEndpointAwsService('application-autoscaling');
public static readonly AUTOSCALING = new InterfaceVpcEndpointAwsService('autoscaling');
public static readonly AUTOSCALING_PLANS = new InterfaceVpcEndpointAwsService('autoscaling-plans');
public static readonly BATCH = new InterfaceVpcEndpointAwsService('batch');
public static readonly CLOUDFORMATION = new InterfaceVpcEndpointAwsService('cloudformation');
public static readonly CLOUDTRAIL = new InterfaceVpcEndpointAwsService('cloudtrail');
public static readonly CODEARTIFACT_API = new InterfaceVpcEndpointAwsService('codeartifact.api');
public static readonly CODEARTIFACT_REPOSITORIES = new InterfaceVpcEndpointAwsService('codeartifact.repositories');
public static readonly CODEBUILD = new InterfaceVpcEndpointAwsService('codebuild');
public static readonly CODEBUILD_FIPS = new InterfaceVpcEndpointAwsService('codebuild-fips');
public static readonly CODECOMMIT = new InterfaceVpcEndpointAwsService('codecommit');
Expand Down Expand Up @@ -294,6 +300,7 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly CLOUDWATCH = new InterfaceVpcEndpointAwsService('monitoring');
public static readonly RDS = new InterfaceVpcEndpointAwsService('rds');
public static readonly RDS_DATA = new InterfaceVpcEndpointAwsService('rds-data');
public static readonly S3 = new InterfaceVpcEndpointAwsService('s3');
public static readonly SAGEMAKER_API = new InterfaceVpcEndpointAwsService('sagemaker.api');
public static readonly SAGEMAKER_RUNTIME = new InterfaceVpcEndpointAwsService('sagemaker.runtime');
public static readonly SAGEMAKER_RUNTIME_FIPS = new InterfaceVpcEndpointAwsService('sagemaker.runtime-fips');
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-ec2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,17 @@
"docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.DYNAMODB",
"docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.S3",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APIGATEWAY",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPLICATION_AUTOSCALING",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING_PLANS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ATHENA",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDFORMATION",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDTRAIL",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_EVENTS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_LOGS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_API",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_REPOSITORIES",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD_FIPS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT",
Expand All @@ -276,6 +281,7 @@
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEGURU_REVIEWER",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEPIPELINE",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONFIG",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BATCH",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2_MESSAGES",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECR",
Expand All @@ -294,6 +300,7 @@
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KMS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS_DATA",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.S3",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_API",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_NOTEBOOK",
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME",
Expand Down
95 changes: 95 additions & 0 deletions packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ describe('vpc endpoint', () => {


});

test('test vpc interface endpoint for transcribe can be created correctly in cn-northwest-1', () => {
//GIVEN
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'cn-northwest-1' } });
Expand All @@ -751,5 +752,99 @@ describe('vpc endpoint', () => {


});

test('test codeartifact vpc interface endpoint in us-west-2', () => {
//GIVEN
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
const vpc = new Vpc(stack, 'VPC');

//WHEN
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
service: InterfaceVpcEndpointAwsService.CODEARTIFACT_API,
});

vpc.addInterfaceEndpoint('CodeArtifact Repositories Endpoint', {
service: InterfaceVpcEndpointAwsService.CODEARTIFACT_REPOSITORIES,
});

//THEN
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.codeartifact.repositories',
});

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.codeartifact.api',
});

});

test('test s3 vpc interface endpoint in us-west-2', () => {
//GIVEN
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
const vpc = new Vpc(stack, 'VPC');

//WHEN
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
service: InterfaceVpcEndpointAwsService.S3,
});

//THEN

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.s3',
});

});

test('test batch vpc interface endpoint in us-west-2', () => {
//GIVEN
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
const vpc = new Vpc(stack, 'VPC');

//WHEN
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
service: InterfaceVpcEndpointAwsService.BATCH,
});

//THEN

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.batch',
});

});

test('test autoscaling vpc interface endpoint in us-west-2', () => {
//GIVEN
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
const vpc = new Vpc(stack, 'VPC');

//WHEN
vpc.addInterfaceEndpoint('Autoscaling API Endpoint', {
service: InterfaceVpcEndpointAwsService.AUTOSCALING,
});

vpc.addInterfaceEndpoint('Autoscaling-plan API Endpoint', {
service: InterfaceVpcEndpointAwsService.AUTOSCALING_PLANS,
});

vpc.addInterfaceEndpoint('Application-Autoscaling API Endpoint', {
service: InterfaceVpcEndpointAwsService.APPLICATION_AUTOSCALING,
});

//THEN

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.autoscaling',
});

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.autoscaling-plans',
});

Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
ServiceName: 'com.amazonaws.us-west-2.application-autoscaling',
});
});
});
});