aws-cdk-lib 2.73.0__py3-none-any.whl → 2.76.0__py3-none-any.whl

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-lib might be problematic. Click here for more details.

Files changed (111) hide show
  1. aws_cdk/__init__.py +245 -259
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.73.0.jsii.tgz → aws-cdk-lib@2.76.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_amplifyuibuilder/__init__.py +182 -214
  5. aws_cdk/aws_apigateway/__init__.py +95 -148
  6. aws_cdk/aws_appconfig/__init__.py +8 -4
  7. aws_cdk/aws_appflow/__init__.py +27 -52
  8. aws_cdk/aws_appmesh/__init__.py +91 -200
  9. aws_cdk/aws_apprunner/__init__.py +4 -16
  10. aws_cdk/aws_appstream/__init__.py +18 -82
  11. aws_cdk/aws_athena/__init__.py +18 -32
  12. aws_cdk/aws_backup/__init__.py +48 -86
  13. aws_cdk/aws_batch/__init__.py +9 -2
  14. aws_cdk/aws_billingconductor/__init__.py +12 -7
  15. aws_cdk/aws_budgets/__init__.py +8 -17
  16. aws_cdk/aws_certificatemanager/__init__.py +7 -4
  17. aws_cdk/aws_cloudfront/__init__.py +14 -11
  18. aws_cdk/aws_cloudfront_origins/__init__.py +18 -8
  19. aws_cdk/aws_cloudtrail/__init__.py +7 -14
  20. aws_cdk/aws_cloudwatch/__init__.py +63 -35
  21. aws_cdk/aws_codebuild/__init__.py +10 -13
  22. aws_cdk/aws_codecommit/__init__.py +0 -1
  23. aws_cdk/aws_codedeploy/__init__.py +165 -162
  24. aws_cdk/aws_codegurureviewer/__init__.py +4 -4
  25. aws_cdk/aws_codepipeline/__init__.py +0 -4
  26. aws_cdk/aws_codepipeline_actions/__init__.py +16 -164
  27. aws_cdk/aws_cognito/__init__.py +195 -100
  28. aws_cdk/aws_config/__init__.py +28 -51
  29. aws_cdk/aws_connectcampaigns/__init__.py +5 -6
  30. aws_cdk/aws_databrew/__init__.py +5 -6
  31. aws_cdk/aws_dlm/__init__.py +33 -71
  32. aws_cdk/aws_docdb/__init__.py +20 -76
  33. aws_cdk/aws_dynamodb/__init__.py +29 -22
  34. aws_cdk/aws_ec2/__init__.py +2414 -603
  35. aws_cdk/aws_ecr/__init__.py +1 -2
  36. aws_cdk/aws_ecr_assets/__init__.py +27 -14
  37. aws_cdk/aws_ecs/__init__.py +458 -163
  38. aws_cdk/aws_ecs_patterns/__init__.py +13 -11
  39. aws_cdk/aws_eks/__init__.py +13 -8
  40. aws_cdk/aws_elasticloadbalancing/__init__.py +16 -9
  41. aws_cdk/aws_elasticloadbalancingv2/__init__.py +142 -82
  42. aws_cdk/aws_elasticloadbalancingv2_actions/__init__.py +126 -61
  43. aws_cdk/aws_elasticsearch/__init__.py +0 -7
  44. aws_cdk/aws_emr/__init__.py +7 -16
  45. aws_cdk/aws_emrserverless/__init__.py +14 -18
  46. aws_cdk/aws_events/__init__.py +33 -29
  47. aws_cdk/aws_events_targets/__init__.py +248 -89
  48. aws_cdk/aws_frauddetector/__init__.py +3 -4
  49. aws_cdk/aws_fsx/__init__.py +13 -7
  50. aws_cdk/aws_gamelift/__init__.py +11 -20
  51. aws_cdk/aws_grafana/__init__.py +4 -4
  52. aws_cdk/aws_iam/__init__.py +21 -25
  53. aws_cdk/aws_imagebuilder/__init__.py +58 -80
  54. aws_cdk/aws_internetmonitor/__init__.py +18 -10
  55. aws_cdk/aws_iot/__init__.py +16 -10
  56. aws_cdk/aws_iotcoredeviceadvisor/__init__.py +16 -26
  57. aws_cdk/aws_iotevents/__init__.py +6 -4
  58. aws_cdk/aws_iotfleetwise/__init__.py +27 -40
  59. aws_cdk/aws_iotsitewise/__init__.py +8 -5
  60. aws_cdk/aws_iotwireless/__init__.py +14 -9
  61. aws_cdk/aws_kinesisfirehose/__init__.py +21 -38
  62. aws_cdk/aws_lambda/__init__.py +76 -53
  63. aws_cdk/aws_lambda_event_sources/__init__.py +6 -21
  64. aws_cdk/aws_logs/__init__.py +5 -7
  65. aws_cdk/aws_macie/__init__.py +28 -23
  66. aws_cdk/aws_mediaconnect/__init__.py +5 -8
  67. aws_cdk/aws_mediaconvert/__init__.py +2 -2
  68. aws_cdk/aws_medialive/__init__.py +2 -4
  69. aws_cdk/aws_mediapackage/__init__.py +9 -18
  70. aws_cdk/aws_memorydb/__init__.py +5 -10
  71. aws_cdk/aws_mwaa/__init__.py +8 -4
  72. aws_cdk/aws_neptune/__init__.py +4 -4
  73. aws_cdk/aws_networkfirewall/__init__.py +8 -4
  74. aws_cdk/aws_networkmanager/__init__.py +4 -4
  75. aws_cdk/aws_nimblestudio/__init__.py +25 -45
  76. aws_cdk/aws_opensearchservice/__init__.py +0 -1
  77. aws_cdk/aws_panorama/__init__.py +11 -12
  78. aws_cdk/aws_personalize/__init__.py +46 -72
  79. aws_cdk/aws_pinpoint/__init__.py +36 -65
  80. aws_cdk/aws_quicksight/__init__.py +9972 -13374
  81. aws_cdk/aws_rds/__init__.py +53 -22
  82. aws_cdk/aws_route53/__init__.py +8 -16
  83. aws_cdk/aws_route53_targets/__init__.py +2 -4
  84. aws_cdk/aws_s3/__init__.py +41 -90
  85. aws_cdk/aws_s3_notifications/__init__.py +0 -3
  86. aws_cdk/aws_sagemaker/__init__.py +16 -10
  87. aws_cdk/aws_secretsmanager/__init__.py +17 -14
  88. aws_cdk/aws_servicecatalog/__init__.py +60 -83
  89. aws_cdk/aws_servicediscovery/__init__.py +4 -6
  90. aws_cdk/aws_ses/__init__.py +734 -28
  91. aws_cdk/aws_sns/__init__.py +4 -8
  92. aws_cdk/aws_ssm/__init__.py +19 -23
  93. aws_cdk/aws_ssmcontacts/__init__.py +10 -6
  94. aws_cdk/aws_ssmincidents/__init__.py +2 -1
  95. aws_cdk/aws_sso/__init__.py +4 -4
  96. aws_cdk/aws_stepfunctions/__init__.py +6 -15
  97. aws_cdk/aws_stepfunctions_tasks/__init__.py +51 -24
  98. aws_cdk/aws_timestream/__init__.py +22 -28
  99. aws_cdk/aws_transfer/__init__.py +188 -86
  100. aws_cdk/aws_wafv2/__init__.py +54 -38
  101. aws_cdk/aws_xray/__init__.py +15 -22
  102. aws_cdk/cloud_assembly_schema/__init__.py +14 -6
  103. aws_cdk/custom_resources/__init__.py +2 -3
  104. aws_cdk/pipelines/__init__.py +104 -134
  105. aws_cdk/triggers/__init__.py +46 -61
  106. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/METADATA +47 -92
  107. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/RECORD +111 -111
  108. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/LICENSE +0 -0
  109. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/NOTICE +0 -0
  110. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/WHEEL +0 -0
  111. {aws_cdk_lib-2.73.0.dist-info → aws_cdk_lib-2.76.0.dist-info}/top_level.txt +0 -0
