You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(ec2-alpha): adding assertion for integration tests (#33221)
### Issue # (if applicable)
Closes N/A
### Reason for this change
Added assertion for the integration tests that are related to security changes in the construct, needed for appsec approval.
### Description of changes
- Added integration with assertion for custom EIGW and IGW route.
- Added integration with assertion for VPC peering
- Fixing nits in README.
### Describe any new or updated permissions being added
No change in permissions
### Description of how you validated changes
Deployed assertion changes in personal account.
yarn build
yarn test
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-ec2-alpha/README.md
+10-26
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,12 @@
22
22
on the VPC being created. `VpcV2` implements the existing [`IVpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html), therefore,
23
23
`VpcV2` is compatible with other constructs that accepts `IVpc` (e.g. [`ApplicationLoadBalancer`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html#construct-props)).
24
24
25
-
To create a VPC with both IPv4 and IPv6 support:
25
+
`VpcV2` supports the addition of both primary and secondary addresses. The primary address must be an IPv4 address, which can be specified as a CIDR string or assigned from an IPAM pool. Secondary addresses can be either IPv4 or IPv6.
26
+
By default, `VpcV2` assigns `10.0.0.0/16` as the primary CIDR if no other CIDR is specified.
26
27
27
-
```ts
28
+
Below is an example of creating a VPC with both IPv4 and IPv6 support:
@@ -44,7 +46,6 @@ This new construct can be used to add subnets to a `VpcV2` instance:
44
46
Note: When defining a subnet with `SubnetV2`, CDK automatically creates a new route table, unless a route table is explicitly provided as an input to the construct.
45
47
46
48
```ts
47
-
48
49
const stack =newStack();
49
50
const myVpc =newVpcV2(this, 'Vpc', {
50
51
secondaryAddressBlocks: [
@@ -61,11 +62,12 @@ new SubnetV2(this, 'subnetA', {
61
62
})
62
63
```
63
64
65
+
Since `VpcV2` does not create subnets automatically, users have full control over IP addresses allocation across subnets.
66
+
64
67
## IP Addresses Management
65
68
66
-
By default `VpcV2` uses `10.0.0.0/16` as the primary CIDR if none is defined.
67
-
Additional CIDRs can be adding to the VPC via the `secondaryAddressBlocks` prop.
68
-
The following example illustrates the different options of defining the address blocks:
69
+
Additional CIDRs can be added to the VPC via the `secondaryAddressBlocks` property.
70
+
The following example illustrates the options of defining these secondary address blocks using `IPAM`:
69
71
70
72
Note: There’s currently an issue with IPAM pool deletion that may affect the `cdk --destroy` command. This is because IPAM takes time to detect when the IP address pool has been deallocated after the VPC is deleted. The current workaround is to wait until the IP address is fully deallocated from the pool before retrying the deletion. Below command can be used to check allocations for a pool using CLI
Since `VpcV2` does not create subnets automatically, users have full control over IP addresses allocation across subnets.
116
-
117
116
### Bring your own IPv6 addresses (BYOIP)
118
117
119
118
If you have your own IP address that you would like to use with EC2, you can set up an IPv6 pool via the AWS CLI, and use that pool ID in your application.
`RouteTable` is a new construct that allows for route tables to be customized in a variety of ways. For instance, the following example shows how a custom route table can be created and appended to a subnet:
151
+
`RouteTable` is a new construct that allows for route tables to be customized in a variety of ways. Using this construct, a customized route table can be added to the subnets defined using `SubnetV2`.
152
+
For instance, the following example shows how a custom route table can be created and appended to a `SubnetV2`:
Other route targets may require a deeper set of parameters to set up properly. For instance, the example below illustrates how to set up a `NatGateway`:
@@ -244,7 +241,6 @@ new Route(this, 'NatGwRoute', {
244
241
It is also possible to set up endpoints connecting other AWS services. For instance, the example below illustrates the linking of a Dynamo DB endpoint via the existing `ec2.GatewayVpcEndpoint` construct as a route target:
@@ -266,7 +262,6 @@ new Route(this, 'DynamoDBRoute', {
266
262
destination: '0.0.0.0/0',
267
263
target: { endpoint: dynamoEndpoint },
268
264
});
269
-
270
265
```
271
266
272
267
## VPC Peering Connection
@@ -431,7 +426,6 @@ By default, this method sets up a route to all outbound IPv6 address ranges, unl
431
426
The `Subnets` parameter accepts a `SubnetFilter`, which can be based on a `SubnetType` in VpcV2. A new route will be added to the route tables of all subnets that match this filter.
In case of cross account or cross region VPC, its recommended to provide region and ownerAccountId so that these values for the VPC can be used to populate correct arn value for the VPC. If a VPC region and account ID is not provided, then region and account configured in the stack will be used. Furthermore, these fields will be referenced later while setting up VPC peering connection, so its necessary to set these fields to a correct value.
611
600
612
601
Below is an example of importing a cross region and cross account VPC, VPC arn for this case would be 'arn:aws:ec2:us-west-2:123456789012:vpc/mockVpcID'
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-add-gateways.js.snapshot/VpcSameAccountIntegDefaultTestDeployAssertDA1BF34D.assets.json
0 commit comments