aws-cdk.aws-ec2-alpha 2.164.1a0__tar.gz → 2.165.0a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aws-cdk.aws-ec2-alpha might be problematic. Click here for more details.

Files changed (19) hide show
  1. {aws_cdk_aws_ec2_alpha-2.164.1a0/src/aws_cdk.aws_ec2_alpha.egg-info → aws_cdk_aws_ec2_alpha-2.165.0a0}/PKG-INFO +125 -8
  2. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/README.md +121 -4
  3. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/setup.py +5 -5
  4. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk/aws_ec2_alpha/__init__.py +1175 -102
  5. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk/aws_ec2_alpha/_jsii/__init__.py +2 -2
  6. aws_cdk_aws_ec2_alpha-2.165.0a0/src/aws_cdk/aws_ec2_alpha/_jsii/aws-ec2-alpha@2.165.0-alpha.0.jsii.tgz +0 -0
  7. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0/src/aws_cdk.aws_ec2_alpha.egg-info}/PKG-INFO +125 -8
  8. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk.aws_ec2_alpha.egg-info/SOURCES.txt +1 -1
  9. aws_cdk_aws_ec2_alpha-2.165.0a0/src/aws_cdk.aws_ec2_alpha.egg-info/requires.txt +5 -0
  10. aws_cdk_aws_ec2_alpha-2.164.1a0/src/aws_cdk/aws_ec2_alpha/_jsii/aws-ec2-alpha@2.164.1-alpha.0.jsii.tgz +0 -0
  11. aws_cdk_aws_ec2_alpha-2.164.1a0/src/aws_cdk.aws_ec2_alpha.egg-info/requires.txt +0 -5
  12. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/LICENSE +0 -0
  13. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/MANIFEST.in +0 -0
  14. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/NOTICE +0 -0
  15. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/pyproject.toml +0 -0
  16. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/setup.cfg +0 -0
  17. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk/aws_ec2_alpha/py.typed +0 -0
  18. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk.aws_ec2_alpha.egg-info/dependency_links.txt +0 -0
  19. {aws_cdk_aws_ec2_alpha-2.164.1a0 → aws_cdk_aws_ec2_alpha-2.165.0a0}/src/aws_cdk.aws_ec2_alpha.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aws-cdk.aws-ec2-alpha
3
- Version: 2.164.1a0
3
+ Version: 2.165.0a0
4
4
  Summary: The CDK construct library for VPC V2
5
5
  Home-page: https://github.com/aws/aws-cdk
6
6
  Author: Amazon Web Services
@@ -23,11 +23,11 @@ Requires-Python: ~=3.8
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
25
  License-File: NOTICE
26
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.164.1
26
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.165.0
27
27
  Requires-Dist: constructs<11.0.0,>=10.0.0
28
- Requires-Dist: jsii<2.0.0,>=1.103.1
28
+ Requires-Dist: jsii<2.0.0,>=1.104.0
29
29
  Requires-Dist: publication>=0.0.3
30
- Requires-Dist: typeguard<5.0.0,>=2.13.3
30
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
31
31
 
32
32
  # Amazon VpcV2 Construct Library
33
33
 
