Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2-alpha/lib/ipam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class IpamPool extends Resource implements IIpamPool {
throw new Error('awsService is required when addressFamily is set to ipv6');
}

//Add tags to the IPAM Pool if name is provided
// Add tags to the IPAM Pool if name is provided
if (props.ipamPoolName) {
Tags.of(this).add(NAME_TAG, props.ipamPoolName);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ec2-alpha/lib/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ export class Route extends Resource implements IRouteV2 {
this.destination = props.destination;
const isDestinationIpv4 = NetworkUtils.validIp(props.destination);
if (!isDestinationIpv4) {
//TODO Validate for IPv6 CIDR range
// TODO Validate for IPv6 CIDR range
this.destinationIpv6Cidr = props.destination;
} else {
this.destinationIpv4Cidr = props.destination;
Expand All @@ -745,7 +745,7 @@ export class Route extends Resource implements IRouteV2 {
}
this.node.defaultChild = this.resource;

//Create a route only after target gateway or endpoint is created
// Create a route only after target gateway or endpoint is created
if (this.target.gateway) {
this.node.addDependency(this.target.gateway);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class SubnetV2 extends Resource implements ISubnetV2 {

overlap = validateOverlappingCidrRanges(props.vpc, props.ipv4CidrBlock.cidr);

//check whether VPC supports ipv6
// check whether VPC supports ipv6
if (props.ipv6CidrBlock?.cidr) {
validateSupportIpv6(props.vpc);
overlapIpv6 = validateOverlappingCidrRangesipv6(props.vpc, props.ipv6CidrBlock?.cidr);
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2-alpha/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*eslint no-bitwise: ["error", { "allow": ["~", "|", "<<", "&"] }] */
/* eslint no-bitwise: ["error", { "allow": ["~", "|", "<<", "&"] }] */

import { ISubnet } from 'aws-cdk-lib/aws-ec2';

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export abstract class VpcV2Base extends Resource implements IVpcV2 {
routeName: 'CDKDefaultIPv6Route',
});
}
//Add default route to IGW for IPv4
// Add default route to IGW for IPv4
new Route(this, `${subnet.node.id}-DefaultRoute`, {
routeTable: subnet.routeTable,
destination: options?.ipv4Destination ?? '0.0.0.0/0',
Expand Down
18 changes: 9 additions & 9 deletions packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export class VpcV2 extends VpcV2Base {
this.dnsSupportEnabled = props.enableDnsSupport == null ? true : props.enableDnsSupport;
const instanceTenancy = props.defaultInstanceTenancy || 'default';
this.resource = new CfnVPC(this, 'Resource', {
cidrBlock: vpcOptions.ipv4CidrBlock, //for Ipv4 addresses CIDR block
cidrBlock: vpcOptions.ipv4CidrBlock, // for Ipv4 addresses CIDR block
enableDnsHostnames: this.dnsHostnamesEnabled,
enableDnsSupport: this.dnsSupportEnabled,
ipv4IpamPoolId: vpcOptions.ipv4IpamPool?.ipamPoolId, // for Ipv4 ipam option
Expand All @@ -529,7 +529,7 @@ export class VpcV2 extends VpcV2Base {
}, this.stack);
this.region = this.stack.region;
this.ownerAccountId = this.stack.account;
//Add tag to the VPC with the name provided in properties
// Add tag to the VPC with the name provided in properties
Tags.of(this).add(NAME_TAG, props.vpcName || this.node.path);
if (props.secondaryAddressBlocks) {
const secondaryAddressBlocks: IIpAddresses[] = props.secondaryAddressBlocks;
Expand All @@ -544,7 +544,7 @@ export class VpcV2 extends VpcV2Base {
if (secondaryVpcOptions.amazonProvided || secondaryVpcOptions.ipv6IpamPool || secondaryVpcOptions.ipv6PoolId) {
this.useIpv6 = true;
}
//validate CIDR ranges per RFC 1918
// validate CIDR ranges per RFC 1918
if (secondaryVpcOptions.ipv4CidrBlock!) {
const ret = validateIpv4address(secondaryVpcOptions.ipv4CidrBlock, this.resource.cidrBlock);
if (ret === false) {
Expand All @@ -562,17 +562,17 @@ export class VpcV2 extends VpcV2Base {
ipv6NetmaskLength: secondaryVpcOptions.ipv6NetmaskLength,
ipv6IpamPoolId: secondaryVpcOptions.ipv6IpamPool?.ipamPoolId,
amazonProvidedIpv6CidrBlock: secondaryVpcOptions.amazonProvided,
//BYOIP IPv6 Address
// BYOIP IPv6 Address
ipv6CidrBlock: secondaryVpcOptions?.ipv6CidrBlock,
//BYOIP Pool for IPv6 address
// BYOIP Pool for IPv6 address
ipv6Pool: secondaryVpcOptions?.ipv6PoolId,
});
if (secondaryVpcOptions.dependencies) {
for (const dep of secondaryVpcOptions.dependencies) {
vpcCidrBlock.node.addDependency(dep);
}
}
//Create secondary blocks for Ipv4 and Ipv6
// Create secondary blocks for Ipv4 and Ipv6
this.secondaryCidrBlock?.push(vpcCidrBlock);
}
}
Expand Down Expand Up @@ -835,7 +835,7 @@ class VPCCidrBlock extends Resource implements IVPCCidrBlock {
public readonly amazonProvidedIpv6CidrBlock ?: boolean = props.amazonProvidedIpv6CidrBlock;
public readonly ipv6IpamPoolId ?: string = props.ipv6IpamPoolId;
public readonly ipv4IpamPoolId ?: string = props.ipv4IpamPoolId;
//BYOIP Pool Attributes
// BYOIP Pool Attributes
public readonly ipv6Pool?: string = props.ipv6Pool;
public readonly ipv6CidrBlock?: string = props.ipv6CidrBlock;
}
Expand Down Expand Up @@ -864,13 +864,13 @@ class VPCCidrBlock extends Resource implements IVPCCidrBlock {
this.ipv6IpamPoolId = props.ipv6IpamPoolId;
this.ipv4IpamPoolId = props.ipv4IpamPoolId;
this.amazonProvidedIpv6CidrBlock = props.amazonProvidedIpv6CidrBlock;
//BYOIP Pool and CIDR Block
// BYOIP Pool and CIDR Block
this.ipv6CidrBlock = props.ipv6CidrBlock;
this.ipv6Pool = props.ipv6Pool;
}
}

//@internal First two Octet to verify RFC 1918
// @internal First two Octet to verify RFC 1918
interface IPaddressConfig {
octet1: number;
octet2: number;
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.byoip-ipv6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const myVpc = new vpc_v2.VpcV2(stack, 'VPC-integ-test-1', {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.1.0.0/16'),
secondaryAddressBlocks: [
vpc_v2.IpAddresses.ipv6ByoipPool({
ipv6PoolId: 'ipv6pool-ec2-0a95217e154b65493', //To Be Replaced
ipv6PoolId: 'ipv6pool-ec2-0a95217e154b65493', // To Be Replaced
cidrBlockName: 'MyByoipIpv6Block',
ipv6CidrBlock: '2600:f0f0:8::/56', //To Be Replaced
ipv6CidrBlock: '2600:f0f0:8::/56', // To Be Replaced
}),
],
enableDnsHostnames: true,
Expand All @@ -33,7 +33,7 @@ const myVpc = new vpc_v2.VpcV2(stack, 'VPC-integ-test-1', {
new SubnetV2(stack, 'Subnet-integ-test-1', {
vpc: myVpc,
ipv4CidrBlock: new IpCidr('10.1.1.0/24'),
ipv6CidrBlock: new IpCidr('2600:f0f0:8:1::/64'), //To Be Replaced
ipv6CidrBlock: new IpCidr('2600:f0f0:8:1::/64'), // To Be Replaced
availabilityZone: 'us-west-2a',
subnetType: SubnetType.PRIVATE_ISOLATED,
});
Expand All @@ -44,7 +44,7 @@ new SubnetV2(stack, 'Subnet-integ-test-1', {
new SubnetV2(stack, 'Subnet-integ-test-2', {
vpc: myVpc,
ipv4CidrBlock: new IpCidr('10.1.0.0/24'),
ipv6CidrBlock: new IpCidr('2600:f0f0:8:0::/64'), //To Be Replaced
ipv6CidrBlock: new IpCidr('2600:f0f0:8:0::/64'), // To Be Replaced
availabilityZone: 'us-west-2a',
subnetType: SubnetType.PRIVATE_ISOLATED,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.ipam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ipam = new Ipam(stack, 'IpamTest', {
operatingRegion: ['us-west-2'],
});

/**Test Ipam Pool Ipv4 */
/** Test Ipam Pool Ipv4 */

const pool1 = ipam.privateScope.addPool('PrivatePool0', {
addressFamily: AddressFamily.IP_V4,
Expand Down Expand Up @@ -70,8 +70,8 @@ new SubnetV2(stack, 'testsbubnet', {
vpc,
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
//defined on the basis of allocation done in IPAM console
//ipv6CidrBlock: new Ipv6Cidr('2a05:d02c:25:4000::/60'),
// defined on the basis of allocation done in IPAM console
// ipv6CidrBlock: new Ipv6Cidr('2a05:d02c:25:4000::/60'),
subnetType: SubnetType.PRIVATE_ISOLATED,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AcceptorStack extends cdk.Stack {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.0.0.0/16'),
});

//Same account VPC peering
// Same account VPC peering
const requestorVpc = new vpc_v2.VpcV2(this, 'requestorVpcSameAccount', {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.1.0.0/16'),
});
Expand All @@ -60,7 +60,7 @@ class AcceptorStack extends cdk.Stack {
acceptorVpc: acceptorVpc,
});

//For cross-account peering connection
// For cross-account peering connection
acceptorVpc.createAcceptorVpcRole(account);
}
}
Expand All @@ -69,9 +69,9 @@ class RequestorStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

//Import acceptorVpc into the requestor stack, change vpcId after vpc is created using acceptorStack definition
// Import acceptorVpc into the requestor stack, change vpcId after vpc is created using acceptorStack definition
const acceptorVpc = vpc_v2.VpcV2.fromVpcV2Attributes(this, 'acceptorVpc', {
//Replace VPC Id before running integ test again
// Replace VPC Id before running integ test again
vpcId: 'vpc-09b9235d8a3195ba3',
vpcCidrBlock: '10.0.0.0/16',
region: 'us-east-1',
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ new SubnetV2(stack, 'testSubnet1', {
vpc,
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.1.0.0/20'),
//defined on the basis of allocation done in IPAM console
//ipv6CidrBlock: new Ipv6Cidr('2a05:d02c:25:4000::/60'),
// defined on the basis of allocation done in IPAM console
// ipv6CidrBlock: new Ipv6Cidr('2a05:d02c:25:4000::/60'),
subnetType: SubnetType.PRIVATE_ISOLATED,
});

/**Test compatibility with existing construct */
/** Test compatibility with existing construct */
new ec2.Instance(stack, 'Instance', {
vpc,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
Expand Down
26 changes: 13 additions & 13 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.test-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const stack = new cdk.Stack(app, 'vpcv2-import-integ-test', {
* according to the one alloted on creation
*/
const imported_new_vpc = VpcV2.VpcV2.fromVpcV2Attributes(stack, 'ImportedNewVPC', {
vpcId: 'vpc-08193db3ccc4f909f', //VPC id
vpcId: 'vpc-08193db3ccc4f909f', // VPC id
vpcCidrBlock: '10.1.0.0/16',
secondaryCidrBlocks: [{
cidrBlock: '10.2.0.0/16',
Expand All @@ -34,11 +34,11 @@ const imported_new_vpc = VpcV2.VpcV2.fromVpcV2Attributes(stack, 'ImportedNewVPC'
}],
subnets: [{
subnetName: 'IsolatedSubnet2',
subnetId: 'subnet-03cd773c0fe08ed26', //Subnet Id
subnetId: 'subnet-03cd773c0fe08ed26', // Subnet Id
subnetType: SubnetType.PRIVATE_ISOLATED,
availabilityZone: 'us-west-2a',
ipv4CidrBlock: '10.2.0.0/24',
routeTableId: 'rtb-0871c310f98da2cbb', //RouteTable id
routeTableId: 'rtb-0871c310f98da2cbb', // RouteTable id
}, {
subnetId: 'subnet-0fa477e01db27d820',
subnetType: SubnetType.PUBLIC,
Expand All @@ -48,22 +48,22 @@ const imported_new_vpc = VpcV2.VpcV2.fromVpcV2Attributes(stack, 'ImportedNewVPC'
}],
});

//Test to add new subnet to imported VPC against secondary range
// Test to add new subnet to imported VPC against secondary range
new SubnetV2(stack, 'AddnewImportedSubnet', {
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.2.2.0/24'),
//can be uncommented and modified after allocation is done using Amazon Provided Ipv6
//ipv6CidrBlock: new IpCidr('2600:1f14:b1d:6500::/64'),
// can be uncommented and modified after allocation is done using Amazon Provided Ipv6
// ipv6CidrBlock: new IpCidr('2600:1f14:b1d:6500::/64'),
vpc: imported_new_vpc,
subnetType: SubnetType.PUBLIC,
});

//Test to add new subnet to imported VPC against secondary range
// Test to add new subnet to imported VPC against secondary range
new SubnetV2(stack, 'AddnewImportedSubnet2', {
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.3.2.0/24'),
//can be uncommented and modified after allocation is done using Amazon Provided Ipv6
//ipv6CidrBlock: new IpCidr('2600:1f14:b1d:6500::/64'),
// can be uncommented and modified after allocation is done using Amazon Provided Ipv6
// ipv6CidrBlock: new IpCidr('2600:1f14:b1d:6500::/64'),
vpc: imported_new_vpc,
subnetType: SubnetType.PUBLIC,
});
Expand All @@ -76,7 +76,7 @@ const ImportedSubnet = SubnetV2.fromSubnetV2Attributes(stack, 'IsolatedSubnet1',
routeTableId: 'rtb-0f02fab3ed3fb4ba9',
});

//Test to add different types of gateways
// Test to add different types of gateways
imported_new_vpc.addInternetGateway();

imported_new_vpc.addNatGateway({
Expand All @@ -101,14 +101,14 @@ const ipamvpc = VpcV2.VpcV2.fromVpcV2Attributes(stack, 'ImportedIPAMVPC', {
}],
});

//Test to add different types of gateways
// Test to add different types of gateways
ipamvpc.addEgressOnlyInternetGateway();

//Test to add new subnet to imported VPC against IPAM range
// Test to add new subnet to imported VPC against IPAM range
new SubnetV2(stack, 'AddnewSubnettoImportedIpam', {
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.2.1.0/28'),
//can be uncommented and modified after allocation is done using IPAM - Amazon Provided Ipv6
// can be uncommented and modified after allocation is done using IPAM - Amazon Provided Ipv6
ipv6CidrBlock: new IpCidr('2600:1f24:6c:4000::/64'),
vpc: ipamvpc,
subnetType: SubnetType.PUBLIC,
Expand Down
26 changes: 13 additions & 13 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const vpc = new vpc_v2.VpcV2(stack, 'VPC-integ-test-1', {
vpc_v2.IpAddresses.ipv4('10.2.0.0/16', {
cidrBlockName: 'SecondaryAddress2',
}),
//Test Amazon provided secondary ipv6 address
// Test Amazon provided secondary ipv6 address
vpc_v2.IpAddresses.amazonProvidedIpv6({
cidrBlockName: 'AmazonProvided',
}),
Expand All @@ -49,34 +49,34 @@ new SubnetV2(stack, 'testsubnet', {
vpc,
availabilityZone: 'us-west-2b',
ipv4CidrBlock: new IpCidr('10.2.0.0/24'),
//Test secondary ipv6 address after Amazon Provided ipv6 allocation
//ipv6CidrBlock: new Ipv6Cidr('2001:db8:1::/64'),
// Test secondary ipv6 address after Amazon Provided ipv6 allocation
// ipv6CidrBlock: new Ipv6Cidr('2001:db8:1::/64'),
subnetType: SubnetType.PRIVATE_ISOLATED,
});

//Validate ipv6 IPAM
// Validate ipv6 IPAM
new SubnetV2(stack, 'validateIpv6', {
vpc,
ipv4CidrBlock: new IpCidr('10.3.0.0/24'),
availabilityZone: 'us-west-2b',
//Test secondary ipv6 address after Amazon Provided ipv6 allocation
//ipv6CidrBlock: new IpCidr('2600:1f14:3283:9501::/64'),
// Test secondary ipv6 address after Amazon Provided ipv6 allocation
// ipv6CidrBlock: new IpCidr('2600:1f14:3283:9501::/64'),
subnetType: SubnetType.PUBLIC,
});

//Test to add Gateway Endpoint
// Test to add Gateway Endpoint
vpc.addGatewayEndpoint('TestGWendpoint', {
service: GatewayVpcEndpointAwsService.S3,
subnets: [{ subnetType: SubnetType.PUBLIC }],
});

//Test to add Interface Endpoint
// Test to add Interface Endpoint
vpc.addInterfaceEndpoint('TestInterfaceEndpoint', {
service: InterfaceVpcEndpointAwsService.SNS,
subnets: { subnetType: SubnetType.PRIVATE_ISOLATED },
});

//Add an Egress only Internet Gateway
// Add an Egress only Internet Gateway
vpc.addEgressOnlyInternetGateway({
subnets: [{ subnetType: SubnetType.PUBLIC }],
});
Expand All @@ -86,7 +86,7 @@ const vpnGateway = vpc.enableVpnGatewayV2({
type: VpnConnectionType.IPSEC_1,
});

//Can define a route with VPN gateway as a target
// Can define a route with VPN gateway as a target
const routeTable = new RouteTable(stack, 'routeTable', { vpc } );

new Route(stack, 'route', {
Expand All @@ -95,18 +95,18 @@ new Route(stack, 'route', {
routeTable: routeTable,
});

//Add Internet Gateway with routes set to custom IP range
// Add Internet Gateway with routes set to custom IP range
vpc.addInternetGateway({
ipv4Destination: '192.168.0.0/16',
});

//Add a NAT Gateway
// Add a NAT Gateway
vpc.addNatGateway({
subnet: subnet,
connectivityType: NatConnectivityType.PRIVATE,
}).node.addDependency(vpnGateway);

//Can define a route with Nat gateway as a target
// Can define a route with Nat gateway as a target
routeTable.addRoute( 'NATGWRoute', '172.32.0.0/24', { gateway: vpnGateway });

new IntegTest(app, 'integtest-model', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const stack = new cdk.Stack(app, 'aws-cdk-ec2-alpha-tag');
const vpc = new vpc_v2.VpcV2(stack, 'VPC-integ-test-tag', {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.1.0.0/16'),
secondaryAddressBlocks: [
//Test Amazon provided secondary ipv6 address
// Test Amazon provided secondary ipv6 address
vpc_v2.IpAddresses.amazonProvidedIpv6({
cidrBlockName: 'AmazonProvided',
}),
Expand Down
Loading
Loading