@@ -880,6 +880,7 @@ stack.node.set_context(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, True)
880
880
  The following is an example of an application with the REMOVE_DEFAULT_DESIRED_COUNT feature flag enabled:
881
881
 
882
882
  ```python
883
+ from constructs import Construct
883
884
  from aws_cdk import App, Stack
884
885
  import aws_cdk.aws_ec2 as ec2
885
886
  import aws_cdk.aws_ecs as ecs
@@ -887,20 +888,21 @@ import aws_cdk.aws_ecs_patterns as ecs_patterns
887
888
  import aws_cdk.cx_api as cxapi
888
889
  import path as path
889
890
 
890
- app = App()
891
+ class MyStack(Stack):
892
+ def __init__(self, scope, id):
893
+ super().__init__(scope, id)
891
894
 
892
- stack = Stack(app, "aws-ecs-patterns-queue")
893
- stack.node.set_context(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, True)
895
+ self.node.set_context(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, True)
894
896
 
895
- vpc = ec2.Vpc(stack, "VPC",
896
- max_azs=2
897
- )
897
+ vpc = ec2.Vpc(self, "VPC",
898
+ max_azs=2
899
+ )
898
900
 
899
- ecs_patterns.QueueProcessingFargateService(stack, "QueueProcessingService",
900
- vpc=vpc,
901
- memory_limit_mi_b=512,
902
- image=ecs.AssetImage(path.join(__dirname, "..", "sqs-reader"))
903
- )
901
+ ecs_patterns.QueueProcessingFargateService(self, "QueueProcessingService",
902
+ vpc=vpc,
903
+ memory_limit_mi_b=512,
904
+ image=ecs.AssetImage(path.join(__dirname, "..", "sqs-reader"))
905
+ )
904
906
  ```
