aws-cdk-lib 2.203.1__py3-none-any.whl → 2.205.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 (62) hide show
  1. aws_cdk/__init__.py +208 -92
  2. aws_cdk/_jsii/__init__.py +1 -1
  3. aws_cdk/_jsii/{aws-cdk-lib@2.203.1.jsii.tgz → aws-cdk-lib@2.205.0.jsii.tgz} +0 -0
  4. aws_cdk/aws_aiops/__init__.py +89 -39
  5. aws_cdk/aws_apigateway/__init__.py +164 -0
  6. aws_cdk/aws_apigatewayv2/__init__.py +412 -0
  7. aws_cdk/aws_applicationautoscaling/__init__.py +2 -2
  8. aws_cdk/aws_arczonalshift/__init__.py +4 -1
  9. aws_cdk/aws_b2bi/__init__.py +32 -16
  10. aws_cdk/aws_bedrock/__init__.py +198 -10
  11. aws_cdk/aws_cassandra/__init__.py +156 -0
  12. aws_cdk/aws_certificatemanager/__init__.py +28 -0
  13. aws_cdk/aws_chatbot/__init__.py +28 -0
  14. aws_cdk/aws_cloudformation/__init__.py +74 -72
  15. aws_cdk/aws_cloudfront/__init__.py +1273 -485
  16. aws_cdk/aws_cloudfront/experimental/__init__.py +32 -0
  17. aws_cdk/aws_cloudfront_origins/__init__.py +26 -21
  18. aws_cdk/aws_cloudwatch/__init__.py +278 -23
  19. aws_cdk/aws_codebuild/__init__.py +300 -36
  20. aws_cdk/aws_datasync/__init__.py +2 -2
  21. aws_cdk/aws_docdb/__init__.py +78 -0
  22. aws_cdk/aws_dynamodb/__init__.py +523 -37
  23. aws_cdk/aws_ec2/__init__.py +126 -30
  24. aws_cdk/aws_ecs/__init__.py +64 -19
  25. aws_cdk/aws_elasticloadbalancingv2/__init__.py +724 -0
  26. aws_cdk/aws_elasticsearch/__init__.py +260 -0
  27. aws_cdk/aws_emrserverless/__init__.py +5 -5
  28. aws_cdk/aws_events/__init__.py +58 -3
  29. aws_cdk/aws_events_targets/__init__.py +7 -2
  30. aws_cdk/aws_evs/__init__.py +7 -7
  31. aws_cdk/aws_fsx/__init__.py +138 -78
  32. aws_cdk/aws_gamelift/__init__.py +19 -0
  33. aws_cdk/aws_glue/__init__.py +3 -3
  34. aws_cdk/aws_iot/__init__.py +1 -1
  35. aws_cdk/aws_kinesis/__init__.py +391 -13
  36. aws_cdk/aws_kinesisfirehose/__init__.py +128 -1
  37. aws_cdk/aws_lambda/__init__.py +144 -0
  38. aws_cdk/aws_lex/__init__.py +36 -19
  39. aws_cdk/aws_logs/__init__.py +58 -0
  40. aws_cdk/aws_neptune/__init__.py +12 -12
  41. aws_cdk/aws_odb/__init__.py +4049 -0
  42. aws_cdk/aws_omics/__init__.py +1 -1
  43. aws_cdk/aws_opensearchservice/__init__.py +260 -0
  44. aws_cdk/aws_qbusiness/__init__.py +471 -4
  45. aws_cdk/aws_quicksight/__init__.py +185 -16
  46. aws_cdk/aws_rds/__init__.py +553 -17
  47. aws_cdk/aws_redshiftserverless/__init__.py +72 -45
  48. aws_cdk/aws_route53/__init__.py +41 -19
  49. aws_cdk/aws_s3tables/__init__.py +1005 -0
  50. aws_cdk/aws_sagemaker/__init__.py +20 -0
  51. aws_cdk/aws_scheduler/__init__.py +210 -0
  52. aws_cdk/aws_sns/__init__.py +164 -0
  53. aws_cdk/aws_sqs/__init__.py +164 -0
  54. aws_cdk/aws_stepfunctions/__init__.py +288 -0
  55. aws_cdk/aws_synthetics/__init__.py +159 -37
  56. aws_cdk/aws_transfer/__init__.py +23 -1
  57. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/METADATA +2 -2
  58. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/RECORD +62 -61
  59. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/LICENSE +0 -0
  60. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/NOTICE +0 -0
  61. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/WHEEL +0 -0
  62. {aws_cdk_lib-2.203.1.dist-info → aws_cdk_lib-2.205.0.dist-info}/top_level.txt +0 -0
