Skip to content

Commit c64cccb

Browse files
authored
feat(ec2): add missing endpoints to InterfaceVpcEndpointAwsService (#21401)
This add the following endpoints to `InterfaceVpcEndpointAwsService`: `codeartifact.api` `codeartifact.respositories` `batch` `autoscaling` `autoscaling-plan` `application-autoscaling` closes #21402 #21220 #21338 #19420 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent de7d825 commit c64cccb

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,14 @@ export class InterfaceVpcEndpointService implements IInterfaceVpcEndpointService
260260
export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointService {
261261
public static readonly SAGEMAKER_NOTEBOOK = new InterfaceVpcEndpointAwsService('notebook', 'aws.sagemaker');
262262
public static readonly ATHENA = new InterfaceVpcEndpointAwsService('athena');
263+
public static readonly APPLICATION_AUTOSCALING = new InterfaceVpcEndpointAwsService('application-autoscaling');
264+
public static readonly AUTOSCALING = new InterfaceVpcEndpointAwsService('autoscaling');
265+
public static readonly AUTOSCALING_PLANS = new InterfaceVpcEndpointAwsService('autoscaling-plans');
266+
public static readonly BATCH = new InterfaceVpcEndpointAwsService('batch');
263267
public static readonly CLOUDFORMATION = new InterfaceVpcEndpointAwsService('cloudformation');
264268
public static readonly CLOUDTRAIL = new InterfaceVpcEndpointAwsService('cloudtrail');
269+
public static readonly CODEARTIFACT_API = new InterfaceVpcEndpointAwsService('codeartifact.api');
270+
public static readonly CODEARTIFACT_REPOSITORIES = new InterfaceVpcEndpointAwsService('codeartifact.repositories');
265271
public static readonly CODEBUILD = new InterfaceVpcEndpointAwsService('codebuild');
266272
public static readonly CODEBUILD_FIPS = new InterfaceVpcEndpointAwsService('codebuild-fips');
267273
public static readonly CODECOMMIT = new InterfaceVpcEndpointAwsService('codecommit');
@@ -294,6 +300,7 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
294300
public static readonly CLOUDWATCH = new InterfaceVpcEndpointAwsService('monitoring');
295301
public static readonly RDS = new InterfaceVpcEndpointAwsService('rds');
296302
public static readonly RDS_DATA = new InterfaceVpcEndpointAwsService('rds-data');
303+
public static readonly S3 = new InterfaceVpcEndpointAwsService('s3');
297304
public static readonly SAGEMAKER_API = new InterfaceVpcEndpointAwsService('sagemaker.api');
298305
public static readonly SAGEMAKER_RUNTIME = new InterfaceVpcEndpointAwsService('sagemaker.runtime');
299306
public static readonly SAGEMAKER_RUNTIME_FIPS = new InterfaceVpcEndpointAwsService('sagemaker.runtime-fips');

packages/@aws-cdk/aws-ec2/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,17 @@
260260
"docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.DYNAMODB",
261261
"docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.S3",
262262
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APIGATEWAY",
263+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPLICATION_AUTOSCALING",
264+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING",
265+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING_PLANS",
263266
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ATHENA",
264267
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDFORMATION",
265268
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDTRAIL",
266269
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH",
267270
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_EVENTS",
268271
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_LOGS",
272+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_API",
273+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_REPOSITORIES",
269274
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD",
270275
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD_FIPS",
271276
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT",
@@ -276,6 +281,7 @@
276281
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEGURU_REVIEWER",
277282
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEPIPELINE",
278283
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONFIG",
284+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BATCH",
279285
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2",
280286
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2_MESSAGES",
281287
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECR",
@@ -294,6 +300,7 @@
294300
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KMS",
295301
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS",
296302
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS_DATA",
303+
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.S3",
297304
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_API",
298305
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_NOTEBOOK",
299306
"docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME",

packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ describe('vpc endpoint', () => {
734734

735735

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

752753

753754
});
755+
756+
test('test codeartifact vpc interface endpoint in us-west-2', () => {
757+
//GIVEN
758+
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
759+
const vpc = new Vpc(stack, 'VPC');
760+
761+
//WHEN
762+
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
763+
service: InterfaceVpcEndpointAwsService.CODEARTIFACT_API,
764+
});
765+
766+
vpc.addInterfaceEndpoint('CodeArtifact Repositories Endpoint', {
767+
service: InterfaceVpcEndpointAwsService.CODEARTIFACT_REPOSITORIES,
768+
});
769+
770+
//THEN
771+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
772+
ServiceName: 'com.amazonaws.us-west-2.codeartifact.repositories',
773+
});
774+
775+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
776+
ServiceName: 'com.amazonaws.us-west-2.codeartifact.api',
777+
});
778+
779+
});
780+
781+
test('test s3 vpc interface endpoint in us-west-2', () => {
782+
//GIVEN
783+
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
784+
const vpc = new Vpc(stack, 'VPC');
785+
786+
//WHEN
787+
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
788+
service: InterfaceVpcEndpointAwsService.S3,
789+
});
790+
791+
//THEN
792+
793+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
794+
ServiceName: 'com.amazonaws.us-west-2.s3',
795+
});
796+
797+
});
798+
799+
test('test batch vpc interface endpoint in us-west-2', () => {
800+
//GIVEN
801+
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
802+
const vpc = new Vpc(stack, 'VPC');
803+
804+
//WHEN
805+
vpc.addInterfaceEndpoint('CodeArtifact API Endpoint', {
806+
service: InterfaceVpcEndpointAwsService.BATCH,
807+
});
808+
809+
//THEN
810+
811+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
812+
ServiceName: 'com.amazonaws.us-west-2.batch',
813+
});
814+
815+
});
816+
817+
test('test autoscaling vpc interface endpoint in us-west-2', () => {
818+
//GIVEN
819+
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-west-2' } });
820+
const vpc = new Vpc(stack, 'VPC');
821+
822+
//WHEN
823+
vpc.addInterfaceEndpoint('Autoscaling API Endpoint', {
824+
service: InterfaceVpcEndpointAwsService.AUTOSCALING,
825+
});
826+
827+
vpc.addInterfaceEndpoint('Autoscaling-plan API Endpoint', {
828+
service: InterfaceVpcEndpointAwsService.AUTOSCALING_PLANS,
829+
});
830+
831+
vpc.addInterfaceEndpoint('Application-Autoscaling API Endpoint', {
832+
service: InterfaceVpcEndpointAwsService.APPLICATION_AUTOSCALING,
833+
});
834+
835+
//THEN
836+
837+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
838+
ServiceName: 'com.amazonaws.us-west-2.autoscaling',
839+
});
840+
841+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
842+
ServiceName: 'com.amazonaws.us-west-2.autoscaling-plans',
843+
});
844+
845+
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
846+
ServiceName: 'com.amazonaws.us-west-2.application-autoscaling',
847+
});
848+
});
754849
});
755850
});

0 commit comments

Comments
 (0)