905
907
 
906
908
  ### Deploy application and metrics sidecar
@@ -41,7 +41,10 @@ This example defines an Amazon EKS cluster with the following configuration:
41
41
 
42
42
  ```python
43
43
  # Example automatically generated from non-compiling source. May contain errors.
44
- # provisiong a cluster
44
+ from aws_cdk.lambda_layer_kubectl_v25 import KubectlV25Layer
45
+
46
+
47
+ # provisioning a cluster
45
48
  cluster = eks.Cluster(self, "hello-eks",
46
49
  version=eks.KubernetesVersion.V1_25,
47
50
  kubectl_layer=KubectlV25Layer(self, "kubectl")
@@ -687,7 +690,7 @@ version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` pac
687
690
 
688
691
  ```python
689
692
  # Example automatically generated from non-compiling source. May contain errors.
690
- from aws_cdk_lib.lambda_layer_kubectl_v25 import KubectlV25Layer
693
+ from aws_cdk.lambda_layer_kubectl_v25 import KubectlV25Layer
691
694
 
692
695
 
693
696
  cluster = eks.Cluster(self, "hello-eks",
@@ -1191,7 +1194,9 @@ cluster.add_helm_chart("test-chart",
1191
1194
  Nested values passed to the `values` parameter should be provided as a nested dictionary:
1192
1195
 
1193
1196
  ```python
