Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ec2): add support for vpc endpoints #2104

Merged
merged 27 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9052eb6
feat(ec2): add support for vpc endpoints
jogold Mar 26, 2019
3e794db
Merge branch 'master' into vpc-endpoint
jogold Mar 28, 2019
746507e
Add readonly
jogold Mar 28, 2019
2a29faa
Fix typo
jogold Mar 28, 2019
a8e827e
Convert VpcEndpointService to interface
jogold Mar 28, 2019
65293e4
IVpcEndpointService, JSDoc, README and integ test
jogold Mar 28, 2019
3a3f896
Merge branch 'master' into vpc-endpoint
jogold Mar 28, 2019
c799be0
Extend SubnetSelection
jogold Mar 28, 2019
625c5f4
Default port range and naming
jogold Mar 29, 2019
b07e2cb
Add policy support for interface endpoints
jogold Mar 29, 2019
5c3e0d2
Fix build
jogold Mar 29, 2019
a6f47c5
Merge branch 'master' into vpc-endpoint
jogold Mar 29, 2019
5293965
Merge branch 'master' into vpc-endpoint
jogold Apr 1, 2019
1688c67
Integrate codebuild vpc support
jogold Apr 1, 2019
af46e05
Rename creationTimestamp to vpcEndpointCreationTimestamp
jogold Apr 3, 2019
a3978aa
Deprecate subnetIds
jogold Apr 3, 2019
6235f31
Revert "Deprecate subnetIds"
jogold Apr 3, 2019
2758a05
Revert "Integrate codebuild vpc support"
jogold Apr 3, 2019
e2827d3
Revert "Extend SubnetSelection"
jogold Apr 3, 2019
8101b6b
Use subnetSelection[] and selectSubnetIds
jogold Apr 3, 2019
fd17299
Merge branch 'master' into vpc-endpoint
jogold Apr 8, 2019
f3811d6
Reinstate selectSubnets() but return a SOA instead of an AOS
rix0rrr Apr 8, 2019
394cd4e
Fix calls to subnetInternetDependencies
jogold Apr 8, 2019
c0fcd02
Error message
jogold Apr 8, 2019
6651dae
Fix onePerAz
jogold Apr 8, 2019
5f883b8
Add test for gateway endpoint with imported VPC
jogold Apr 8, 2019
f83acd9
Remove calls to selectSubnetIds
jogold Apr 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup
throw new Error(`Should have minCapacity (${minCapacity}) <= desiredCapacity (${desiredCapacity}) <= maxCapacity (${maxCapacity})`);
}

const subnetIds = props.vpc.subnetIds(props.vpcSubnets);
const subnetIds = props.vpc.selectSubnets(props.vpcSubnets).map(s => s.subnetId);
const asgProps: CfnAutoScalingGroupProps = {
cooldown: props.cooldownSeconds !== undefined ? `${props.cooldownSeconds}` : undefined,
minSize: minCapacity.toString(),
Expand All @@ -292,7 +292,7 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup
};

if (!props.vpc.isPublicSubnets(subnetIds) && props.associatePublicIpAddress) {
throw new Error("To set 'associatePublicIpAddress: true' you must select Public subnets (vpcSubnets: { subnetType: SubnetType.Public })");
throw new Error("To set 'associatePublicIpAddress: true' you must select Public subnets (vpcSubnets: { subnetTypes: [SubnetType.Public] })");
}

this.autoScalingGroup = new CfnAutoScalingGroup(this, 'ASG', asgProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export = {
maxCapacity: 0,
desiredCapacity: 0,

vpcSubnets: { subnetType: ec2.SubnetType.Public },
vpcSubnets: { subnetTypes: [ec2.SubnetType.Public] },
associatePublicIpAddress: true,
});

Expand Down
5 changes: 1 addition & 4 deletions packages/@aws-cdk/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,6 @@ export class Project extends ProjectBase {
});
this._securityGroups = [securityGroup];
}
const subnetSelection: ec2.SubnetSelection = props.subnetSelection ? props.subnetSelection : {
subnetType: ec2.SubnetType.Private
};
this.addToRoleInlinePolicy(new iam.PolicyStatement()
.addAllResources()
.addActions(
Expand All @@ -897,7 +894,7 @@ export class Project extends ProjectBase {
.addAction('ec2:CreateNetworkInterfacePermission'));
return {
vpcId: props.vpc.vpcId,
subnets: props.vpc.subnetIds(subnetSelection).map(s => s),
subnets: props.vpc.selectSubnets(props.subnetSelection).map(s => s.subnetId),
securityGroupIds: this._securityGroups.map(s => s.securityGroupId)
};
}
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,10 @@ const vpnConnection = vpc.addVpnConnection('Dynamic', {
});
const state = vpnConnection.metricTunnelState();
```

### VPC endpoints
A VPC endpoint enables you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC do not require public IP addresses to communicate with resources in the service. Traffic between your VPC and the other service does not leave the Amazon network.

Endpoints are virtual devices. They are horizontally scaled, redundant, and highly available VPC components that allow communication between instances in your VPC and services without imposing availability risks or bandwidth constraints on your network traffic.

[example of setting up VPC endpoints](test/integ.vpc-endpoint.lit.ts)
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-ec2/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from './vpc';
export * from './vpc-ref';
export * from './vpc-network-provider';
export * from './vpn';
export * from './vpc-endpoint';

// AWS::EC2 CloudFormation Resources:
export * from './ec2.generated';
Expand Down
Loading