@aws-cdk/aws-ec2-alpha 2.176.0-alpha.0 → 2.178.0-alpha.0
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.
- package/.jsii +4266 -1645
- package/.jsii.tabl.json.gz +0 -0
- package/.warnings.jsii.js +167 -1
- package/README.md +274 -33
- package/awslint.json +5 -1
- package/lib/index.d.ts +8 -0
- package/lib/index.js +9 -1
- package/lib/ipam.d.ts +16 -16
- package/lib/ipam.js +24 -5
- package/lib/route.js +40 -18
- package/lib/subnet-v2.d.ts +3 -3
- package/lib/subnet-v2.js +40 -29
- package/lib/transit-gateway-association.d.ts +18 -0
- package/lib/transit-gateway-association.js +12 -0
- package/lib/transit-gateway-attachment.d.ts +18 -0
- package/lib/transit-gateway-attachment.js +12 -0
- package/lib/transit-gateway-route-table-association.d.ts +40 -0
- package/lib/transit-gateway-route-table-association.js +40 -0
- package/lib/transit-gateway-route-table-propagation.d.ts +45 -0
- package/lib/transit-gateway-route-table-propagation.js +40 -0
- package/lib/transit-gateway-route-table.d.ts +78 -0
- package/lib/transit-gateway-route-table.js +74 -0
- package/lib/transit-gateway-route.d.ts +90 -0
- package/lib/transit-gateway-route.js +81 -0
- package/lib/transit-gateway-vpc-attachment.d.ts +122 -0
- package/lib/transit-gateway-vpc-attachment.js +96 -0
- package/lib/transit-gateway.d.ts +166 -0
- package/lib/transit-gateway.js +113 -0
- package/lib/util.d.ts +16 -8
- package/lib/util.js +77 -23
- package/lib/vpc-v2-base.d.ts +71 -56
- package/lib/vpc-v2-base.js +82 -65
- package/lib/vpc-v2.d.ts +60 -4
- package/lib/vpc-v2.js +58 -14
- package/package.json +8 -8
- package/rosetta/default.ts-fixture +1 -1
package/.jsii.tabl.json.gz
CHANGED
|
Binary file
|
package/.warnings.jsii.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function _aws_cdk_aws_ec2_alpha_SecondaryAddressProps(p) {
|
|
2
2
|
}
|
|
3
|
+
function _aws_cdk_aws_ec2_alpha_Ipv6PoolSecondaryAddressProps(p) {
|
|
4
|
+
}
|
|
3
5
|
function _aws_cdk_aws_ec2_alpha_IpAddresses(p) {
|
|
4
6
|
}
|
|
5
7
|
function _aws_cdk_aws_ec2_alpha_VpcCidrOptions(p) {
|
|
@@ -125,6 +127,18 @@ function _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGatewayOptions(p) {
|
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
function _aws_cdk_aws_ec2_alpha_InternetGatewayOptions(p) {
|
|
130
|
+
if (p == null)
|
|
131
|
+
return;
|
|
132
|
+
visitedObjects.add(p);
|
|
133
|
+
try {
|
|
134
|
+
if (p.subnets != null)
|
|
135
|
+
for (const o of p.subnets)
|
|
136
|
+
if (!visitedObjects.has(o))
|
|
137
|
+
require("aws-cdk-lib/.warnings.jsii.js").aws_cdk_lib_aws_ec2_SubnetSelection(o);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
visitedObjects.delete(p);
|
|
141
|
+
}
|
|
128
142
|
}
|
|
129
143
|
function _aws_cdk_aws_ec2_alpha_VPNGatewayV2Options(p) {
|
|
130
144
|
if (p == null)
|
|
@@ -322,6 +336,158 @@ function _aws_cdk_aws_ec2_alpha_RouteTableProps(p) {
|
|
|
322
336
|
}
|
|
323
337
|
function _aws_cdk_aws_ec2_alpha_RouteTable(p) {
|
|
324
338
|
}
|
|
339
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGateway(p) {
|
|
340
|
+
}
|
|
341
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayProps(p) {
|
|
342
|
+
}
|
|
343
|
+
function _aws_cdk_aws_ec2_alpha_TransitGateway(p) {
|
|
344
|
+
}
|
|
345
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayRoute(p) {
|
|
346
|
+
}
|
|
347
|
+
function _aws_cdk_aws_ec2_alpha_BaseTransitGatewayRouteProps(p) {
|
|
348
|
+
if (p == null)
|
|
349
|
+
return;
|
|
350
|
+
visitedObjects.add(p);
|
|
351
|
+
try {
|
|
352
|
+
if (!visitedObjects.has(p.transitGatewayRouteTable))
|
|
353
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.transitGatewayRouteTable);
|
|
354
|
+
}
|
|
355
|
+
finally {
|
|
356
|
+
visitedObjects.delete(p);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteProps(p) {
|
|
360
|
+
if (p == null)
|
|
361
|
+
return;
|
|
362
|
+
visitedObjects.add(p);
|
|
363
|
+
try {
|
|
364
|
+
if (!visitedObjects.has(p.transitGatewayAttachment))
|
|
365
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayAttachment(p.transitGatewayAttachment);
|
|
366
|
+
if (!visitedObjects.has(p.transitGatewayRouteTable))
|
|
367
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.transitGatewayRouteTable);
|
|
368
|
+
}
|
|
369
|
+
finally {
|
|
370
|
+
visitedObjects.delete(p);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayBlackholeRouteProps(p) {
|
|
374
|
+
if (p == null)
|
|
375
|
+
return;
|
|
376
|
+
visitedObjects.add(p);
|
|
377
|
+
try {
|
|
378
|
+
if (!visitedObjects.has(p.transitGatewayRouteTable))
|
|
379
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.transitGatewayRouteTable);
|
|
380
|
+
}
|
|
381
|
+
finally {
|
|
382
|
+
visitedObjects.delete(p);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRoute(p) {
|
|
386
|
+
}
|
|
387
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayBlackholeRoute(p) {
|
|
388
|
+
}
|
|
389
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p) {
|
|
390
|
+
}
|
|
391
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableProps(p) {
|
|
392
|
+
if (p == null)
|
|
393
|
+
return;
|
|
394
|
+
visitedObjects.add(p);
|
|
395
|
+
try {
|
|
396
|
+
if (!visitedObjects.has(p.transitGateway))
|
|
397
|
+
_aws_cdk_aws_ec2_alpha_ITransitGateway(p.transitGateway);
|
|
398
|
+
}
|
|
399
|
+
finally {
|
|
400
|
+
visitedObjects.delete(p);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTable(p) {
|
|
404
|
+
}
|
|
405
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayAttachment(p) {
|
|
406
|
+
}
|
|
407
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachmentOptions(p) {
|
|
408
|
+
}
|
|
409
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachment(p) {
|
|
410
|
+
}
|
|
411
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayVpcAttachmentProps(p) {
|
|
412
|
+
if (p == null)
|
|
413
|
+
return;
|
|
414
|
+
visitedObjects.add(p);
|
|
415
|
+
try {
|
|
416
|
+
if (p.subnets != null)
|
|
417
|
+
for (const o of p.subnets)
|
|
418
|
+
if (!visitedObjects.has(o))
|
|
419
|
+
require("aws-cdk-lib/.warnings.jsii.js").aws_cdk_lib_aws_ec2_ISubnet(o);
|
|
420
|
+
if (!visitedObjects.has(p.transitGateway))
|
|
421
|
+
_aws_cdk_aws_ec2_alpha_ITransitGateway(p.transitGateway);
|
|
422
|
+
if (!visitedObjects.has(p.vpcAttachmentOptions))
|
|
423
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachmentOptions(p.vpcAttachmentOptions);
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
visitedObjects.delete(p);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function _aws_cdk_aws_ec2_alpha_AttachVpcOptions(p) {
|
|
430
|
+
if (p == null)
|
|
431
|
+
return;
|
|
432
|
+
visitedObjects.add(p);
|
|
433
|
+
try {
|
|
434
|
+
if (p.subnets != null)
|
|
435
|
+
for (const o of p.subnets)
|
|
436
|
+
if (!visitedObjects.has(o))
|
|
437
|
+
require("aws-cdk-lib/.warnings.jsii.js").aws_cdk_lib_aws_ec2_ISubnet(o);
|
|
438
|
+
if (!visitedObjects.has(p.associationRouteTable))
|
|
439
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.associationRouteTable);
|
|
440
|
+
if (p.propagationRouteTables != null)
|
|
441
|
+
for (const o of p.propagationRouteTables)
|
|
442
|
+
if (!visitedObjects.has(o))
|
|
443
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(o);
|
|
444
|
+
if (!visitedObjects.has(p.vpcAttachmentOptions))
|
|
445
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachmentOptions(p.vpcAttachmentOptions);
|
|
446
|
+
}
|
|
447
|
+
finally {
|
|
448
|
+
visitedObjects.delete(p);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayVpcAttachment(p) {
|
|
452
|
+
}
|
|
453
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayAssociation(p) {
|
|
454
|
+
}
|
|
455
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTableAssociation(p) {
|
|
456
|
+
}
|
|
457
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableAssociationProps(p) {
|
|
458
|
+
if (p == null)
|
|
459
|
+
return;
|
|
460
|
+
visitedObjects.add(p);
|
|
461
|
+
try {
|
|
462
|
+
if (!visitedObjects.has(p.transitGatewayRouteTable))
|
|
463
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.transitGatewayRouteTable);
|
|
464
|
+
if (!visitedObjects.has(p.transitGatewayVpcAttachment))
|
|
465
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayAttachment(p.transitGatewayVpcAttachment);
|
|
466
|
+
}
|
|
467
|
+
finally {
|
|
468
|
+
visitedObjects.delete(p);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableAssociation(p) {
|
|
472
|
+
}
|
|
473
|
+
function _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTablePropagation(p) {
|
|
474
|
+
}
|
|
475
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTablePropagationProps(p) {
|
|
476
|
+
if (p == null)
|
|
477
|
+
return;
|
|
478
|
+
visitedObjects.add(p);
|
|
479
|
+
try {
|
|
480
|
+
if (!visitedObjects.has(p.transitGatewayRouteTable))
|
|
481
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable(p.transitGatewayRouteTable);
|
|
482
|
+
if (!visitedObjects.has(p.transitGatewayVpcAttachment))
|
|
483
|
+
_aws_cdk_aws_ec2_alpha_ITransitGatewayAttachment(p.transitGatewayVpcAttachment);
|
|
484
|
+
}
|
|
485
|
+
finally {
|
|
486
|
+
visitedObjects.delete(p);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTablePropagation(p) {
|
|
490
|
+
}
|
|
325
491
|
function print(name, deprecationMessage) {
|
|
326
492
|
const deprecated = process.env.JSII_DEPRECATED;
|
|
327
493
|
const deprecationMode = ["warn", "fail", "quiet"].includes(deprecated) ? deprecated : "warn";
|
|
@@ -358,4 +524,4 @@ class DeprecationError extends Error {
|
|
|
358
524
|
});
|
|
359
525
|
}
|
|
360
526
|
}
|
|
361
|
-
module.exports = { print, getPropertyDescriptor, DeprecationError, _aws_cdk_aws_ec2_alpha_SecondaryAddressProps, _aws_cdk_aws_ec2_alpha_IpAddresses, _aws_cdk_aws_ec2_alpha_VpcCidrOptions, _aws_cdk_aws_ec2_alpha_IIpAddresses, _aws_cdk_aws_ec2_alpha_VpcV2Props, _aws_cdk_aws_ec2_alpha_VpcV2Attributes, _aws_cdk_aws_ec2_alpha_VpcV2, _aws_cdk_aws_ec2_alpha_IVPCCidrBlock, _aws_cdk_aws_ec2_alpha_VPCCidrBlockattributes, _aws_cdk_aws_ec2_alpha_AddressFamily, _aws_cdk_aws_ec2_alpha_IpamPoolPublicIpSource, _aws_cdk_aws_ec2_alpha_AwsServiceName, _aws_cdk_aws_ec2_alpha_IpamProps, _aws_cdk_aws_ec2_alpha_IpamScopeType, _aws_cdk_aws_ec2_alpha_PoolOptions, _aws_cdk_aws_ec2_alpha_IpamPoolCidrProvisioningOptions, _aws_cdk_aws_ec2_alpha_IIpamPool, _aws_cdk_aws_ec2_alpha_IpamScopeOptions, _aws_cdk_aws_ec2_alpha_IpamOptions, _aws_cdk_aws_ec2_alpha_IIpamScopeBase, _aws_cdk_aws_ec2_alpha_Ipam, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGatewayOptions, _aws_cdk_aws_ec2_alpha_InternetGatewayOptions, _aws_cdk_aws_ec2_alpha_VPNGatewayV2Options, _aws_cdk_aws_ec2_alpha_IVpcV2, _aws_cdk_aws_ec2_alpha_VpcV2Base, _aws_cdk_aws_ec2_alpha_IpCidr, _aws_cdk_aws_ec2_alpha_SubnetV2Props, _aws_cdk_aws_ec2_alpha_ISubnetV2, _aws_cdk_aws_ec2_alpha_SubnetV2, _aws_cdk_aws_ec2_alpha_SubnetV2Attributes, _aws_cdk_aws_ec2_alpha_NatConnectivityType, _aws_cdk_aws_ec2_alpha_IRouteTarget, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGatewayProps, _aws_cdk_aws_ec2_alpha_InternetGatewayProps, _aws_cdk_aws_ec2_alpha_VPNGatewayV2Props, _aws_cdk_aws_ec2_alpha_NatGatewayOptions, _aws_cdk_aws_ec2_alpha_NatGatewayProps, _aws_cdk_aws_ec2_alpha_VPCPeeringConnectionOptions, _aws_cdk_aws_ec2_alpha_VPCPeeringConnectionProps, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGateway, _aws_cdk_aws_ec2_alpha_InternetGateway, _aws_cdk_aws_ec2_alpha_VPNGatewayV2, _aws_cdk_aws_ec2_alpha_NatGateway, _aws_cdk_aws_ec2_alpha_VPCPeeringConnection, _aws_cdk_aws_ec2_alpha_RouteTargetProps, _aws_cdk_aws_ec2_alpha_RouteTargetType, _aws_cdk_aws_ec2_alpha_IRouteV2, _aws_cdk_aws_ec2_alpha_RouteProps, _aws_cdk_aws_ec2_alpha_Route, _aws_cdk_aws_ec2_alpha_RouteTableProps, _aws_cdk_aws_ec2_alpha_RouteTable };
|
|
527
|
+
module.exports = { print, getPropertyDescriptor, DeprecationError, _aws_cdk_aws_ec2_alpha_SecondaryAddressProps, _aws_cdk_aws_ec2_alpha_Ipv6PoolSecondaryAddressProps, _aws_cdk_aws_ec2_alpha_IpAddresses, _aws_cdk_aws_ec2_alpha_VpcCidrOptions, _aws_cdk_aws_ec2_alpha_IIpAddresses, _aws_cdk_aws_ec2_alpha_VpcV2Props, _aws_cdk_aws_ec2_alpha_VpcV2Attributes, _aws_cdk_aws_ec2_alpha_VpcV2, _aws_cdk_aws_ec2_alpha_IVPCCidrBlock, _aws_cdk_aws_ec2_alpha_VPCCidrBlockattributes, _aws_cdk_aws_ec2_alpha_AddressFamily, _aws_cdk_aws_ec2_alpha_IpamPoolPublicIpSource, _aws_cdk_aws_ec2_alpha_AwsServiceName, _aws_cdk_aws_ec2_alpha_IpamProps, _aws_cdk_aws_ec2_alpha_IpamScopeType, _aws_cdk_aws_ec2_alpha_PoolOptions, _aws_cdk_aws_ec2_alpha_IpamPoolCidrProvisioningOptions, _aws_cdk_aws_ec2_alpha_IIpamPool, _aws_cdk_aws_ec2_alpha_IpamScopeOptions, _aws_cdk_aws_ec2_alpha_IpamOptions, _aws_cdk_aws_ec2_alpha_IIpamScopeBase, _aws_cdk_aws_ec2_alpha_Ipam, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGatewayOptions, _aws_cdk_aws_ec2_alpha_InternetGatewayOptions, _aws_cdk_aws_ec2_alpha_VPNGatewayV2Options, _aws_cdk_aws_ec2_alpha_IVpcV2, _aws_cdk_aws_ec2_alpha_VpcV2Base, _aws_cdk_aws_ec2_alpha_IpCidr, _aws_cdk_aws_ec2_alpha_SubnetV2Props, _aws_cdk_aws_ec2_alpha_ISubnetV2, _aws_cdk_aws_ec2_alpha_SubnetV2, _aws_cdk_aws_ec2_alpha_SubnetV2Attributes, _aws_cdk_aws_ec2_alpha_NatConnectivityType, _aws_cdk_aws_ec2_alpha_IRouteTarget, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGatewayProps, _aws_cdk_aws_ec2_alpha_InternetGatewayProps, _aws_cdk_aws_ec2_alpha_VPNGatewayV2Props, _aws_cdk_aws_ec2_alpha_NatGatewayOptions, _aws_cdk_aws_ec2_alpha_NatGatewayProps, _aws_cdk_aws_ec2_alpha_VPCPeeringConnectionOptions, _aws_cdk_aws_ec2_alpha_VPCPeeringConnectionProps, _aws_cdk_aws_ec2_alpha_EgressOnlyInternetGateway, _aws_cdk_aws_ec2_alpha_InternetGateway, _aws_cdk_aws_ec2_alpha_VPNGatewayV2, _aws_cdk_aws_ec2_alpha_NatGateway, _aws_cdk_aws_ec2_alpha_VPCPeeringConnection, _aws_cdk_aws_ec2_alpha_RouteTargetProps, _aws_cdk_aws_ec2_alpha_RouteTargetType, _aws_cdk_aws_ec2_alpha_IRouteV2, _aws_cdk_aws_ec2_alpha_RouteProps, _aws_cdk_aws_ec2_alpha_Route, _aws_cdk_aws_ec2_alpha_RouteTableProps, _aws_cdk_aws_ec2_alpha_RouteTable, _aws_cdk_aws_ec2_alpha_ITransitGateway, _aws_cdk_aws_ec2_alpha_TransitGatewayProps, _aws_cdk_aws_ec2_alpha_TransitGateway, _aws_cdk_aws_ec2_alpha_ITransitGatewayRoute, _aws_cdk_aws_ec2_alpha_BaseTransitGatewayRouteProps, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteProps, _aws_cdk_aws_ec2_alpha_TransitGatewayBlackholeRouteProps, _aws_cdk_aws_ec2_alpha_TransitGatewayRoute, _aws_cdk_aws_ec2_alpha_TransitGatewayBlackholeRoute, _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTable, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableProps, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTable, _aws_cdk_aws_ec2_alpha_ITransitGatewayAttachment, _aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachmentOptions, _aws_cdk_aws_ec2_alpha_ITransitGatewayVpcAttachment, _aws_cdk_aws_ec2_alpha_TransitGatewayVpcAttachmentProps, _aws_cdk_aws_ec2_alpha_AttachVpcOptions, _aws_cdk_aws_ec2_alpha_TransitGatewayVpcAttachment, _aws_cdk_aws_ec2_alpha_ITransitGatewayAssociation, _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTableAssociation, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableAssociationProps, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTableAssociation, _aws_cdk_aws_ec2_alpha_ITransitGatewayRouteTablePropagation, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTablePropagationProps, _aws_cdk_aws_ec2_alpha_TransitGatewayRouteTablePropagation };
|
package/README.md
CHANGED
|
@@ -3,29 +3,30 @@
|
|
|
3
3
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-

|
|
7
7
|
|
|
8
|
-
> The APIs of higher level constructs in this module are
|
|
9
|
-
>
|
|
10
|
-
> not subject to
|
|
11
|
-
> announced in
|
|
12
|
-
> your source code when upgrading to a newer version of this package.
|
|
8
|
+
> The APIs of higher level constructs in this module are in **developer preview** before they
|
|
9
|
+
> become stable. We will only make breaking changes to address unforeseen API issues. Therefore,
|
|
10
|
+
> these APIs are not subject to [Semantic Versioning](https://semver.org/), and breaking changes
|
|
11
|
+
> will be announced in release notes. This means that while you may use them, you may need to
|
|
12
|
+
> update your source code when upgrading to a newer version of this package.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
<!--END STABILITY BANNER-->
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
## VpcV2
|
|
20
19
|
|
|
21
20
|
`VpcV2` is a re-write of the [`ec2.Vpc`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html) construct. This new construct enables higher level of customization
|
|
22
21
|
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
22
|
`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
23
|
|
|
25
|
-
|
|
24
|
+
`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.
|
|
25
|
+
By default, `VpcV2` assigns `10.0.0.0/16` as the primary CIDR if no other CIDR is specified.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Below is an example of creating a VPC with both IPv4 and IPv6 support:
|
|
28
28
|
|
|
29
|
+
```ts
|
|
29
30
|
const stack = new Stack();
|
|
30
31
|
new VpcV2(this, 'Vpc', {
|
|
31
32
|
primaryAddressBlock: IpAddresses.ipv4('10.0.0.0/24'),
|
|
@@ -41,9 +42,9 @@ new VpcV2(this, 'Vpc', {
|
|
|
41
42
|
|
|
42
43
|
`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.
|
|
43
44
|
This new construct can be used to add subnets to a `VpcV2` instance:
|
|
45
|
+
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.
|
|
44
46
|
|
|
45
47
|
```ts
|
|
46
|
-
|
|
47
48
|
const stack = new Stack();
|
|
48
49
|
const myVpc = new VpcV2(this, 'Vpc', {
|
|
49
50
|
secondaryAddressBlocks: [
|
|
@@ -60,17 +61,25 @@ new SubnetV2(this, 'subnetA', {
|
|
|
60
61
|
})
|
|
61
62
|
```
|
|
62
63
|
|
|
64
|
+
Since `VpcV2` does not create subnets automatically, users have full control over IP addresses allocation across subnets.
|
|
65
|
+
|
|
63
66
|
## IP Addresses Management
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
The following example illustrates the different options of defining the address blocks:
|
|
68
|
+
Additional CIDRs can be added to the VPC via the `secondaryAddressBlocks` property.
|
|
69
|
+
The following example illustrates the options of defining these secondary address blocks using `IPAM`:
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
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
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
aws ec2 get-ipam-pool-allocations --ipam-pool-id <ipam-pool-id>
|
|
75
|
+
```
|
|
70
76
|
|
|
77
|
+
Ref: https://docs.aws.amazon.com/cli/latest/reference/ec2/get-ipam-pool-allocations.html
|
|
78
|
+
|
|
79
|
+
```ts
|
|
71
80
|
const stack = new Stack();
|
|
72
81
|
const ipam = new Ipam(this, 'Ipam', {
|
|
73
|
-
|
|
82
|
+
operatingRegions: ['us-west-1']
|
|
74
83
|
});
|
|
75
84
|
const ipamPublicPool = ipam.publicScope.addPool('PublicPoolA', {
|
|
76
85
|
addressFamily: AddressFamily.IP_V6,
|
|
@@ -103,15 +112,45 @@ new VpcV2(this, 'Vpc', {
|
|
|
103
112
|
});
|
|
104
113
|
```
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
### Bring your own IPv6 addresses (BYOIP)
|
|
107
116
|
|
|
117
|
+
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.
|
|
108
118
|
|
|
109
|
-
|
|
119
|
+
Once you have certified your IP address block with an ROA and have obtained an X-509 certificate, you can run the following command to provision your CIDR block in your AWS account:
|
|
120
|
+
|
|
121
|
+
```shell
|
|
122
|
+
aws ec2 provision-byoip-cidr --region <region> --cidr <your CIDR block> --cidr-authorization-context Message="1|aws|<account>|<your CIDR block>|<expiration date>|SHA256".Signature="<signature>"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
When your BYOIP CIDR is provisioned, you can run the following command to retrieve your IPv6 pool ID, which will be used in your VPC declaration:
|
|
110
126
|
|
|
111
|
-
|
|
127
|
+
```shell
|
|
128
|
+
aws ec2 describe-byoip-cidr --region <region>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For more help on setting up your IPv6 address, please review the [EC2 Documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html).
|
|
132
|
+
|
|
133
|
+
Once you have provisioned your address block, you can use the IPv6 in your VPC as follows:
|
|
112
134
|
|
|
113
135
|
```ts
|
|
136
|
+
const myVpc = new VpcV2(this, 'Vpc', {
|
|
137
|
+
primaryAddressBlock: IpAddresses.ipv4('10.1.0.0/16'),
|
|
138
|
+
secondaryAddressBlocks: [IpAddresses.ipv6ByoipPool({
|
|
139
|
+
cidrBlockName: 'MyByoipCidrBlock',
|
|
140
|
+
ipv6PoolId: 'ipv6pool-ec2-someHashValue',
|
|
141
|
+
ipv6CidrBlock: '2001:db8::/32'
|
|
142
|
+
})],
|
|
143
|
+
enableDnsHostnames: true,
|
|
144
|
+
enableDnsSupport: true,
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Routing
|
|
149
|
+
|
|
150
|
+
`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`.
|
|
151
|
+
For instance, the following example shows how a custom route table can be created and appended to a `SubnetV2`:
|
|
114
152
|
|
|
153
|
+
```ts
|
|
115
154
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
116
155
|
const routeTable = new RouteTable(this, 'RouteTable', {
|
|
117
156
|
vpc: myVpc,
|
|
@@ -153,7 +192,6 @@ Alternatively, `Routes` can also be created via method `addRoute` in the `RouteT
|
|
|
153
192
|
Note: `EgressOnlyInternetGateway` can only be used to set up outbound IPv6 routing.
|
|
154
193
|
|
|
155
194
|
```ts
|
|
156
|
-
|
|
157
195
|
const stack = new Stack();
|
|
158
196
|
const myVpc = new VpcV2(this, 'Vpc',{
|
|
159
197
|
primaryAddressBlock: IpAddresses.ipv4('10.1.0.0/16'),
|
|
@@ -176,7 +214,6 @@ routeTable.addRoute('EIGW', '::/0', { gateway: eigw });
|
|
|
176
214
|
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`:
|
|
177
215
|
|
|
178
216
|
```ts
|
|
179
|
-
|
|
180
217
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
181
218
|
const routeTable = new RouteTable(this, 'RouteTable', {
|
|
182
219
|
vpc: myVpc,
|
|
@@ -203,7 +240,6 @@ new Route(this, 'NatGwRoute', {
|
|
|
203
240
|
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:
|
|
204
241
|
|
|
205
242
|
```ts
|
|
206
|
-
|
|
207
243
|
const stack = new Stack();
|
|
208
244
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
209
245
|
const routeTable = new RouteTable(this, 'RouteTable', {
|
|
@@ -225,7 +261,6 @@ new Route(this, 'DynamoDBRoute', {
|
|
|
225
261
|
destination: '0.0.0.0/0',
|
|
226
262
|
target: { endpoint: dynamoEndpoint },
|
|
227
263
|
});
|
|
228
|
-
|
|
229
264
|
```
|
|
230
265
|
|
|
231
266
|
## VPC Peering Connection
|
|
@@ -390,7 +425,6 @@ By default, this method sets up a route to all outbound IPv6 address ranges, unl
|
|
|
390
425
|
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.
|
|
391
426
|
|
|
392
427
|
```ts
|
|
393
|
-
|
|
394
428
|
const stack = new Stack();
|
|
395
429
|
const myVpc = new VpcV2(this, 'Vpc',{
|
|
396
430
|
primaryAddressBlock: IpAddresses.ipv4('10.1.0.0/16'),
|
|
@@ -434,7 +468,6 @@ Additionally, you can set up a route in any route table with the target set to t
|
|
|
434
468
|
The code example below provides the definition for adding a NAT gateway to your subnet:
|
|
435
469
|
|
|
436
470
|
```ts
|
|
437
|
-
|
|
438
471
|
const stack = new Stack();
|
|
439
472
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
440
473
|
const routeTable = new RouteTable(this, 'RouteTable', {
|
|
@@ -468,7 +501,6 @@ Additionally, you can set up a route in any route table with the target set to t
|
|
|
468
501
|
The code example below provides the definition for setting up a VPN gateway with `vpnRoutePropagation` enabled:
|
|
469
502
|
|
|
470
503
|
```ts
|
|
471
|
-
|
|
472
504
|
const stack = new Stack();
|
|
473
505
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
474
506
|
const vpnGateway = myVpc.enableVpnGatewayV2({
|
|
@@ -495,11 +527,11 @@ For more information, see [Enable VPC internet access using internet gateways](h
|
|
|
495
527
|
|
|
496
528
|
You can add an internet gateway to a VPC using `addInternetGateway` method. By default, this method creates a route in all Public Subnets with outbound destination set to `0.0.0.0` for IPv4 and `::0` for IPv6 enabled VPC.
|
|
497
529
|
Instead of using the default settings, you can configure a custom destination range by providing an optional input `destination` to the method.
|
|
530
|
+
In addition to the custom IP range, you can also choose to filter subnets where default routes should be created.
|
|
498
531
|
|
|
499
532
|
The code example below shows how to add an internet gateway with a custom outbound destination IP range:
|
|
500
533
|
|
|
501
534
|
```ts
|
|
502
|
-
|
|
503
535
|
const stack = new Stack();
|
|
504
536
|
const myVpc = new VpcV2(this, 'Vpc');
|
|
505
537
|
|
|
@@ -514,6 +546,34 @@ myVpc.addInternetGateway({
|
|
|
514
546
|
});
|
|
515
547
|
```
|
|
516
548
|
|
|
549
|
+
The following code examples demonstrates how to add an internet gateway with a custom outbound destination IP range for specific subnets:
|
|
550
|
+
|
|
551
|
+
```ts
|
|
552
|
+
const stack = new Stack();
|
|
553
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
554
|
+
|
|
555
|
+
const mySubnet = new SubnetV2(this, 'Subnet', {
|
|
556
|
+
vpc: myVpc,
|
|
557
|
+
availabilityZone: 'eu-west-2a',
|
|
558
|
+
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
|
|
559
|
+
subnetType: SubnetType.PUBLIC });
|
|
560
|
+
|
|
561
|
+
myVpc.addInternetGateway({
|
|
562
|
+
ipv4Destination: '192.168.0.0/16',
|
|
563
|
+
subnets: [mySubnet],
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
```ts
|
|
568
|
+
const stack = new Stack();
|
|
569
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
570
|
+
|
|
571
|
+
myVpc.addInternetGateway({
|
|
572
|
+
ipv4Destination: '192.168.0.0/16',
|
|
573
|
+
subnets: [{subnetType: SubnetType.PRIVATE_WITH_EGRESS}],
|
|
574
|
+
});
|
|
575
|
+
```
|
|
576
|
+
|
|
517
577
|
## Importing an existing VPC
|
|
518
578
|
|
|
519
579
|
You can import an existing VPC and its subnets using the `VpcV2.fromVpcV2Attributes()` method or an individual subnet using `SubnetV2.fromSubnetV2Attributes()` method.
|
|
@@ -527,14 +587,12 @@ If you wish to add a new subnet to imported VPC, new subnet's IP range(IPv4) wil
|
|
|
527
587
|
Here's an example of importing a VPC with only the required parameters
|
|
528
588
|
|
|
529
589
|
``` ts
|
|
530
|
-
|
|
531
590
|
const stack = new Stack();
|
|
532
591
|
|
|
533
592
|
const importedVpc = VpcV2.fromVpcV2Attributes(stack, 'ImportedVpc', {
|
|
534
593
|
vpcId: 'mockVpcID',
|
|
535
594
|
vpcCidrBlock: '10.0.0.0/16',
|
|
536
595
|
});
|
|
537
|
-
|
|
538
596
|
```
|
|
539
597
|
|
|
540
598
|
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.
|
|
@@ -542,7 +600,6 @@ In case of cross account or cross region VPC, its recommended to provide region
|
|
|
542
600
|
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'
|
|
543
601
|
|
|
544
602
|
``` ts
|
|
545
|
-
|
|
546
603
|
const stack = new Stack();
|
|
547
604
|
|
|
548
605
|
//Importing a cross account or cross region VPC
|
|
@@ -552,7 +609,6 @@ const importedVpc = VpcV2.fromVpcV2Attributes(stack, 'ImportedVpc', {
|
|
|
552
609
|
ownerAccountId: '123456789012',
|
|
553
610
|
region: 'us-west-2',
|
|
554
611
|
});
|
|
555
|
-
|
|
556
612
|
```
|
|
557
613
|
|
|
558
614
|
Here's an example of how to import a VPC with multiple CIDR blocks, IPv6 support, and different subnet types:
|
|
@@ -567,7 +623,6 @@ In this example, we're importing a VPC with:
|
|
|
567
623
|
- A public subnet in us-west-2b
|
|
568
624
|
|
|
569
625
|
```ts
|
|
570
|
-
|
|
571
626
|
const stack = new Stack();
|
|
572
627
|
|
|
573
628
|
const importedVpc = VpcV2.fromVpcV2Attributes(this, 'ImportedVPC', {
|
|
@@ -634,7 +689,6 @@ You can also import individual subnets using the `SubnetV2.fromSubnetV2Attribute
|
|
|
634
689
|
Here's an example of how to import a subnet:
|
|
635
690
|
|
|
636
691
|
```ts
|
|
637
|
-
|
|
638
692
|
SubnetV2.fromSubnetV2Attributes(this, 'ImportedSubnet', {
|
|
639
693
|
subnetId: 'subnet-0123456789abcdef0',
|
|
640
694
|
availabilityZone: 'us-west-2a',
|
|
@@ -653,7 +707,6 @@ By default, when a resource name is given to the construct, it automatically add
|
|
|
653
707
|
For example, if the `vpcName` is set to `TestVpc`, the following code will add a tag to the VPC with `key: Name` and `value: TestVpc`.
|
|
654
708
|
|
|
655
709
|
```ts
|
|
656
|
-
|
|
657
710
|
const vpc = new VpcV2(this, 'VPC-integ-test-tag', {
|
|
658
711
|
primaryAddressBlock: IpAddresses.ipv4('10.1.0.0/16'),
|
|
659
712
|
enableDnsHostnames: true,
|
|
@@ -664,3 +717,191 @@ const vpc = new VpcV2(this, 'VPC-integ-test-tag', {
|
|
|
664
717
|
// Add custom tags if needed
|
|
665
718
|
Tags.of(vpc).add('Environment', 'Production');
|
|
666
719
|
```
|
|
720
|
+
|
|
721
|
+
## Transit Gateway
|
|
722
|
+
|
|
723
|
+
The AWS Transit Gateway construct library allows you to create and configure Transit Gateway resources using AWS CDK.
|
|
724
|
+
|
|
725
|
+
See [AWS Transit Gateway Docs](docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html) for more info.
|
|
726
|
+
|
|
727
|
+
### Overview
|
|
728
|
+
|
|
729
|
+
The Transit Gateway construct (`TransitGateway`) is the main entry point for creating and managing your Transit Gateway infrastructure. It provides methods to create route tables, attach VPCs, and configure cross-account access.
|
|
730
|
+
|
|
731
|
+
The Transit Gateway construct library provides four main constructs:
|
|
732
|
+
|
|
733
|
+
- `TransitGateway`: The central hub for your network connections
|
|
734
|
+
- `TransitGatewayRouteTable`: Manages routing between attached networks
|
|
735
|
+
- `TransitGatewayVpcAttachment`: Connects VPCs to the Transit Gateway
|
|
736
|
+
- `TransitGatewayRoute`: Defines routing rules within your Transit Gateway
|
|
737
|
+
|
|
738
|
+
### Basic Usage
|
|
739
|
+
|
|
740
|
+
To create a minimal deployable `TransitGateway`:
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Default Transit Gateway Route Table
|
|
747
|
+
|
|
748
|
+
By default, `TransitGateway` is created with a default `TransitGatewayRouteTable`, for which automatic Associations and automatic Propagations are enabled.
|
|
749
|
+
|
|
750
|
+
> Note: When you create a default Transit Gateway in AWS Console, a default Transit Gateway Route Table is automatically created by AWS. However, when using the CDK Transit Gateway L2 construct, the underlying L1 construct is configured with `defaultRouteTableAssociation` and `defaultRouteTablePropagation` explicitly disabled. This ensures that AWS does not create the default route table, allowing the CDK to define a custom default route table instead.
|
|
751
|
+
>
|
|
752
|
+
> As a result, in the AWS Console, the **Default association route table** and **Default propagation route table** settings will appear as disabled. Despite this, the CDK still provides automatic association and propagation functionality through its internal implementation, which can be controlled using the `defaultRouteTableAssociation` and `defaultRouteTablePropagation` properties within the CDK.
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
You can disable the automatic Association/Propagation on the default `TransitGatewayRouteTable` via the `TransitGateway` properties. This will still create a default route table for you:
|
|
756
|
+
|
|
757
|
+
```ts
|
|
758
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway', {
|
|
759
|
+
defaultRouteTableAssociation: false,
|
|
760
|
+
defaultRouteTablePropagation: false,
|
|
761
|
+
});
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### Transit Gateway Route Table Management
|
|
765
|
+
|
|
766
|
+
Add additional Transit Gateway Route Tables using the `addRouteTable()` method:
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
770
|
+
|
|
771
|
+
const routeTable = transitGateway.addRouteTable('CustomRouteTable');
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
### Attaching VPCs to the Transit Gateway
|
|
775
|
+
|
|
776
|
+
Currently only VPC to Transit Gateway attachments are supported.
|
|
777
|
+
|
|
778
|
+
Create an attachment from a VPC to the Transit Gateway using the `attachVpc()` method:
|
|
779
|
+
|
|
780
|
+
```ts
|
|
781
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
782
|
+
const subnet1 = new SubnetV2(this, 'Subnet', {
|
|
783
|
+
vpc: myVpc,
|
|
784
|
+
availabilityZone: 'eu-west-2a',
|
|
785
|
+
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
|
|
786
|
+
subnetType: SubnetType.PUBLIC
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
const subnet2 = new SubnetV2(this, 'Subnet', {
|
|
790
|
+
vpc: myVpc,
|
|
791
|
+
availabilityZone: 'eu-west-2a',
|
|
792
|
+
ipv4CidrBlock: new IpCidr('10.0.1.0/24'),
|
|
793
|
+
subnetType: SubnetType.PUBLIC
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
797
|
+
|
|
798
|
+
// Create a basic attachment
|
|
799
|
+
const attachment = transitGateway.attachVpc('VpcAttachment', {
|
|
800
|
+
vpc: myVpc,
|
|
801
|
+
subnets: [subnet1, subnet2]
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
// Create an attachment with optional parameters
|
|
805
|
+
const attachmentWithOptions = transitGateway.attachVpc('VpcAttachmentWithOptions', {
|
|
806
|
+
vpc: myVpc,
|
|
807
|
+
subnets: [subnet1],
|
|
808
|
+
vpcAttachmentOptions: {
|
|
809
|
+
dnsSupport: true,
|
|
810
|
+
applianceModeSupport: true,
|
|
811
|
+
ipv6Support: true,
|
|
812
|
+
securityGroupReferencingSupport: true,
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
If you want to automatically associate and propagate routes with transit gateway route tables, you can pass the `associationRouteTable` and `propagationRouteTables` parameters. This will automatically create the necessary associations and propagations based on the provided route tables.
|
|
818
|
+
|
|
819
|
+
```ts
|
|
820
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
821
|
+
const subnet1 = new SubnetV2(this, 'Subnet', {
|
|
822
|
+
vpc: myVpc,
|
|
823
|
+
availabilityZone: 'eu-west-2a',
|
|
824
|
+
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
|
|
825
|
+
subnetType: SubnetType.PUBLIC
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
const subnet2 = new SubnetV2(this, 'Subnet', {
|
|
829
|
+
vpc: myVpc,
|
|
830
|
+
availabilityZone: 'eu-west-2a',
|
|
831
|
+
ipv4CidrBlock: new IpCidr('10.0.1.0/24'),
|
|
832
|
+
subnetType: SubnetType.PUBLIC
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
836
|
+
const associationRouteTable = transitGateway.addRouteTable('AssociationRouteTable');
|
|
837
|
+
const propagationRouteTable1 = transitGateway.addRouteTable('PropagationRouteTable1');
|
|
838
|
+
const propagationRouteTable2 = transitGateway.addRouteTable('PropagationRouteTable2');
|
|
839
|
+
|
|
840
|
+
// Create an attachment with automatically created association + propagations
|
|
841
|
+
const attachmentWithRoutes = transitGateway.attachVpc('VpcAttachment', {
|
|
842
|
+
vpc: myVpc,
|
|
843
|
+
subnets: [subnet1, subnet2],
|
|
844
|
+
associationRouteTable: associationRouteTable,
|
|
845
|
+
propagationRouteTables: [propagationRouteTable1, propagationRouteTable2],
|
|
846
|
+
});
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
In this example, the `associationRouteTable` is set to `associationRouteTable`, and `propagationRouteTables` is set to an array containing `propagationRouteTable1` and `propagationRouteTable2`. This triggers the automatic creation of route table associations and route propagations between the Transit Gateway and the specified route tables.
|
|
850
|
+
|
|
851
|
+
### Adding static routes to the route table
|
|
852
|
+
|
|
853
|
+
Add static routes using either the `addRoute()` method to add an active route or `addBlackholeRoute()` to add a blackhole route:
|
|
854
|
+
|
|
855
|
+
```ts
|
|
856
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
857
|
+
const routeTable = transitGateway.addRouteTable('CustomRouteTable');
|
|
858
|
+
|
|
859
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
860
|
+
const subnet = new SubnetV2(this, 'Subnet', {
|
|
861
|
+
vpc: myVpc,
|
|
862
|
+
availabilityZone: 'eu-west-2a',
|
|
863
|
+
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
|
|
864
|
+
subnetType: SubnetType.PUBLIC
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
const attachment = transitGateway.attachVpc('VpcAttachment', {
|
|
868
|
+
vpc: myVpc,
|
|
869
|
+
subnets: [subnet]
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
// Add a static route to direct traffic
|
|
873
|
+
routeTable.addRoute('StaticRoute', attachment, '10.0.0.0/16');
|
|
874
|
+
|
|
875
|
+
// Block unwanted traffic with a blackhole route
|
|
876
|
+
routeTable.addBlackholeRoute('BlackholeRoute', '172.16.0.0/16');
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
### Route Table Associations and Propagations
|
|
880
|
+
|
|
881
|
+
Configure route table associations and enable route propagation:
|
|
882
|
+
|
|
883
|
+
```ts
|
|
884
|
+
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
|
|
885
|
+
const routeTable = transitGateway.addRouteTable('CustomRouteTable');
|
|
886
|
+
const myVpc = new VpcV2(this, 'Vpc');
|
|
887
|
+
const subnet = new SubnetV2(this, 'Subnet', {
|
|
888
|
+
vpc: myVpc,
|
|
889
|
+
availabilityZone: 'eu-west-2a',
|
|
890
|
+
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
|
|
891
|
+
subnetType: SubnetType.PUBLIC
|
|
892
|
+
});
|
|
893
|
+
const attachment = transitGateway.attachVpc('VpcAttachment', {
|
|
894
|
+
vpc: myVpc,
|
|
895
|
+
subnets: [subnet]
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
// Associate an attachment with a route table
|
|
899
|
+
routeTable.addAssociation('Association', attachment);
|
|
900
|
+
|
|
901
|
+
// Enable route propagation for an attachment
|
|
902
|
+
routeTable.enablePropagation('Propagation', attachment);
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
**Associations** — The linking of a Transit Gateway attachment to a specific route table, which determines which routes that attachment will use for routing decisions.
|
|
906
|
+
|
|
907
|
+
**Propagation** — The automatic advertisement of routes from an attachment to a route table, allowing the route table to learn about available network destinations.
|