1194
- # Example automatically generated from non-compiling source. May contain errors.
1197
+ # cluster: eks.Cluster
1198
+
1199
+
1195
1200
  cluster.add_helm_chart("ExternalSecretsOperator",
1196
1201
  chart="external-secrets",
1197
1202
  release="external-secrets",
@@ -1282,12 +1287,12 @@ To get started, add the following dependencies to your `package.json` file:
1282
1287
  ```json
1283
1288
  "dependencies": {
1284
1289
  "cdk8s": "^2.0.0",
1285
- "cdk8s-plus-22": "^2.0.0-rc.30",
1290
+ "cdk8s-plus-25": "^2.0.0",
1286
1291
  "constructs": "^10.0.0"
1287
1292
  }
1288
1293
  ```
1289
1294
 
1290
- Note that here we are using `cdk8s-plus-22` as we are targeting Kubernetes version 1.22.0. If you operate a different kubernetes version, you should
1295
+ Note that here we are using `cdk8s-plus-25` as we are targeting Kubernetes version 1.25.0. If you operate a different kubernetes version, you should
1291
1296
  use the corresponding `cdk8s-plus-XX` library.
1292
1297
  See [Select the appropriate cdk8s+ library](https://cdk8s.io/docs/latest/plus/#i-operate-kubernetes-version-1xx-which-cdk8s-library-should-i-be-using)
1293
1298
  for more details.
@@ -1304,7 +1309,7 @@ In this example we create a chart that accepts an `s3.Bucket` and passes its nam
1304
1309
  from aws_cdk import aws_s3 as s3
1305
1310
  import constructs as constructs
1306
1311
  import cdk8s as cdk8s
1307
- import cdk8s_plus_22 as kplus
1312
+ import cdk8s_plus_25 as kplus
1308
1313
 
1309
1314
  class MyChart(cdk8s.Chart):
1310
1315
  def __init__(self, scope, id, *, bucket):
@@ -1341,14 +1346,14 @@ cluster.add_cdk8s_chart("my-chart", my_chart)
1341
1346
  #### Custom CDK8s Constructs
1342
1347
 
1343
1348
  You can also compose a few stock `cdk8s+` constructs into your own custom construct. However, since mixing scopes between `aws-cdk` and `cdk8s` is currently not supported, the `Construct` class
1344
- you'll need to use is the one from the [`constructs`](https://github.com/aws/constructs) module, and not from `@aws-cdk/core` like you normally would.
1349
+ you'll need to use is the one from the [`constructs`](https://github.com/aws/constructs) module, and not from `aws-cdk-lib` like you normally would.
1345
1350
  This is why we used `new cdk8s.App()` as the scope of the chart above.
1346
1351
 
1347
1352
  ```python
1348
1353
  # Example automatically generated from non-compiling source. May contain errors.
1349
1354
  import constructs as constructs
1350
1355
  import cdk8s as cdk8s
1351
- import cdk8s_plus_21 as kplus
1356
+ import cdk8s_plus_25 as kplus
1352
1357
 
1353
1358
  app = cdk8s.App()
1354
1359
  chart = cdk8s.Chart(app, "my-chart")
@@ -46,15 +46,17 @@ lb.add_listener(
46
46
  You can add an EC2 instance to the load balancer by calling using `new InstanceTarget` as the argument to `addTarget()`:
47
47
 
48
48
  ```python
49
- # Example automatically generated from non-compiling source. May contain errors.
49
+ # vpc: ec2.IVpc
50
+
50
51
  lb = elb.LoadBalancer(self, "LB",
51
52
  vpc=vpc
52
53
  )
54
+
53
55
  # instance to add as the target for load balancer.
54
- instance = Instance(stack, "targetInstance",
56
+ instance = ec2.Instance(self, "targetInstance",
55
57
  vpc=vpc,
56
- instance_type=InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO),
57
- machine_image=AmazonLinuxImage()
58
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
59
+ machine_image=ec2.AmazonLinuxImage(generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2)
58
60
  )
59
61
  lb.add_target(elb.InstanceTarget(instance))
60
62
  ```
@@ -2072,15 +2074,17 @@ class InstanceTarget(
2072
2074
 
2073
2075
  Example::
2074
2076
 
2075
- # Example automatically generated from non-compiling source. May contain errors.
2077
+ # vpc: ec2.IVpc
2078
+
2076
2079
  lb = elb.LoadBalancer(self, "LB",
2077
2080
  vpc=vpc
2078
2081
  )
2082
+
2079
2083
  # instance to add as the target for load balancer.
2080
- instance = Instance(stack, "targetInstance",
2084
+ instance = ec2.Instance(self, "targetInstance",
2081
2085
  vpc=vpc,
2082
- instance_type=InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO),
2083
- machine_image=AmazonLinuxImage()
2086
+ instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO),
2087
+ machine_image=ec2.AmazonLinuxImage(generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2)
2084
2088
  )
2085
2089
  lb.add_target(elb.InstanceTarget(instance))
2086
2090
  '''
@@ -2570,7 +2574,10 @@ class LoadBalancerProps:
2570
2574
 
2571
2575
  lb = elb.LoadBalancer(self, "LB", vpc=vpc)
2572
2576
  lb.add_listener(external_port=80)
2573
- lb.add_target(service)
2577
+ lb.add_target(service.load_balancer_target(
2578
+ container_name="MyContainer",
2579
+ container_port=80
2580
+ ))
2574
2581
  '''
2575
2582
  if isinstance(access_logging_policy, dict):
2576
2583
  access_logging_policy = CfnLoadBalancer.AccessLoggingPolicyProperty(**access_logging_policy)
@@ -17,7 +17,6 @@ and adding Targets to the Listener:
17
17
  ```python
18
18
  from aws_cdk.aws_autoscaling import AutoScalingGroup
19
19
  # asg: AutoScalingGroup
20
-
21
20
  # vpc: ec2.Vpc
22
21
 
23
22
 
@@ -204,7 +203,9 @@ ingress rules then set `open: false` and use the listener's `connections` object
204
203
  You can modify attributes of Application Load Balancers:
205
204
 
206
205
  ```python
207
- # Example automatically generated from non-compiling source. May contain errors.
206
+ # vpc: ec2.Vpc
207
+
208
+
208
209
  lb = elbv2.ApplicationLoadBalancer(self, "LB",
209
210
  vpc=vpc,
210
211
  internet_facing=True,
@@ -213,7 +214,7 @@ lb = elbv2.ApplicationLoadBalancer(self, "LB",
213
214
  http2_enabled=False,
214
215
 
215
216
  # The idle timeout value, in seconds
216
- idle_timeout=cdk.Duration.seconds(1000),
217
+ idle_timeout=Duration.seconds(1000),
217
218
 
218
219
  # Whether HTTP headers with header fields thatare not valid
219
220
  # are removed by the load balancer (true), or routed to targets
@@ -616,7 +617,6 @@ You may create metrics for Load Balancers and Target Groups through the `metrics
616
617
  **Load Balancer:**
617
618
 
618
619
  ```python
619
- # Example automatically generated from non-compiling source. May contain errors.
620
620
  # alb: elbv2.IApplicationLoadBalancer
621
621
 
622
622
 
@@ -627,7 +627,6 @@ metric_connection_count = alb_metrics.active_connection_count()
627
627
  **Target Group:**
628
628
 
629
629
  ```python
630
- # Example automatically generated from non-compiling source. May contain errors.
631
630
  # target_group: elbv2.IApplicationTargetGroup
632
631
 
633
632
 
@@ -638,11 +637,10 @@ metric_healthy_host_count = target_group_metrics.healthy_host_count()
638
637
  Metrics are also available to imported resources:
639
638
 
640
639
  ```python
641
- # Example automatically generated from non-compiling source. May contain errors.
642
640
  # stack: Stack
643
641
 
644
642
 
645
- target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(stack, "MyTargetGroup",
643
+ target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(self, "MyTargetGroup",
646
644
  target_group_arn=Fn.import_value("TargetGroupArn"),
647
645
  load_balancer_arns=Fn.import_value("LoadBalancerArn")
648
646
  )
@@ -654,10 +652,9 @@ Notice that TargetGroups must be imported by supplying the Load Balancer too, ot
654
652
  throw an error:
655
653
 
656
654
  ```python
657
- # Example automatically generated from non-compiling source. May contain errors.
658
655
  # stack: Stack
659
656
 
660
- target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(stack, "MyTargetGroup",
657
+ target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(self, "MyTargetGroup",
661
658
  target_group_arn=Fn.import_value("TargetGroupArn")
662
659
  )
663
660
 
@@ -1956,18 +1953,20 @@ class BaseApplicationListenerProps:
1956
1953
 
1957
1954
  Example::
1958
1955
 
1959
- from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpAlbIntegration
1960
-
1961
- # lb: elbv2.ApplicationLoadBalancer
1956
+ # cluster: ecs.Cluster
1957
+ # task_definition: ecs.TaskDefinition
1958
+ # vpc: ec2.Vpc
1962
1959
 
1963
- listener = lb.add_listener("listener", port=80)
1964
- listener.add_targets("target",
1965
- port=80
1966
- )
1960
+ service = ecs.FargateService(self, "Service", cluster=cluster, task_definition=task_definition)
1967
1961
 
1968
- http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
1969
- default_integration=HttpAlbIntegration("DefaultIntegration", listener,
1970
- parameter_mapping=apigwv2.ParameterMapping().custom("myKey", "myValue")
1962
+ lb = elbv2.ApplicationLoadBalancer(self, "LB", vpc=vpc, internet_facing=True)
1963
+ listener = lb.add_listener("Listener", port=80)
1964
+ service.register_load_balancer_targets(
1965
+ container_name="web",
1966
+ container_port=80,
1967
+ new_target_group_id="ECS",
1968
+ listener=ecs.ListenerConfig.application_listener(listener,
1969
+ protocol=elbv2.ApplicationProtocol.HTTPS
1971
1970
  )
1972
1971
  )
1973
1972
  '''
@@ -9564,7 +9563,9 @@ class DesyncMitigationMode(enum.Enum):
9564
9563
 
9565
9564
  Example::
9566
9565
 
9567
- # Example automatically generated from non-compiling source. May contain errors.
9566
+ # vpc: ec2.Vpc
9567
+
9568
+
9568
9569
  lb = elbv2.ApplicationLoadBalancer(self, "LB",
9569
9570
  vpc=vpc,
9570
9571
  internet_facing=True,
@@ -9573,7 +9574,7 @@ class DesyncMitigationMode(enum.Enum):
9573
9574
  http2_enabled=False,
9574
9575
 
9575
9576
  # The idle timeout value, in seconds
9576
- idle_timeout=cdk.Duration.seconds(1000),
9577
+ idle_timeout=Duration.seconds(1000),
9577
9578
 
9578
9579
  # Whether HTTP headers with header fields thatare not valid
9579
9580
  # are removed by the load balancer (true), or routed to targets
@@ -9974,7 +9975,66 @@ class HttpCodeElb(enum.Enum):
9974
9975
 
9975
9976
  @jsii.enum(jsii_type="aws-cdk-lib.aws_elasticloadbalancingv2.HttpCodeTarget")
9976
9977
  class HttpCodeTarget(enum.Enum):
9977
- '''Count of HTTP status originating from the targets.'''
9978
+ '''Count of HTTP status originating from the targets.
9979
+
9980
+ :exampleMetadata: infused
9981
+
9982
+ Example::
9983
+
9984
+ import aws_cdk.aws_cloudwatch as cloudwatch
9985
+
9986
+ # service: ecs.FargateService
9987
+ # blue_target_group: elbv2.ApplicationTargetGroup
9988
+ # green_target_group: elbv2.ApplicationTargetGroup
9989
+ # listener: elbv2.IApplicationListener
9990
+
9991
+
9992
+ # Alarm on the number of unhealthy ECS tasks in each target group
9993
+ blue_unhealthy_hosts = cloudwatch.Alarm(self, "BlueUnhealthyHosts",
9994
+ alarm_name=Stack.of(self).stack_name + "-Unhealthy-Hosts-Blue",
9995
+ metric=blue_target_group.metric_unhealthy_host_count(),
9996
+ threshold=1,
9997
+ evaluation_periods=2
9998
+ )
9999
+
10000
+ green_unhealthy_hosts = cloudwatch.Alarm(self, "GreenUnhealthyHosts",
10001
+ alarm_name=Stack.of(self).stack_name + "-Unhealthy-Hosts-Green",
10002
+ metric=green_target_group.metric_unhealthy_host_count(),
10003
+ threshold=1,
10004
+ evaluation_periods=2
10005
+ )
10006
+
10007
+ # Alarm on the number of HTTP 5xx responses returned by each target group
10008
+ blue_api_failure = cloudwatch.Alarm(self, "Blue5xx",
10009
+ alarm_name=Stack.of(self).stack_name + "-Http-5xx-Blue",
10010
+ metric=blue_target_group.metric_http_code_target(elbv2.HttpCodeTarget.TARGET_5XX_COUNT, period=Duration.minutes(1)),
10011
+ threshold=1,
10012
+ evaluation_periods=1
10013
+ )
10014
+
10015
+ green_api_failure = cloudwatch.Alarm(self, "Green5xx",
10016
+ alarm_name=Stack.of(self).stack_name + "-Http-5xx-Green",
10017
+ metric=green_target_group.metric_http_code_target(elbv2.HttpCodeTarget.TARGET_5XX_COUNT, period=Duration.minutes(1)),
10018
+ threshold=1,
10019
+ evaluation_periods=1
10020
+ )
10021
+
10022
+ codedeploy.EcsDeploymentGroup(self, "BlueGreenDG",
10023
+ # CodeDeploy will monitor these alarms during a deployment and automatically roll back
10024
+ alarms=[blue_unhealthy_hosts, green_unhealthy_hosts, blue_api_failure, green_api_failure],
10025
+ auto_rollback=codedeploy.AutoRollbackConfig(
10026
+ # CodeDeploy will automatically roll back if a deployment is stopped
10027
+ stopped_deployment=True
10028
+ ),
10029
+ service=service,
10030
+ blue_green_deployment_config=codedeploy.EcsBlueGreenDeploymentConfig(
10031
+ blue_target_group=blue_target_group,
10032
+ green_target_group=green_target_group,
10033
+ listener=listener
10034
+ ),
10035
+ deployment_config=codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES
10036
+ )
10037
+ '''
9978
10038
 
9979
10039
  TARGET_2XX_COUNT = "TARGET_2XX_COUNT"
9980
10040
  '''The number of 2xx response codes from targets.'''
@@ -13589,16 +13649,21 @@ class ListenerAction(
13589
13649
  Example::
13590
13650
 
13591
13651
  # listener: elbv2.ApplicationListener
13652
+ # my_target_group: elbv2.ApplicationTargetGroup
13592
13653
 
13593
13654
 
13594
- listener.add_action("Fixed",
13595
- priority=10,
13596
- conditions=[
13597
- elbv2.ListenerCondition.path_patterns(["/ok"])
13598
- ],
13599
- action=elbv2.ListenerAction.fixed_response(200,
13600
- content_type="text/plain",
13601
- message_body="OK"
13655
+ listener.add_action("DefaultAction",
13656
+ action=elbv2.ListenerAction.authenticate_oidc(
13657
+ authorization_endpoint="https://example.com/openid",
13658
+ # Other OIDC properties here
13659
+ client_id="...",
13660
+ client_secret=SecretValue.secrets_manager("..."),
13661
+ issuer="...",
13662
+ token_endpoint="...",
13663
+ user_info_endpoint="...",
13664
+
13665
+ # Next
13666
+ next=elbv2.ListenerAction.forward([my_target_group])
13602
13667
  )
13603
13668
  )
13604
13669
  '''
@@ -14617,18 +14682,23 @@ class NetworkLoadBalancer(
14617
14682
 
14618
14683
  Example::
14619
14684
 
14620
- from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpNlbIntegration
14685
+ import aws_cdk.aws_elasticloadbalancingv2 as elbv2
14621
14686
 
14622
14687
 
14623
14688
  vpc = ec2.Vpc(self, "VPC")
14624
- lb = elbv2.NetworkLoadBalancer(self, "lb", vpc=vpc)
14625
- listener = lb.add_listener("listener", port=80)
14626
- listener.add_targets("target",
14627
- port=80
14689
+ nlb = elbv2.NetworkLoadBalancer(self, "NLB",
14690
+ vpc=vpc
14691
+ )
14692
+ link = apigateway.VpcLink(self, "link",
14693
+ targets=[nlb]
14628
14694
  )
14629
14695
 
14630
- http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
14631
- default_integration=HttpNlbIntegration("DefaultIntegration", listener)
14696
+ integration = apigateway.Integration(
14697
+ type=apigateway.IntegrationType.HTTP_PROXY,
14698
+ options=apigateway.IntegrationOptions(
14699
+ connection_type=apigateway.ConnectionType.VPC_LINK,
14700
+ vpc_link=link
14701
+ )
14632
14702
  )
14633
14703
  '''
14634
14704
 
@@ -15370,18 +15440,23 @@ class NetworkLoadBalancerProps(BaseLoadBalancerProps):
15370
15440
 
15371
15441
  Example::
15372
15442
 
15373
- from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpNlbIntegration
15443
+ import aws_cdk.aws_elasticloadbalancingv2 as elbv2
15374
15444
 
15375
15445
 
15376
15446
  vpc = ec2.Vpc(self, "VPC")
15377
- lb = elbv2.NetworkLoadBalancer(self, "lb", vpc=vpc)
15378
- listener = lb.add_listener("listener", port=80)
15379
- listener.add_targets("target",
15380
- port=80
15447
+ nlb = elbv2.NetworkLoadBalancer(self, "NLB",
15448
+ vpc=vpc
15449
+ )
15450
+ link = apigateway.VpcLink(self, "link",
15451
+ targets=[nlb]
15381
15452
  )
15382
15453
 
15383
- http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
15384
- default_integration=HttpNlbIntegration("DefaultIntegration", listener)
15454
+ integration = apigateway.Integration(
15455
+ type=apigateway.IntegrationType.HTTP_PROXY,
15456
+ options=apigateway.IntegrationOptions(
15457
+ connection_type=apigateway.ConnectionType.VPC_LINK,
15458
+ vpc_link=link
15459
+ )
15385
15460
  )
15386
15461
  '''
15387
15462
  if isinstance(vpc_subnets, dict):
@@ -16289,11 +16364,10 @@ class TargetGroupAttributes:
16289
16364
 
16290
16365
  Example::
16291
16366
 
16292
- # Example automatically generated from non-compiling source. May contain errors.
16293
16367
  # stack: Stack
16294
16368
 
16295
16369
 
16296
- target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(stack, "MyTargetGroup",
16370
+ target_group = elbv2.ApplicationTargetGroup.from_target_group_attributes(self, "MyTargetGroup",
16297
16371
  target_group_arn=Fn.import_value("TargetGroupArn"),
16298
16372
  load_balancer_arns=Fn.import_value("LoadBalancerArn")
16299
16373
  )
@@ -16944,7 +17018,6 @@ class AddApplicationTargetsProps(AddRuleProps):
16944
17018
 
16945
17019
  from aws_cdk.aws_autoscaling import AutoScalingGroup
16946
17020
  # asg: AutoScalingGroup
16947
-
16948
17021
  # vpc: ec2.Vpc
16949
17022
 
16950
17023
 
@@ -17754,35 +17827,21 @@ class ApplicationLoadBalancerProps(BaseLoadBalancerProps):
17754
17827
 
17755
17828
  Example::
17756
17829
 
17757
- from aws_cdk.aws_autoscaling import AutoScalingGroup
17758
- # asg: AutoScalingGroup
17759
-
17830
+ # cluster: ecs.Cluster
17831
+ # task_definition: ecs.TaskDefinition
17760
17832
  # vpc: ec2.Vpc
17761
17833
 
17834
+ service = ecs.FargateService(self, "Service", cluster=cluster, task_definition=task_definition)
17762
17835
 
17763
- # Create the load balancer in a VPC. 'internetFacing' is 'false'
17764
- # by default, which creates an internal load balancer.
17765
- lb = elbv2.ApplicationLoadBalancer(self, "LB",
17766
- vpc=vpc,
17767
- internet_facing=True
17768
- )
17769
-
17770
- # Add a listener and open up the load balancer's security group
17771
- # to the world.
17772
- listener = lb.add_listener("Listener",
17773
- port=80,
17774
-
17775
- # 'open: true' is the default, you can leave it out if you want. Set it
17776
- # to 'false' and use `listener.connections` if you want to be selective
17777
- # about who can access the load balancer.
17778
- open=True
17779
- )
17780
-
17781
- # Create an AutoScaling group and add it as a load balancing
17782
- # target to the listener.
17783
- listener.add_targets("ApplicationFleet",
17784
- port=8080,
17785
- targets=[asg]
17836
+ lb = elbv2.ApplicationLoadBalancer(self, "LB", vpc=vpc, internet_facing=True)
17837
+ listener = lb.add_listener("Listener", port=80)
17838
+ service.register_load_balancer_targets(
17839
+ container_name="web",
17840
+ container_port=80,
17841
+ new_target_group_id="ECS",
17842
+ listener=ecs.ListenerConfig.application_listener(listener,
17843
+ protocol=elbv2.ApplicationProtocol.HTTPS
17844
+ )
17786
17845
  )
17787
17846
  '''
17788
17847
  if isinstance(vpc_subnets, dict):
@@ -19430,15 +19489,19 @@ class ApplicationListener(
19430
19489
 
19431
19490
  Example::
19432
19491
 
19433
- import aws_cdk.aws_elasticloadbalancingv2 as elbv2
19492
+ from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpAlbIntegration
19434
19493
 
19435
- # alb: elbv2.ApplicationLoadBalancer
19494
+ # lb: elbv2.ApplicationLoadBalancer
19436
19495
 
19437
- listener = alb.add_listener("Listener", port=80)
19438
- target_group = listener.add_targets("Fleet", port=80)
19496
+ listener = lb.add_listener("listener", port=80)
19497
+ listener.add_targets("target",
19498
+ port=80
19499
+ )
19439
19500
 
19440
- deployment_group = codedeploy.ServerDeploymentGroup(self, "DeploymentGroup",
19441
- load_balancer=codedeploy.LoadBalancer.application(target_group)
19501
+ http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
19502
+ default_integration=HttpAlbIntegration("DefaultIntegration", listener,
19503
+ parameter_mapping=apigwv2.ParameterMapping().custom("myKey", "myValue")
19504
+ )
19442
19505
  )
19443
19506
  '''
19444
19507
 
@@ -19759,7 +19822,6 @@ class ApplicationLoadBalancer(
19759
19822
 
19760
19823
  from aws_cdk.aws_autoscaling import AutoScalingGroup
19761
19824
  # asg: AutoScalingGroup
19762
-
19763
19825
  # vpc: ec2.Vpc
19764
19826
 
19765
19827
 
@@ -21050,8 +21112,6 @@ class ApplicationTargetGroup(
21050
21112
 
21051
21113
  Example::
21052
21114
 
21053
- import aws_cdk.aws_elasticloadbalancingv2 as elbv2
21054
-
21055
21115
  # alb: elbv2.ApplicationLoadBalancer
21056
21116
 
21057
21117
  listener = alb.add_listener("Listener", port=80)