@@ -65,8 +65,6 @@ VpcV2(self, "Vpc",
65
65
 
66
66
  `VpcV2` does not automatically create subnets or allocate IP addresses, which is different from the `Vpc` construct.
67
67
 
68
- Importing existing VPC in an account into CDK as a `VpcV2` is not yet supported.
69
-
70
68
  ## SubnetV2
71
69
 
72
70
  `SubnetV2` is a re-write of the [`ec2.Subnet`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Subnet.html) construct.
@@ -89,8 +87,6 @@ SubnetV2(self, "subnetA",
89
87
  )
90
88
  ```
91
89
 
92
- Same as `VpcV2`, importing existing subnets is not yet supported.
93
-
94
90
  ## IP Addresses Management
95
91
 
96
92
  By default `VpcV2` uses `10.0.0.0/16` as the primary CIDR if none is defined.
@@ -389,3 +385,124 @@ my_vpc.add_internet_gateway(
389
385
  ipv4_destination="192.168.0.0/16"
390
386
  )
391
387
  ```
388
+
389
+ ## Importing an existing VPC
390
+
391
+ You can import an existing VPC and its subnets using the `VpcV2.fromVpcV2Attributes()` method or an individual subnet using `SubnetV2.fromSubnetV2Attributes()` method.
392
+
393
+ ### Importing a VPC
394
+
395
+ To import an existing VPC, use the `VpcV2.fromVpcV2Attributes()` method. You'll need to provide the VPC ID, primary CIDR block, and information about the subnets. You can import secondary address as well created through IPAM, BYOIP(IPv4) or enabled through Amazon Provided IPv6. You must provide VPC Id and its primary CIDR block for importing it.
396
+
397
+ If you wish to add a new subnet to imported VPC, new subnet's IP range(IPv4) will be validated against provided secondary and primary address block to confirm that it is within the the range of VPC.
398
+
399
+ Here's an example of importing a VPC with only the required parameters
400
+
401
+ ```python
402
+ stack = Stack()
403
+
404
+ imported_vpc = VpcV2.from_vpc_v2_attributes(stack, "ImportedVpc",
405
+ vpc_id="mockVpcID",
406
+ vpc_cidr_block="10.0.0.0/16"
407
+ )
408
+ ```
409
+
410
+ 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.
411
+
412
+ Below is an example of importing a cross region and cross acount VPC, VPC arn for this case would be 'arn:aws:ec2:us-west-2:123456789012:vpc/mockVpcID'
413
+
414
+ ```python
415
+ stack = Stack()
416
+
417
+ # Importing a cross acount or cross region VPC
418
+ imported_vpc = VpcV2.from_vpc_v2_attributes(stack, "ImportedVpc",
419
+ vpc_id="mockVpcID",
420
+ vpc_cidr_block="10.0.0.0/16",
421
+ owner_account_id="123456789012",
422
+ region="us-west-2"
423
+ )
424
+ ```
425
+
426
+ Here's an example of how to import a VPC with multiple CIDR blocks, IPv6 support, and different subnet types:
427
+
428
+ In this example, we're importing a VPC with:
429
+
430
+ * A primary CIDR block (10.1.0.0/16)
431
+ * One secondary IPv4 CIDR block (10.2.0.0/16)
432
+ * Two secondary address using IPAM pool (IPv4 and IPv6)
433
+ * VPC has Amazon-provided IPv6 CIDR enabled
434
+ * An isolated subnet in us-west-2a
435
+ * A public subnet in us-west-2b
436
+
437
+ ```python
438
+ stack = Stack()
439
+
440
+ imported_vpc = VpcV2.from_vpc_v2_attributes(self, "ImportedVPC",
441
+ vpc_id="vpc-XXX",
442
+ vpc_cidr_block="10.1.0.0/16",
443
+ secondary_cidr_blocks=[VPCCidrBlockattributes(
444
+ cidr_block="10.2.0.0/16",
445
+ cidr_block_name="ImportedBlock1"
446
+ ), VPCCidrBlockattributes(
447
+ ipv6_ipam_pool_id="ipam-pool-XXX",
448
+ ipv6_netmask_length=52,
449
+ cidr_block_name="ImportedIpamIpv6"
450
+ ), VPCCidrBlockattributes(
451
+ ipv4_ipam_pool_id="ipam-pool-XXX",
452
+ ipv4_ipam_provisioned_cidrs=["10.2.0.0/16"],
453
+ cidr_block_name="ImportedIpamIpv4"
454
+ ), VPCCidrBlockattributes(
455
+ amazon_provided_ipv6_cidr_block=True
456
+ )
457
+ ],
458
+ subnets=[SubnetV2Attributes(
459
+ subnet_name="IsolatedSubnet2",
460
+ subnet_id="subnet-03cd773c0fe08ed26",
461
+ subnet_type=SubnetType.PRIVATE_ISOLATED,
462
+ availability_zone="us-west-2a",
463
+ ipv4_cidr_block="10.2.0.0/24",
464
+ route_table_id="rtb-0871c310f98da2cbb"
465
+ ), SubnetV2Attributes(
466
+ subnet_id="subnet-0fa477e01db27d820",
467
+ subnet_type=SubnetType.PUBLIC,
468
+ availability_zone="us-west-2b",
469
+ ipv4_cidr_block="10.3.0.0/24",
470
+ route_table_id="rtb-014f3043098fe4b96"
471
+ )]
472
+ )
473
+
474
+ # You can now use the imported VPC in your stack
475
+
476
+ # Adding a new subnet to the imported VPC
477
+ imported_subnet = SubnetV2(self, "NewSubnet",
478
+ availability_zone="us-west-2a",
479
+ ipv4_cidr_block=IpCidr("10.2.2.0/24"),
480
+ vpc=imported_vpc,
481
+ subnet_type=SubnetType.PUBLIC
482
+ )
483
+
484
+ # Adding gateways to the imported VPC
485
+ imported_vpc.add_internet_gateway()
486
+ imported_vpc.add_nat_gateway(subnet=imported_subnet)
487
+ imported_vpc.add_egress_only_internet_gateway()
488
+ ```
489
+
490
+ You can add more subnets as needed by including additional entries in the `isolatedSubnets`, `publicSubnets`, or other subnet type arrays (e.g., `privateSubnets`).
491
+
492
+ ### Importing Subnets
493
+
494
+ You can also import individual subnets using the `SubnetV2.fromSubnetV2Attributes()` method. This is useful when you need to work with specific subnets independently of a VPC.
495
+
496
+ Here's an example of how to import a subnet:
497
+
498
+ ```python
499
+ SubnetV2.from_subnet_v2_attributes(self, "ImportedSubnet",
500
+ subnet_id="subnet-0123456789abcdef0",
501
+ availability_zone="us-west-2a",
502
+ ipv4_cidr_block="10.2.0.0/24",
503
+ route_table_id="rtb-0871c310f98da2cbb",
504
+ subnet_type=SubnetType.PRIVATE_ISOLATED
505
+ )
506
+ ```
507
+
508
+ By importing existing VPCs and subnets, you can easily integrate your existing AWS infrastructure with new resources created through CDK. This is particularly useful when you need to work with pre-existing network configurations or when you're migrating existing infrastructure to CDK.
@@ -34,8 +34,6 @@ VpcV2(self, "Vpc",
34
34
 
35
35
  `VpcV2` does not automatically create subnets or allocate IP addresses, which is different from the `Vpc` construct.
36
36
 
37
- Importing existing VPC in an account into CDK as a `VpcV2` is not yet supported.
38
-
39
37
  ## SubnetV2
40
38
 
41
39
  `SubnetV2` is a re-write of the [`ec2.Subnet`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Subnet.html) construct.
@@ -58,8 +56,6 @@ SubnetV2(self, "subnetA",
58
56
  )
59
57
  ```
60
58
 
61
- Same as `VpcV2`, importing existing subnets is not yet supported.
62
-
63
59
  ## IP Addresses Management
64
60
 
65
61
  By default `VpcV2` uses `10.0.0.0/16` as the primary CIDR if none is defined.
@@ -358,3 +354,124 @@ my_vpc.add_internet_gateway(
358
354
  ipv4_destination="192.168.0.0/16"
359
355
  )
360
356
  ```
357
+
358
+ ## Importing an existing VPC
359
+
360
+ You can import an existing VPC and its subnets using the `VpcV2.fromVpcV2Attributes()` method or an individual subnet using `SubnetV2.fromSubnetV2Attributes()` method.
361
+
362
+ ### Importing a VPC
363
+
364
+ To import an existing VPC, use the `VpcV2.fromVpcV2Attributes()` method. You'll need to provide the VPC ID, primary CIDR block, and information about the subnets. You can import secondary address as well created through IPAM, BYOIP(IPv4) or enabled through Amazon Provided IPv6. You must provide VPC Id and its primary CIDR block for importing it.
365
+
366
+ If you wish to add a new subnet to imported VPC, new subnet's IP range(IPv4) will be validated against provided secondary and primary address block to confirm that it is within the the range of VPC.
367
+
368
+ Here's an example of importing a VPC with only the required parameters
369
+
370
+ ```python
371
+ stack = Stack()
372
+
373
+ imported_vpc = VpcV2.from_vpc_v2_attributes(stack, "ImportedVpc",
374
+ vpc_id="mockVpcID",
375
+ vpc_cidr_block="10.0.0.0/16"
376
+ )
377
+ ```
378
+
379
+ 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.
380
+
381
+ Below is an example of importing a cross region and cross acount VPC, VPC arn for this case would be 'arn:aws:ec2:us-west-2:123456789012:vpc/mockVpcID'
382
+
383
+ ```python
384
+ stack = Stack()
385
+
386
+ # Importing a cross acount or cross region VPC
387
+ imported_vpc = VpcV2.from_vpc_v2_attributes(stack, "ImportedVpc",
388
+ vpc_id="mockVpcID",
389
+ vpc_cidr_block="10.0.0.0/16",
390
+ owner_account_id="123456789012",
391
+ region="us-west-2"
392
+ )
393
+ ```
394
+
395
+ Here's an example of how to import a VPC with multiple CIDR blocks, IPv6 support, and different subnet types:
396
+
397
+ In this example, we're importing a VPC with:
398
+
399
+ * A primary CIDR block (10.1.0.0/16)
400
+ * One secondary IPv4 CIDR block (10.2.0.0/16)
401
+ * Two secondary address using IPAM pool (IPv4 and IPv6)
402
+ * VPC has Amazon-provided IPv6 CIDR enabled
403
+ * An isolated subnet in us-west-2a
404
+ * A public subnet in us-west-2b
405
+
406
+ ```python
407
+ stack = Stack()
408
+
409
+ imported_vpc = VpcV2.from_vpc_v2_attributes(self, "ImportedVPC",
410
+ vpc_id="vpc-XXX",
411
+ vpc_cidr_block="10.1.0.0/16",
412
+ secondary_cidr_blocks=[VPCCidrBlockattributes(
413
+ cidr_block="10.2.0.0/16",
414
+ cidr_block_name="ImportedBlock1"
415
+ ), VPCCidrBlockattributes(
416
+ ipv6_ipam_pool_id="ipam-pool-XXX",
417
+ ipv6_netmask_length=52,
418
+ cidr_block_name="ImportedIpamIpv6"
419
+ ), VPCCidrBlockattributes(
420
+ ipv4_ipam_pool_id="ipam-pool-XXX",
421
+ ipv4_ipam_provisioned_cidrs=["10.2.0.0/16"],
422
+ cidr_block_name="ImportedIpamIpv4"
423
+ ), VPCCidrBlockattributes(
424
+ amazon_provided_ipv6_cidr_block=True
425
+ )
426
+ ],
427
+ subnets=[SubnetV2Attributes(
428
+ subnet_name="IsolatedSubnet2",
429
+ subnet_id="subnet-03cd773c0fe08ed26",
430
+ subnet_type=SubnetType.PRIVATE_ISOLATED,
431
+ availability_zone="us-west-2a",
432
+ ipv4_cidr_block="10.2.0.0/24",
433
+ route_table_id="rtb-0871c310f98da2cbb"
434
+ ), SubnetV2Attributes(
435
+ subnet_id="subnet-0fa477e01db27d820",
436
+ subnet_type=SubnetType.PUBLIC,
437
+ availability_zone="us-west-2b",
438
+ ipv4_cidr_block="10.3.0.0/24",
439
+ route_table_id="rtb-014f3043098fe4b96"
440
+ )]
441
+ )
442
+
443
+ # You can now use the imported VPC in your stack
444
+
445
+ # Adding a new subnet to the imported VPC
446
+ imported_subnet = SubnetV2(self, "NewSubnet",
447
+ availability_zone="us-west-2a",
448
+ ipv4_cidr_block=IpCidr("10.2.2.0/24"),
449
+ vpc=imported_vpc,
450
+ subnet_type=SubnetType.PUBLIC
451
+ )
452
+
453
+ # Adding gateways to the imported VPC
454
+ imported_vpc.add_internet_gateway()
455
+ imported_vpc.add_nat_gateway(subnet=imported_subnet)
456
+ imported_vpc.add_egress_only_internet_gateway()
457
+ ```
458
+
459
+ You can add more subnets as needed by including additional entries in the `isolatedSubnets`, `publicSubnets`, or other subnet type arrays (e.g., `privateSubnets`).
460
+
461
+ ### Importing Subnets
462
+
463
+ You can also import individual subnets using the `SubnetV2.fromSubnetV2Attributes()` method. This is useful when you need to work with specific subnets independently of a VPC.
464
+
465
+ Here's an example of how to import a subnet:
466
+
467
+ ```python
468
+ SubnetV2.from_subnet_v2_attributes(self, "ImportedSubnet",
469
+ subnet_id="subnet-0123456789abcdef0",
470
+ availability_zone="us-west-2a",
471
+ ipv4_cidr_block="10.2.0.0/24",
472
+ route_table_id="rtb-0871c310f98da2cbb",
473
+ subnet_type=SubnetType.PRIVATE_ISOLATED
474
+ )
475
+ ```
476
+
477
+ By importing existing VPCs and subnets, you can easily integrate your existing AWS infrastructure with new resources created through CDK. This is particularly useful when you need to work with pre-existing network configurations or when you're migrating existing infrastructure to CDK.
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "aws-cdk.aws-ec2-alpha",
8
- "version": "2.164.1.a0",
8
+ "version": "2.165.0.a0",
9
9
  "description": "The CDK construct library for VPC V2",
10
10
  "license": "Apache-2.0",
11
11
  "url": "https://github.com/aws/aws-cdk",
@@ -26,7 +26,7 @@ kwargs = json.loads(
26
26
  ],
27
27
  "package_data": {
28
28
  "aws_cdk.aws_ec2_alpha._jsii": [
29
- "aws-ec2-alpha@2.164.1-alpha.0.jsii.tgz"
29
+ "aws-ec2-alpha@2.165.0-alpha.0.jsii.tgz"
30
30
  ],
31
31
  "aws_cdk.aws_ec2_alpha": [
32
32
  "py.typed"
@@ -34,11 +34,11 @@ kwargs = json.loads(
34
34
  },
35
35
  "python_requires": "~=3.8",
36
36
  "install_requires": [
37
- "aws-cdk-lib>=2.164.1, <3.0.0",
37
+ "aws-cdk-lib>=2.165.0, <3.0.0",
38
38
  "constructs>=10.0.0, <11.0.0",
39
- "jsii>=1.103.1, <2.0.0",
39
+ "jsii>=1.104.0, <2.0.0",
40
40
  "publication>=0.0.3",
41
- "typeguard>=2.13.3,<5.0.0"
41
+ "typeguard>=2.13.3,<4.3.0"
42
42
  ],
43
43
  "classifiers": [
44
44
  "Intended Audience :: Developers",