Skip to content

Commit

Permalink
feat(ec2): add missing endpoints to InterfaceVpcEndpointAwsService (a…
Browse files Browse the repository at this point in the history
…ws#21401)

This add the following endpoints to `InterfaceVpcEndpointAwsService`:
`codeartifact.api`
`codeartifact.respositories`
`batch`
`autoscaling`
`autoscaling-plan`
`application-autoscaling`


closes aws#21402 aws#21220 aws#21338 aws#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*
  • Loading branch information
michaeldrey authored and josephedward committed Aug 30, 2022
1 parent 628c0a1 commit 5b272e5
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
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',
});
});
});
});

0 comments on commit 5b272e5

Please sign in to comment.