Skip to content
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
public static readonly ATHENA = new InterfaceVpcEndpointAwsService('athena');
public static readonly CLOUDFORMATION = new InterfaceVpcEndpointAwsService('cloudformation');
public static readonly CLOUDTRAIL = new InterfaceVpcEndpointAwsService('cloudtrail');
/**
* Creates an endpoint to com.amazonaws._region_.codeartifact.api
*/
public static readonly CODEARTIFACT_API = new InterfaceVpcEndpointAwsService('codeartifact.api');
/**
* Creates an endpoint to com.amazonaws._region_.codeartifact.repositories
*/
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 +302,10 @@ 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');
/**
* Creates an endpoint to com.amazonaws._region_.s3
*/
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
44 changes: 44 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,48 @@ 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',
});

});
});
});