@@ -88,6 +88,28 @@ schedule = synthetics.Schedule.cron(
88
88
 
89
89
  If you want the canary to run just once upon deployment, you can use `Schedule.once()`.
90
90
 
91
+ ### Automatic Retries
92
+
93
+ You can configure the canary to automatically retry failed runs by using the `maxRetries` property.
94
+
95
+ This is only supported on the following runtimes or newer: `Runtime.SYNTHETICS_NODEJS_PUPPETEER_10_0`, `Runtime.SYNTHETICS_NODEJS_PLAYWRIGHT_2_0`, `Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1`.
96
+
97
+ Max retries can be set between 0 and 2. Canaries which time out after 10 minutes are automatically limited to one retry.
98
+
99
+ For more information, see [Configuring your canary to retry automatically](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_autoretry.html).
100
+
101
+ ```python
102
+ canary = synthetics.Canary(self, "MyCanary",
103
+ schedule=synthetics.Schedule.rate(Duration.minutes(5)),
104
+ test=synthetics.Test.custom(
105
+ handler="canary.handler",
106
+ code=synthetics.Code.from_asset(path.join(__dirname, "canaries"))
107
+ ),
108
+ runtime=synthetics.Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1,
109
+ max_retries=2
110
+ )
111
+ ```
112
+
91
113
  ### Active Tracing
92
114
 
93
115
  You can choose to enable active AWS X-Ray tracing on canaries that use the `syn-nodejs-2.0` or later runtime by setting `activeTracing` to `true`.
@@ -372,6 +394,24 @@ canary = synthetics.Canary(self, "MyCanary",
372
394
  artifact_s3_kms_key=key
373
395
  )
374
396
  ```
397
+
398
+ ### Tag replication
399
+
400
+ You can configure a canary to replicate its tags to the underlying Lambda function. This is useful when you want the same tags that are applied to the canary to also be applied to the Lambda function that the canary uses.
401
+
402
+ ```python
403
+ canary = synthetics.Canary(self, "MyCanary",
404
+ schedule=synthetics.Schedule.rate(Duration.minutes(5)),
405
+ test=synthetics.Test.custom(
406
+ code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
407
+ handler="index.handler"
408
+ ),
409
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
410
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
411
+ )
412
+ ```
413
+
414
+ When you specify `ResourceToReplicateTags.LAMBDA_FUNCTION` in the `resourcesToReplicateTags` property, CloudWatch Synthetics will keep the tags of the canary and the Lambda function synchronized. Any future changes you make to the canary's tags will also be applied to the function.
375
415
  '''
376
416
  from pkgutil import extend_path
377
417
  __path__ = extend_path(__path__, __name__)
@@ -568,17 +608,14 @@ class Canary(
568
608
 
569
609
  Example::
570
610
 
571
- import aws_cdk as cdk
572
-
573
-
574
611
  canary = synthetics.Canary(self, "MyCanary",
575
612
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
576
613
  test=synthetics.Test.custom(
577
614
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
578
615
  handler="index.handler"
579
616
  ),
580
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
581
- memory=cdk.Size.mebibytes(1024)
617
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
618
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
582
619
  )
583
620
  '''
584
621
 
@@ -599,8 +636,10 @@ class Canary(
599
636
  dry_run_and_update: typing.Optional[builtins.bool] = None,
600
637
  environment_variables: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
601
638
  failure_retention_period: typing.Optional[_Duration_4839e8c3] = None,
639
+ max_retries: typing.Optional[jsii.Number] = None,
602
640
  memory: typing.Optional[_Size_7b441c34] = None,
603
641
  provisioned_resource_cleanup: typing.Optional[builtins.bool] = None,
642
+ resources_to_replicate_tags: typing.Optional[typing.Sequence["ResourceToReplicateTags"]] = None,
604
643
  role: typing.Optional[_IRole_235f5d8e] = None,
605
644
  schedule: typing.Optional["Schedule"] = None,
606
645
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
@@ -623,11 +662,13 @@ class Canary(
623
662
  :param artifacts_bucket_location: The s3 location that stores the data of the canary runs. Default: - A new s3 bucket will be created without a prefix.
624
663
  :param canary_name: The name of the canary. Be sure to give it a descriptive name that distinguishes it from other canaries in your account. Do not include secrets or proprietary information in your canary name. The canary name makes up part of the canary ARN, which is included in outbound calls over the internet. Default: - A unique name will be generated from the construct ID
625
664
  :param cleanup: (deprecated) Specify the underlying resources to be cleaned up when the canary is deleted. Using ``Cleanup.LAMBDA`` will create a Custom Resource to achieve this. Default: Cleanup.NOTHING
626
- :param dry_run_and_update: Specifies whether to perform a dry run before updating the canary. If set to true, CDK will execute a dry run to validate the changes before applying them to the canary. If the dry run succeeds, the canary will be updated with the changes. If the dry run fails, the CloudFormation deployment will fail with the dry runs failure reason. If set to false or omitted, the canary will be updated directly without first performing a dry run. Default: undefined - AWS CloudWatch default is false
665
+ :param dry_run_and_update: Specifies whether to perform a dry run before updating the canary. If set to true, CDK will execute a dry run to validate the changes before applying them to the canary. If the dry run succeeds, the canary will be updated with the changes. If the dry run fails, the CloudFormation deployment will fail with the dry run's failure reason. If set to false or omitted, the canary will be updated directly without first performing a dry run. Default: undefined - AWS CloudWatch default is false
627
666
  :param environment_variables: Key-value pairs that the Synthetics caches and makes available for your canary scripts. Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Canary script source code. Default: - No environment variables.
628
667
  :param failure_retention_period: How many days should failed runs be retained. Default: Duration.days(31)
668
+ :param max_retries: The amount of times the canary will automatically retry a failed run. This is only supported on the following runtimes or newer: ``Runtime.SYNTHETICS_NODEJS_PUPPETEER_10_0``, ``Runtime.SYNTHETICS_NODEJS_PLAYWRIGHT_2_0``, ``Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1``. Max retries can be set between 0 and 2. Canaries which time out after 10 minutes are automatically limited to one retry. Default: 0
629
669
  :param memory: The maximum amount of memory that the canary can use while running. This value must be a multiple of 64 Mib. The range is 960 MiB to 3008 MiB. Default: Size.mebibytes(1024)
630
670
  :param provisioned_resource_cleanup: Whether to also delete the Lambda functions and layers used by this canary when the canary is deleted. Default: undefined - the default behavior is to not delete the Lambda functions and layers
671
+ :param resources_to_replicate_tags: Specifies which resources should have their tags replicated to this canary. To have the tags that you apply to this canary also be applied to the Lambda function that the canary uses, specify this property with the value ResourceToReplicateTags.LAMBDA_FUNCTION. If you do this, CloudWatch Synthetics will keep the tags of the canary and the Lambda function synchronized. Any future changes you make to the canary's tags will also be applied to the function. Default: - No resources will have their tags replicated to this canary
631
672
  :param role: Canary execution role. This is the role that will be assumed by the canary upon execution. It controls the permissions that the canary will have. The role must be assumable by the AWS Lambda service principal. If not supplied, a role will be created with all the required permissions. If you provide a Role, you must add the required permissions. Default: - A unique role will be generated for this canary. You can add permissions to roles by calling 'addToRolePolicy'.
632
673
  :param schedule: Specify the schedule for how often the canary runs. For example, if you set ``schedule`` to ``rate(10 minutes)``, then the canary will run every 10 minutes. You can set the schedule with ``Schedule.rate(Duration)`` (recommended) or you can specify an expression using ``Schedule.expression()``. Default: 'rate(5 minutes)'
633
674
  :param security_groups: The list of security groups to associate with the canary's network interfaces. You must provide ``vpc`` when using this prop. Default: - If the canary is placed within a VPC and a security group is not specified a dedicated security group will be created for this canary.
@@ -655,8 +696,10 @@ class Canary(
655
696
  dry_run_and_update=dry_run_and_update,
656
697
  environment_variables=environment_variables,
657
698
  failure_retention_period=failure_retention_period,
699
+ max_retries=max_retries,
658
700
  memory=memory,
659
701
  provisioned_resource_cleanup=provisioned_resource_cleanup,
702
+ resources_to_replicate_tags=resources_to_replicate_tags,
660
703
  role=role,
661
704
  schedule=schedule,
662
705
  security_groups=security_groups,
@@ -677,6 +720,7 @@ class Canary(
677
720
  account: typing.Optional[builtins.str] = None,
678
721
  color: typing.Optional[builtins.str] = None,
679
722
  dimensions_map: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
723
+ id: typing.Optional[builtins.str] = None,
680
724
  label: typing.Optional[builtins.str] = None,
681
725
  period: typing.Optional[_Duration_4839e8c3] = None,
682
726
  region: typing.Optional[builtins.str] = None,
@@ -684,12 +728,14 @@ class Canary(
684
728
  stack_region: typing.Optional[builtins.str] = None,
685
729
  statistic: typing.Optional[builtins.str] = None,
686
730
  unit: typing.Optional[_Unit_61bc6f70] = None,
731
+ visible: typing.Optional[builtins.bool] = None,
687
732
  ) -> _Metric_e396a4dc:
688
733
  '''Measure the Duration of a single canary run, in seconds.
689
734
 
690
735
  :param account: Account which this metric comes from. Default: - Deployment account.
691
736
  :param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
692
737
  :param dimensions_map: Dimensions of the metric. Default: - No dimensions.
738
+ :param id: Unique identifier for this metric when used in dashboard widgets. The id can be used as a variable to represent this metric in math expressions. Valid characters are letters, numbers, and underscore. The first character must be a lowercase letter. Default: - No ID
693
739
  :param label: Label for this metric when added to a Graph in a Dashboard. You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_ to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend. Default: - No label
694
740
  :param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
695
741
  :param region: Region which this metric comes from. Default: - Deployment region.
@@ -697,6 +743,7 @@ class Canary(
697
743
  :param stack_region: Region of the stack this metric is attached to. Default: - Deployment region.
698
744
  :param statistic: What function to use for aggregating. Use the ``aws_cloudwatch.Stats`` helper class to construct valid input strings. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" - "tmNN.NN" | "tm(NN.NN%:NN.NN%)" - "iqm" - "wmNN.NN" | "wm(NN.NN%:NN.NN%)" - "tcNN.NN" | "tc(NN.NN%:NN.NN%)" - "tsNN.NN" | "ts(NN.NN%:NN.NN%)" Default: Average
699
745
  :param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
746
+ :param visible: Whether this metric should be visible in dashboard graphs. Setting this to false is useful when you want to hide raw metrics that are used in math expressions, and show only the expression results. Default: true
700
747
 
701
748
  :default: avg over 5 minutes
702
749
  '''
@@ -704,6 +751,7 @@ class Canary(
704
751
  account=account,
705
752
  color=color,
706
753
  dimensions_map=dimensions_map,
754
+ id=id,
707
755
  label=label,
708
756
  period=period,
709
757
  region=region,
@@ -711,6 +759,7 @@ class Canary(
711
759
  stack_region=stack_region,
712
760
  statistic=statistic,
713
761
  unit=unit,
762
+ visible=visible,
714
763
  )
715
764
 
716
765
  return typing.cast(_Metric_e396a4dc, jsii.invoke(self, "metricDuration", [options]))
@@ -722,6 +771,7 @@ class Canary(
722
771
  account: typing.Optional[builtins.str] = None,
723
772
  color: typing.Optional[builtins.str] = None,
724
773
  dimensions_map: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
774
+ id: typing.Optional[builtins.str] = None,
725
775
  label: typing.Optional[builtins.str] = None,
726
776
  period: typing.Optional[_Duration_4839e8c3] = None,
727
777
  region: typing.Optional[builtins.str] = None,
@@ -729,6 +779,7 @@ class Canary(
729
779
  stack_region: typing.Optional[builtins.str] = None,
730
780
  statistic: typing.Optional[builtins.str] = None,
731
781
  unit: typing.Optional[_Unit_61bc6f70] = None,
782
+ visible: typing.Optional[builtins.bool] = None,
732
783
  ) -> _Metric_e396a4dc:
733
784
  '''Measure the number of failed canary runs over a given time period.
734
785
 
@@ -737,6 +788,7 @@ class Canary(
737
788
  :param account: Account which this metric comes from. Default: - Deployment account.
738
789
  :param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
739
790
  :param dimensions_map: Dimensions of the metric. Default: - No dimensions.
791
+ :param id: Unique identifier for this metric when used in dashboard widgets. The id can be used as a variable to represent this metric in math expressions. Valid characters are letters, numbers, and underscore. The first character must be a lowercase letter. Default: - No ID
740
792
  :param label: Label for this metric when added to a Graph in a Dashboard. You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_ to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend. Default: - No label
741
793
  :param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
742
794
  :param region: Region which this metric comes from. Default: - Deployment region.
@@ -744,11 +796,13 @@ class Canary(
744
796
  :param stack_region: Region of the stack this metric is attached to. Default: - Deployment region.
745
797
  :param statistic: What function to use for aggregating. Use the ``aws_cloudwatch.Stats`` helper class to construct valid input strings. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" - "tmNN.NN" | "tm(NN.NN%:NN.NN%)" - "iqm" - "wmNN.NN" | "wm(NN.NN%:NN.NN%)" - "tcNN.NN" | "tc(NN.NN%:NN.NN%)" - "tsNN.NN" | "ts(NN.NN%:NN.NN%)" Default: Average
746
798
  :param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
799
+ :param visible: Whether this metric should be visible in dashboard graphs. Setting this to false is useful when you want to hide raw metrics that are used in math expressions, and show only the expression results. Default: true
747
800
  '''
748
801
  options = _MetricOptions_1788b62f(
749
802
  account=account,
750
803
  color=color,
751
804
  dimensions_map=dimensions_map,
805
+ id=id,
752
806
  label=label,
753
807
  period=period,
754
808
  region=region,
@@ -756,6 +810,7 @@ class Canary(
756
810
  stack_region=stack_region,
757
811
  statistic=statistic,
758
812
  unit=unit,
813
+ visible=visible,
759
814
  )
760
815
 
761
816
  return typing.cast(_Metric_e396a4dc, jsii.invoke(self, "metricFailed", [options]))
@@ -767,6 +822,7 @@ class Canary(
767
822
  account: typing.Optional[builtins.str] = None,
768
823
  color: typing.Optional[builtins.str] = None,
769
824
  dimensions_map: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
825
+ id: typing.Optional[builtins.str] = None,
770
826
  label: typing.Optional[builtins.str] = None,
771
827
  period: typing.Optional[_Duration_4839e8c3] = None,
772
828
  region: typing.Optional[builtins.str] = None,
@@ -774,12 +830,14 @@ class Canary(
774
830
  stack_region: typing.Optional[builtins.str] = None,
775
831
  statistic: typing.Optional[builtins.str] = None,
776
832
  unit: typing.Optional[_Unit_61bc6f70] = None,
833
+ visible: typing.Optional[builtins.bool] = None,
777
834
  ) -> _Metric_e396a4dc:
778
835
  '''Measure the percentage of successful canary runs.
779
836
 
780
837
  :param account: Account which this metric comes from. Default: - Deployment account.
781
838
  :param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
782
839
  :param dimensions_map: Dimensions of the metric. Default: - No dimensions.
840
+ :param id: Unique identifier for this metric when used in dashboard widgets. The id can be used as a variable to represent this metric in math expressions. Valid characters are letters, numbers, and underscore. The first character must be a lowercase letter. Default: - No ID
783
841
  :param label: Label for this metric when added to a Graph in a Dashboard. You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_ to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph's legend. Default: - No label
784
842
  :param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
785
843
  :param region: Region which this metric comes from. Default: - Deployment region.
@@ -787,6 +845,7 @@ class Canary(
787
845
  :param stack_region: Region of the stack this metric is attached to. Default: - Deployment region.
788
846
  :param statistic: What function to use for aggregating. Use the ``aws_cloudwatch.Stats`` helper class to construct valid input strings. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" - "tmNN.NN" | "tm(NN.NN%:NN.NN%)" - "iqm" - "wmNN.NN" | "wm(NN.NN%:NN.NN%)" - "tcNN.NN" | "tc(NN.NN%:NN.NN%)" - "tsNN.NN" | "ts(NN.NN%:NN.NN%)" Default: Average
789
847
  :param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
848
+ :param visible: Whether this metric should be visible in dashboard graphs. Setting this to false is useful when you want to hide raw metrics that are used in math expressions, and show only the expression results. Default: true
790
849
 
791
850
  :default: avg over 5 minutes
792
851
  '''
@@ -794,6 +853,7 @@ class Canary(
794
853
  account=account,
795
854
  color=color,
796
855
  dimensions_map=dimensions_map,
856
+ id=id,
797
857
  label=label,
798
858
  period=period,
799
859
  region=region,
@@ -801,6 +861,7 @@ class Canary(
801
861
  stack_region=stack_region,
802
862
  statistic=statistic,
803
863
  unit=unit,
864
+ visible=visible,
804
865
  )
805
866
 
806
867
  return typing.cast(_Metric_e396a4dc, jsii.invoke(self, "metricSuccessPercent", [options]))
@@ -878,8 +939,10 @@ class Canary(
878
939
  "dry_run_and_update": "dryRunAndUpdate",
879
940
  "environment_variables": "environmentVariables",
880
941
  "failure_retention_period": "failureRetentionPeriod",
942
+ "max_retries": "maxRetries",
881
943
  "memory": "memory",
882
944
  "provisioned_resource_cleanup": "provisionedResourceCleanup",
945
+ "resources_to_replicate_tags": "resourcesToReplicateTags",
883
946
  "role": "role",
884
947
  "schedule": "schedule",
885
948
  "security_groups": "securityGroups",
@@ -907,8 +970,10 @@ class CanaryProps:
907
970
  dry_run_and_update: typing.Optional[builtins.bool] = None,
908
971
  environment_variables: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
909
972
  failure_retention_period: typing.Optional[_Duration_4839e8c3] = None,
973
+ max_retries: typing.Optional[jsii.Number] = None,
910
974
  memory: typing.Optional[_Size_7b441c34] = None,
911
975
  provisioned_resource_cleanup: typing.Optional[builtins.bool] = None,
976
+ resources_to_replicate_tags: typing.Optional[typing.Sequence["ResourceToReplicateTags"]] = None,
912
977
  role: typing.Optional[_IRole_235f5d8e] = None,
913
978
  schedule: typing.Optional["Schedule"] = None,
914
979
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
@@ -930,11 +995,13 @@ class CanaryProps:
930
995
  :param artifacts_bucket_location: The s3 location that stores the data of the canary runs. Default: - A new s3 bucket will be created without a prefix.
931
996
  :param canary_name: The name of the canary. Be sure to give it a descriptive name that distinguishes it from other canaries in your account. Do not include secrets or proprietary information in your canary name. The canary name makes up part of the canary ARN, which is included in outbound calls over the internet. Default: - A unique name will be generated from the construct ID
932
997
  :param cleanup: (deprecated) Specify the underlying resources to be cleaned up when the canary is deleted. Using ``Cleanup.LAMBDA`` will create a Custom Resource to achieve this. Default: Cleanup.NOTHING
933
- :param dry_run_and_update: Specifies whether to perform a dry run before updating the canary. If set to true, CDK will execute a dry run to validate the changes before applying them to the canary. If the dry run succeeds, the canary will be updated with the changes. If the dry run fails, the CloudFormation deployment will fail with the dry runs failure reason. If set to false or omitted, the canary will be updated directly without first performing a dry run. Default: undefined - AWS CloudWatch default is false
998
+ :param dry_run_and_update: Specifies whether to perform a dry run before updating the canary. If set to true, CDK will execute a dry run to validate the changes before applying them to the canary. If the dry run succeeds, the canary will be updated with the changes. If the dry run fails, the CloudFormation deployment will fail with the dry run's failure reason. If set to false or omitted, the canary will be updated directly without first performing a dry run. Default: undefined - AWS CloudWatch default is false
934
999
  :param environment_variables: Key-value pairs that the Synthetics caches and makes available for your canary scripts. Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Canary script source code. Default: - No environment variables.
935
1000
  :param failure_retention_period: How many days should failed runs be retained. Default: Duration.days(31)
1001
+ :param max_retries: The amount of times the canary will automatically retry a failed run. This is only supported on the following runtimes or newer: ``Runtime.SYNTHETICS_NODEJS_PUPPETEER_10_0``, ``Runtime.SYNTHETICS_NODEJS_PLAYWRIGHT_2_0``, ``Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1``. Max retries can be set between 0 and 2. Canaries which time out after 10 minutes are automatically limited to one retry. Default: 0
936
1002
  :param memory: The maximum amount of memory that the canary can use while running. This value must be a multiple of 64 Mib. The range is 960 MiB to 3008 MiB. Default: Size.mebibytes(1024)
937
1003
  :param provisioned_resource_cleanup: Whether to also delete the Lambda functions and layers used by this canary when the canary is deleted. Default: undefined - the default behavior is to not delete the Lambda functions and layers
1004
+ :param resources_to_replicate_tags: Specifies which resources should have their tags replicated to this canary. To have the tags that you apply to this canary also be applied to the Lambda function that the canary uses, specify this property with the value ResourceToReplicateTags.LAMBDA_FUNCTION. If you do this, CloudWatch Synthetics will keep the tags of the canary and the Lambda function synchronized. Any future changes you make to the canary's tags will also be applied to the function. Default: - No resources will have their tags replicated to this canary
938
1005
  :param role: Canary execution role. This is the role that will be assumed by the canary upon execution. It controls the permissions that the canary will have. The role must be assumable by the AWS Lambda service principal. If not supplied, a role will be created with all the required permissions. If you provide a Role, you must add the required permissions. Default: - A unique role will be generated for this canary. You can add permissions to roles by calling 'addToRolePolicy'.
939
1006
  :param schedule: Specify the schedule for how often the canary runs. For example, if you set ``schedule`` to ``rate(10 minutes)``, then the canary will run every 10 minutes. You can set the schedule with ``Schedule.rate(Duration)`` (recommended) or you can specify an expression using ``Schedule.expression()``. Default: 'rate(5 minutes)'
940
1007
  :param security_groups: The list of security groups to associate with the canary's network interfaces. You must provide ``vpc`` when using this prop. Default: - If the canary is placed within a VPC and a security group is not specified a dedicated security group will be created for this canary.
@@ -949,17 +1016,14 @@ class CanaryProps:
949
1016
 
950
1017
  Example::
951
1018
 
952
- import aws_cdk as cdk
953
-
954
-
955
1019
  canary = synthetics.Canary(self, "MyCanary",
956
1020
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
957
1021
  test=synthetics.Test.custom(
958
1022
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
959
1023
  handler="index.handler"
960
1024
  ),
961
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
962
- memory=cdk.Size.mebibytes(1024)
1025
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
1026
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
963
1027
  )
964
1028
  '''
965
1029
  if isinstance(artifacts_bucket_location, dict):
@@ -980,8 +1044,10 @@ class CanaryProps:
980
1044
  check_type(argname="argument dry_run_and_update", value=dry_run_and_update, expected_type=type_hints["dry_run_and_update"])
981
1045
  check_type(argname="argument environment_variables", value=environment_variables, expected_type=type_hints["environment_variables"])
982
1046
  check_type(argname="argument failure_retention_period", value=failure_retention_period, expected_type=type_hints["failure_retention_period"])
1047
+ check_type(argname="argument max_retries", value=max_retries, expected_type=type_hints["max_retries"])
983
1048
  check_type(argname="argument memory", value=memory, expected_type=type_hints["memory"])
984
1049
  check_type(argname="argument provisioned_resource_cleanup", value=provisioned_resource_cleanup, expected_type=type_hints["provisioned_resource_cleanup"])
1050
+ check_type(argname="argument resources_to_replicate_tags", value=resources_to_replicate_tags, expected_type=type_hints["resources_to_replicate_tags"])
985
1051
  check_type(argname="argument role", value=role, expected_type=type_hints["role"])
986
1052
  check_type(argname="argument schedule", value=schedule, expected_type=type_hints["schedule"])
987
1053
  check_type(argname="argument security_groups", value=security_groups, expected_type=type_hints["security_groups"])
@@ -1015,10 +1081,14 @@ class CanaryProps:
1015
1081
  self._values["environment_variables"] = environment_variables
1016
1082
  if failure_retention_period is not None:
1017
1083
  self._values["failure_retention_period"] = failure_retention_period
1084
+ if max_retries is not None:
1085
+ self._values["max_retries"] = max_retries
1018
1086
  if memory is not None:
1019
1087
  self._values["memory"] = memory
1020
1088
  if provisioned_resource_cleanup is not None:
1021
1089
  self._values["provisioned_resource_cleanup"] = provisioned_resource_cleanup
1090
+ if resources_to_replicate_tags is not None:
1091
+ self._values["resources_to_replicate_tags"] = resources_to_replicate_tags
1022
1092
  if role is not None:
1023
1093
  self._values["role"] = role
1024
1094
  if schedule is not None:
@@ -1160,7 +1230,7 @@ class CanaryProps:
1160
1230
 
1161
1231
  If set to true, CDK will execute a dry run to validate the changes before applying them to the canary.
1162
1232
  If the dry run succeeds, the canary will be updated with the changes.
1163
- If the dry run fails, the CloudFormation deployment will fail with the dry runs failure reason.
1233
+ If the dry run fails, the CloudFormation deployment will fail with the dry run's failure reason.
1164
1234
 
1165
1235
  If set to false or omitted, the canary will be updated directly without first performing a dry run.
1166
1236
 
@@ -1195,6 +1265,20 @@ class CanaryProps:
1195
1265
  result = self._values.get("failure_retention_period")
1196
1266
  return typing.cast(typing.Optional[_Duration_4839e8c3], result)
1197
1267
 
1268
+ @builtins.property
1269
+ def max_retries(self) -> typing.Optional[jsii.Number]:
1270
+ '''The amount of times the canary will automatically retry a failed run.
1271
+
1272
+ This is only supported on the following runtimes or newer: ``Runtime.SYNTHETICS_NODEJS_PUPPETEER_10_0``, ``Runtime.SYNTHETICS_NODEJS_PLAYWRIGHT_2_0``, ``Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1``.
1273
+ Max retries can be set between 0 and 2. Canaries which time out after 10 minutes are automatically limited to one retry.
1274
+
1275
+ :default: 0
1276
+
1277
+ :see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_autoretry.html
1278
+ '''
1279
+ result = self._values.get("max_retries")
1280
+ return typing.cast(typing.Optional[jsii.Number], result)
1281
+
1198
1282
  @builtins.property
1199
1283
  def memory(self) -> typing.Optional[_Size_7b441c34]:
1200
1284
  '''The maximum amount of memory that the canary can use while running.
@@ -1216,6 +1300,23 @@ class CanaryProps:
1216
1300
  result = self._values.get("provisioned_resource_cleanup")
1217
1301
  return typing.cast(typing.Optional[builtins.bool], result)
1218
1302
 
1303
+ @builtins.property
1304
+ def resources_to_replicate_tags(
1305
+ self,
1306
+ ) -> typing.Optional[typing.List["ResourceToReplicateTags"]]:
1307
+ '''Specifies which resources should have their tags replicated to this canary.
1308
+
1309
+ To have the tags that you apply to this canary also be applied to the Lambda
1310
+ function that the canary uses, specify this property with the value
1311
+ ResourceToReplicateTags.LAMBDA_FUNCTION. If you do this, CloudWatch Synthetics will keep the tags of the canary and the
1312
+ Lambda function synchronized. Any future changes you make to the canary's tags
1313
+ will also be applied to the function.
1314
+
1315
+ :default: - No resources will have their tags replicated to this canary
1316
+ '''
1317
+ result = self._values.get("resources_to_replicate_tags")
1318
+ return typing.cast(typing.Optional[typing.List["ResourceToReplicateTags"]], result)
1319
+
1219
1320
  @builtins.property
1220
1321
  def role(self) -> typing.Optional[_IRole_235f5d8e]:
1221
1322
  '''Canary execution role.
@@ -3477,17 +3578,14 @@ class Code(
3477
3578
 
3478
3579
  Example::
3479
3580
 
3480
- import aws_cdk as cdk
3481
-
3482
-
3483
3581
  canary = synthetics.Canary(self, "MyCanary",
3484
3582
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
3485
3583
  test=synthetics.Test.custom(
3486
3584
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
3487
3585
  handler="index.handler"
3488
3586
  ),
3489
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
3490
- memory=cdk.Size.mebibytes(1024)
3587
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
3588
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
3491
3589
  )
3492
3590
  '''
3493
3591
 
@@ -3853,17 +3951,14 @@ class CustomTestOptions:
3853
3951
 
3854
3952
  Example::
3855
3953
 
3856
- import aws_cdk as cdk
3857
-
3858
-
3859
3954
  canary = synthetics.Canary(self, "MyCanary",
3860
3955
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
3861
3956
  test=synthetics.Test.custom(
3862
3957
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
3863
3958
  handler="index.handler"
3864
3959
  ),
3865
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
3866
- memory=cdk.Size.mebibytes(1024)
3960
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
3961
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
3867
3962
  )
3868
3963
  '''
3869
3964
  if __debug__:
@@ -3955,6 +4050,34 @@ class InlineCode(
3955
4050
  return typing.cast(CodeConfig, jsii.invoke(self, "bind", [scope, handler, _family, _runtime_name]))
3956
4051
 
3957
4052
 
4053
+ @jsii.enum(jsii_type="aws-cdk-lib.aws_synthetics.ResourceToReplicateTags")
4054
+ class ResourceToReplicateTags(enum.Enum):
4055
+ '''Resources that tags applied to a canary should be replicated to.
4056
+
4057
+ :exampleMetadata: infused
4058
+
4059
+ Example::
4060
+
4061
+ canary = synthetics.Canary(self, "MyCanary",
4062
+ schedule=synthetics.Schedule.rate(Duration.minutes(5)),
4063
+ test=synthetics.Test.custom(
4064
+ code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
4065
+ handler="index.handler"
4066
+ ),
4067
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
4068
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
4069
+ )
4070
+ '''
4071
+
4072
+ LAMBDA_FUNCTION = "LAMBDA_FUNCTION"
4073
+ '''Replicate canary tags to the Lambda function.
4074
+
4075
+ When specified, CloudWatch Synthetics will keep the tags of the canary
4076
+ and the Lambda function synchronized. Any future changes made to the
4077
+ canary's tags will also be applied to the function.
4078
+ '''
4079
+
4080
+
3958
4081
  class Runtime(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_synthetics.Runtime"):
3959
4082
  '''Runtime options for a canary.
3960
4083
 
@@ -3962,17 +4085,14 @@ class Runtime(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_synthetics.Run
3962
4085
 
3963
4086
  Example::
3964
4087
 
3965
- import aws_cdk as cdk
3966
-
3967
-
3968
4088
  canary = synthetics.Canary(self, "MyCanary",
3969
4089
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
3970
4090
  test=synthetics.Test.custom(
3971
4091
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
3972
4092
  handler="index.handler"
3973
4093
  ),
3974
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
3975
- memory=cdk.Size.mebibytes(1024)
4094
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
4095
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
3976
4096
  )
3977
4097
  '''
3978
4098
 
@@ -4538,11 +4658,11 @@ class Schedule(
4538
4658
  canary = synthetics.Canary(self, "MyCanary",
4539
4659
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
4540
4660
  test=synthetics.Test.custom(
4541
- code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
4542
- handler="index.handler"
4661
+ handler="canary.handler",
4662
+ code=synthetics.Code.from_asset(path.join(__dirname, "canaries"))
4543
4663
  ),
4544
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
4545
- active_tracing=True
4664
+ runtime=synthetics.Runtime.SYNTHETICS_PYTHON_SELENIUM_5_1,
4665
+ max_retries=2
4546
4666
  )
4547
4667
  '''
4548
4668
 
@@ -4621,17 +4741,14 @@ class Test(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_synthetics.Test")
4621
4741
 
4622
4742
  Example::
4623
4743
 
4624
- import aws_cdk as cdk
4625
-
4626
-
4627
4744
  canary = synthetics.Canary(self, "MyCanary",
4628
4745
  schedule=synthetics.Schedule.rate(Duration.minutes(5)),
4629
4746
  test=synthetics.Test.custom(
4630
4747
  code=synthetics.Code.from_asset(path.join(__dirname, "canary")),
4631
4748
  handler="index.handler"
4632
4749
  ),
4633
- runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_6_2,
4634
- memory=cdk.Size.mebibytes(1024)
4750
+ runtime=synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_7_0,
4751
+ resources_to_replicate_tags=[synthetics.ResourceToReplicateTags.LAMBDA_FUNCTION]
4635
4752
  )
4636
4753
  '''
4637
4754
 
@@ -4810,6 +4927,7 @@ __all__ = [
4810
4927
  "CronOptions",
4811
4928
  "CustomTestOptions",
4812
4929
  "InlineCode",
4930
+ "ResourceToReplicateTags",
4813
4931
  "Runtime",
4814
4932
  "RuntimeFamily",
4815
4933
  "S3Code",
@@ -4843,8 +4961,10 @@ def _typecheckingstub__b3b6d76e5f93e31884e16cc00a9b4fc93e6782ff7db09c74aa1ef9346
4843
4961
  dry_run_and_update: typing.Optional[builtins.bool] = None,
4844
4962
  environment_variables: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
4845
4963
  failure_retention_period: typing.Optional[_Duration_4839e8c3] = None,
4964
+ max_retries: typing.Optional[jsii.Number] = None,
4846
4965
  memory: typing.Optional[_Size_7b441c34] = None,
4847
4966
  provisioned_resource_cleanup: typing.Optional[builtins.bool] = None,
4967
+ resources_to_replicate_tags: typing.Optional[typing.Sequence[ResourceToReplicateTags]] = None,
4848
4968
  role: typing.Optional[_IRole_235f5d8e] = None,
4849
4969
  schedule: typing.Optional[Schedule] = None,
4850
4970
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,
@@ -4872,8 +4992,10 @@ def _typecheckingstub__44ec0b14d52b66927d4daebe6f97bb070f3629bb0eb86e21668ca7862
4872
4992
  dry_run_and_update: typing.Optional[builtins.bool] = None,
4873
4993
  environment_variables: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
4874
4994
  failure_retention_period: typing.Optional[_Duration_4839e8c3] = None,
4995
+ max_retries: typing.Optional[jsii.Number] = None,
4875
4996
  memory: typing.Optional[_Size_7b441c34] = None,
4876
4997
  provisioned_resource_cleanup: typing.Optional[builtins.bool] = None,
4998
+ resources_to_replicate_tags: typing.Optional[typing.Sequence[ResourceToReplicateTags]] = None,
4877
4999
  role: typing.Optional[_IRole_235f5d8e] = None,
4878
5000
  schedule: typing.Optional[Schedule] = None,
4879
5001
  security_groups: typing.Optional[typing.Sequence[_ISecurityGroup_acf8a799]] = None,