From ec1c053000e0a1ff3d3b0c7bd5a5b40112eca2fc Mon Sep 17 00:00:00 2001 From: Mike Dreyfus Date: Sun, 31 Jul 2022 23:53:19 -0700 Subject: [PATCH 1/5] adding code artifact endpoints --- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 8 +++++++ .../aws-ec2/test/vpc-endpoint.test.ts | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index ccb23517c4ff6..17be4fe13694a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -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'); 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 7ad9568478b51..81ae03442877a 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -750,6 +750,30 @@ describe('vpc endpoint', () => { }); + }); + test('test codeartifact vpc interface endpoint', () => { + //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', + }); + }); }); }); From 4aa5e4317ae025551604e1d9038bb54e6076bd11 Mon Sep 17 00:00:00 2001 From: Mike Dreyfus Date: Mon, 1 Aug 2022 09:48:20 -0700 Subject: [PATCH 2/5] adding s3 endpoint and test --- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 4 ++++ .../aws-ec2/test/vpc-endpoint.test.ts | 22 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index 17be4fe13694a..964ffb92312ea 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -302,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'); 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 81ae03442877a..7c93ccd98581c 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -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' } }); @@ -751,7 +752,8 @@ describe('vpc endpoint', () => { }); - test('test codeartifact vpc interface 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'); @@ -775,5 +777,23 @@ describe('vpc endpoint', () => { }); }); + + 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', + }); + + }); }); }); From 70f1abed698ca005fd388413989390c1560b6cea Mon Sep 17 00:00:00 2001 From: Mike Dreyfus Date: Mon, 1 Aug 2022 10:40:49 -0700 Subject: [PATCH 3/5] made consistent with other entries --- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 9 --------- packages/@aws-cdk/aws-ec2/package.json | 3 +++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index 964ffb92312ea..97e9b627ff99e 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -262,13 +262,7 @@ 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'); @@ -302,9 +296,6 @@ 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'); diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index 9c0a81de000a0..baf0d73f61fcb 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -266,6 +266,8 @@ "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", @@ -294,6 +296,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", From c8c6d503174437b7bbbf788928b1eb1f7cbd7d0f Mon Sep 17 00:00:00 2001 From: Mike Dreyfus Date: Mon, 1 Aug 2022 11:36:27 -0700 Subject: [PATCH 4/5] added Batch --- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 1 + packages/@aws-cdk/aws-ec2/package.json | 1 + .../@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index 97e9b627ff99e..632011f8335f7 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -260,6 +260,7 @@ 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 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'); diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index baf0d73f61fcb..ddbb69adbc067 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -278,6 +278,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", 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 7c93ccd98581c..664b0bb08f9d3 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -795,5 +795,23 @@ describe('vpc endpoint', () => { }); }); + + 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', + }); + + }); }); }); From ada23fcb9b31ef1f591da36e3d9ad52562af8cee Mon Sep 17 00:00:00 2001 From: Mike Dreyfus Date: Mon, 1 Aug 2022 11:50:06 -0700 Subject: [PATCH 5/5] added autoscaling endpoints --- packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts | 3 ++ packages/@aws-cdk/aws-ec2/package.json | 3 ++ .../aws-ec2/test/vpc-endpoint.test.ts | 33 +++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts index 632011f8335f7..b2ce23975af8a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts @@ -260,6 +260,9 @@ 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'); diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index ddbb69adbc067..a155c4d6bd249 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -260,6 +260,9 @@ "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", 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 664b0bb08f9d3..df65f805670c8 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts @@ -813,5 +813,38 @@ describe('vpc endpoint', () => { }); }); + + 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', + }); + }); }); });