aws-cdk-lib 2.196.0__py3-none-any.whl → 2.197.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.
- aws_cdk/__init__.py +2 -0
- aws_cdk/_jsii/__init__.py +1 -1
- aws_cdk/_jsii/{aws-cdk-lib@2.196.0.jsii.tgz → aws-cdk-lib@2.197.0.jsii.tgz} +0 -0
- aws_cdk/aws_apigateway/__init__.py +90 -1
- aws_cdk/aws_apigatewayv2/__init__.py +866 -0
- aws_cdk/aws_bedrock/__init__.py +32 -26
- aws_cdk/aws_cloudfront/__init__.py +9 -3
- aws_cdk/aws_cloudwatch/__init__.py +756 -29
- aws_cdk/aws_codebuild/__init__.py +19 -0
- aws_cdk/aws_codepipeline/__init__.py +42 -7
- aws_cdk/aws_datasync/__init__.py +43 -72
- aws_cdk/aws_datazone/__init__.py +615 -2
- aws_cdk/aws_deadline/__init__.py +139 -0
- aws_cdk/aws_dsql/__init__.py +35 -1
- aws_cdk/aws_ec2/__init__.py +81 -3
- aws_cdk/aws_ecs/__init__.py +24 -17
- aws_cdk/aws_elasticache/__init__.py +5 -5
- aws_cdk/aws_gamelift/__init__.py +103 -15
- aws_cdk/aws_gameliftstreams/__init__.py +6 -6
- aws_cdk/aws_lambda_nodejs/__init__.py +0 -6
- aws_cdk/aws_omics/__init__.py +920 -103
- aws_cdk/aws_route53resolver/__init__.py +0 -41
- aws_cdk/aws_ses/__init__.py +4 -4
- aws_cdk/aws_workspaces/__init__.py +39 -0
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/METADATA +1 -1
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/RECORD +30 -30
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/LICENSE +0 -0
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/NOTICE +0 -0
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/WHEEL +0 -0
- {aws_cdk_lib-2.196.0.dist-info → aws_cdk_lib-2.197.0.dist-info}/top_level.txt +0 -0
|
@@ -392,6 +392,58 @@ only supports filtering by `unit` for Alarms, not in Dashboard graphs.
|
|
|
392
392
|
Please see the following GitHub issue for a discussion on real unit
|
|
393
393
|
calculations in CDK: https://github.com/aws/aws-cdk/issues/5595
|
|
394
394
|
|
|
395
|
+
## Anomaly Detection Alarms
|
|
396
|
+
|
|
397
|
+
CloudWatch anomaly detection applies machine learning algorithms to create a model of expected metric behavior. You can use anomaly detection to:
|
|
398
|
+
|
|
399
|
+
* Detect anomalies with minimal configuration
|
|
400
|
+
* Visualize expected metric behavior
|
|
401
|
+
* Create alarms that trigger when metrics deviate from expected patterns
|
|
402
|
+
|
|
403
|
+
### Creating an Anomaly Detection Alarm
|
|
404
|
+
|
|
405
|
+
To build an Anomaly Detection Alarm, you should create a MathExpression that
|
|
406
|
+
uses an `ANOMALY_DETECTION_BAND()` function, and use one of the band comparison
|
|
407
|
+
operators (see the next section). Anomaly Detection Alarms have a dynamic
|
|
408
|
+
threshold, not a fixed one, so the value for `threshold` is ignored. Specify the
|
|
409
|
+
value `0` or use the symbolic `Alarm.ANOMALY_DETECTION_NO_THRESHOLD` value.
|
|
410
|
+
|
|
411
|
+
You can use the `AnomalyDetectionAlarm` class for convenience, which takes care
|
|
412
|
+
of building the right metric math expression and passing in a magic value for
|
|
413
|
+
the treshold for you:
|
|
414
|
+
|
|
415
|
+
```python
|
|
416
|
+
# Create a metric
|
|
417
|
+
metric = cloudwatch.Metric(
|
|
418
|
+
namespace="AWS/EC2",
|
|
419
|
+
metric_name="CPUUtilization",
|
|
420
|
+
statistic="Average",
|
|
421
|
+
period=Duration.minutes(5)
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
# Create an anomaly detection alarm
|
|
425
|
+
alarm = cloudwatch.AnomalyDetectionAlarm(self, "AnomalyAlarm",
|
|
426
|
+
metric=metric,
|
|
427
|
+
evaluation_periods=1,
|
|
428
|
+
|
|
429
|
+
# Number of standard deviations for the band (default: 2)
|
|
430
|
+
std_devs=2,
|
|
431
|
+
# Alarm outside on either side of the band, or just below or above it (default: outside)
|
|
432
|
+
comparison_operator=cloudwatch.ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
433
|
+
alarm_description="Alarm when metric is outside the expected band"
|
|
434
|
+
)
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Comparison Operators for Anomaly Detection
|
|
438
|
+
|
|
439
|
+
When creating an anomaly detection alarm, you must use one of the following comparison operators:
|
|
440
|
+
|
|
441
|
+
* `LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD`: Alarm when the metric is outside the band, on either side of it
|
|
442
|
+
* `GREATER_THAN_UPPER_THRESHOLD`: Alarm only when the metric is above the band
|
|
443
|
+
* `LESS_THAN_LOWER_THRESHOLD`: Alarm only when the metric is below the band
|
|
444
|
+
|
|
445
|
+
For more information on anomaly detection in CloudWatch, see the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Anomaly_Detection.html).
|
|
446
|
+
|
|
395
447
|
## Dashboards
|
|
396
448
|
|
|
397
449
|
Dashboards are set of Widgets stored server-side which can be accessed quickly
|
|
@@ -1336,6 +1388,279 @@ class AlarmStatusWidgetSortBy(enum.Enum):
|
|
|
1336
1388
|
'''
|
|
1337
1389
|
|
|
1338
1390
|
|
|
1391
|
+
@jsii.data_type(
|
|
1392
|
+
jsii_type="aws-cdk-lib.aws_cloudwatch.AnomalyDetectionAlarmProps",
|
|
1393
|
+
jsii_struct_bases=[],
|
|
1394
|
+
name_mapping={
|
|
1395
|
+
"evaluation_periods": "evaluationPeriods",
|
|
1396
|
+
"metric": "metric",
|
|
1397
|
+
"actions_enabled": "actionsEnabled",
|
|
1398
|
+
"alarm_description": "alarmDescription",
|
|
1399
|
+
"alarm_name": "alarmName",
|
|
1400
|
+
"comparison_operator": "comparisonOperator",
|
|
1401
|
+
"datapoints_to_alarm": "datapointsToAlarm",
|
|
1402
|
+
"evaluate_low_sample_count_percentile": "evaluateLowSampleCountPercentile",
|
|
1403
|
+
"period": "period",
|
|
1404
|
+
"statistic": "statistic",
|
|
1405
|
+
"std_devs": "stdDevs",
|
|
1406
|
+
"treat_missing_data": "treatMissingData",
|
|
1407
|
+
},
|
|
1408
|
+
)
|
|
1409
|
+
class AnomalyDetectionAlarmProps:
|
|
1410
|
+
def __init__(
|
|
1411
|
+
self,
|
|
1412
|
+
*,
|
|
1413
|
+
evaluation_periods: jsii.Number,
|
|
1414
|
+
metric: "IMetric",
|
|
1415
|
+
actions_enabled: typing.Optional[builtins.bool] = None,
|
|
1416
|
+
alarm_description: typing.Optional[builtins.str] = None,
|
|
1417
|
+
alarm_name: typing.Optional[builtins.str] = None,
|
|
1418
|
+
comparison_operator: typing.Optional["ComparisonOperator"] = None,
|
|
1419
|
+
datapoints_to_alarm: typing.Optional[jsii.Number] = None,
|
|
1420
|
+
evaluate_low_sample_count_percentile: typing.Optional[builtins.str] = None,
|
|
1421
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
1422
|
+
statistic: typing.Optional[builtins.str] = None,
|
|
1423
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
1424
|
+
treat_missing_data: typing.Optional["TreatMissingData"] = None,
|
|
1425
|
+
) -> None:
|
|
1426
|
+
'''Properties for Anomaly Detection Alarms.
|
|
1427
|
+
|
|
1428
|
+
:param evaluation_periods: The number of periods over which data is compared to the specified threshold.
|
|
1429
|
+
:param metric: The metric to add the alarm on. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
|
|
1430
|
+
:param actions_enabled: Whether the actions for this alarm are enabled. Default: true
|
|
1431
|
+
:param alarm_description: Description for the alarm. Default: No description
|
|
1432
|
+
:param alarm_name: Name of the alarm. Default: Automatically generated name
|
|
1433
|
+
:param comparison_operator: Comparison operator to use to check if metric is breaching. Must be one of the anomaly detection operators: - LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD - GREATER_THAN_UPPER_THRESHOLD - LESS_THAN_LOWER_THRESHOLD Default: LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD
|
|
1434
|
+
:param datapoints_to_alarm: The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide. Default: ``evaluationPeriods``
|
|
1435
|
+
:param evaluate_low_sample_count_percentile: Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. Used only for alarms that are based on percentiles. Default: - Not configured.
|
|
1436
|
+
:param period: (deprecated) The period over which the specified statistic is applied. Cannot be used with ``MathExpression`` objects. Default: - The period from the metric
|
|
1437
|
+
:param statistic: (deprecated) What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Cannot be used with ``MathExpression`` objects. Default: - The statistic from the metric
|
|
1438
|
+
:param std_devs: The number of standard deviations to use for the anomaly detection band. The higher the value, the wider the band. - Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations. - There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies. Default: 2
|
|
1439
|
+
:param treat_missing_data: Sets how this alarm is to handle missing data points. Default: TreatMissingData.Missing
|
|
1440
|
+
|
|
1441
|
+
:exampleMetadata: infused
|
|
1442
|
+
|
|
1443
|
+
Example::
|
|
1444
|
+
|
|
1445
|
+
# Create a metric
|
|
1446
|
+
metric = cloudwatch.Metric(
|
|
1447
|
+
namespace="AWS/EC2",
|
|
1448
|
+
metric_name="CPUUtilization",
|
|
1449
|
+
statistic="Average",
|
|
1450
|
+
period=Duration.minutes(5)
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
# Create an anomaly detection alarm
|
|
1454
|
+
alarm = cloudwatch.AnomalyDetectionAlarm(self, "AnomalyAlarm",
|
|
1455
|
+
metric=metric,
|
|
1456
|
+
evaluation_periods=1,
|
|
1457
|
+
|
|
1458
|
+
# Number of standard deviations for the band (default: 2)
|
|
1459
|
+
std_devs=2,
|
|
1460
|
+
# Alarm outside on either side of the band, or just below or above it (default: outside)
|
|
1461
|
+
comparison_operator=cloudwatch.ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
1462
|
+
alarm_description="Alarm when metric is outside the expected band"
|
|
1463
|
+
)
|
|
1464
|
+
'''
|
|
1465
|
+
if __debug__:
|
|
1466
|
+
type_hints = typing.get_type_hints(_typecheckingstub__d770d314ce70d6c9f6003c8d6c5aa5cc35a2de931e79a5b71b5612d03298011d)
|
|
1467
|
+
check_type(argname="argument evaluation_periods", value=evaluation_periods, expected_type=type_hints["evaluation_periods"])
|
|
1468
|
+
check_type(argname="argument metric", value=metric, expected_type=type_hints["metric"])
|
|
1469
|
+
check_type(argname="argument actions_enabled", value=actions_enabled, expected_type=type_hints["actions_enabled"])
|
|
1470
|
+
check_type(argname="argument alarm_description", value=alarm_description, expected_type=type_hints["alarm_description"])
|
|
1471
|
+
check_type(argname="argument alarm_name", value=alarm_name, expected_type=type_hints["alarm_name"])
|
|
1472
|
+
check_type(argname="argument comparison_operator", value=comparison_operator, expected_type=type_hints["comparison_operator"])
|
|
1473
|
+
check_type(argname="argument datapoints_to_alarm", value=datapoints_to_alarm, expected_type=type_hints["datapoints_to_alarm"])
|
|
1474
|
+
check_type(argname="argument evaluate_low_sample_count_percentile", value=evaluate_low_sample_count_percentile, expected_type=type_hints["evaluate_low_sample_count_percentile"])
|
|
1475
|
+
check_type(argname="argument period", value=period, expected_type=type_hints["period"])
|
|
1476
|
+
check_type(argname="argument statistic", value=statistic, expected_type=type_hints["statistic"])
|
|
1477
|
+
check_type(argname="argument std_devs", value=std_devs, expected_type=type_hints["std_devs"])
|
|
1478
|
+
check_type(argname="argument treat_missing_data", value=treat_missing_data, expected_type=type_hints["treat_missing_data"])
|
|
1479
|
+
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
1480
|
+
"evaluation_periods": evaluation_periods,
|
|
1481
|
+
"metric": metric,
|
|
1482
|
+
}
|
|
1483
|
+
if actions_enabled is not None:
|
|
1484
|
+
self._values["actions_enabled"] = actions_enabled
|
|
1485
|
+
if alarm_description is not None:
|
|
1486
|
+
self._values["alarm_description"] = alarm_description
|
|
1487
|
+
if alarm_name is not None:
|
|
1488
|
+
self._values["alarm_name"] = alarm_name
|
|
1489
|
+
if comparison_operator is not None:
|
|
1490
|
+
self._values["comparison_operator"] = comparison_operator
|
|
1491
|
+
if datapoints_to_alarm is not None:
|
|
1492
|
+
self._values["datapoints_to_alarm"] = datapoints_to_alarm
|
|
1493
|
+
if evaluate_low_sample_count_percentile is not None:
|
|
1494
|
+
self._values["evaluate_low_sample_count_percentile"] = evaluate_low_sample_count_percentile
|
|
1495
|
+
if period is not None:
|
|
1496
|
+
self._values["period"] = period
|
|
1497
|
+
if statistic is not None:
|
|
1498
|
+
self._values["statistic"] = statistic
|
|
1499
|
+
if std_devs is not None:
|
|
1500
|
+
self._values["std_devs"] = std_devs
|
|
1501
|
+
if treat_missing_data is not None:
|
|
1502
|
+
self._values["treat_missing_data"] = treat_missing_data
|
|
1503
|
+
|
|
1504
|
+
@builtins.property
|
|
1505
|
+
def evaluation_periods(self) -> jsii.Number:
|
|
1506
|
+
'''The number of periods over which data is compared to the specified threshold.'''
|
|
1507
|
+
result = self._values.get("evaluation_periods")
|
|
1508
|
+
assert result is not None, "Required property 'evaluation_periods' is missing"
|
|
1509
|
+
return typing.cast(jsii.Number, result)
|
|
1510
|
+
|
|
1511
|
+
@builtins.property
|
|
1512
|
+
def metric(self) -> "IMetric":
|
|
1513
|
+
'''The metric to add the alarm on.
|
|
1514
|
+
|
|
1515
|
+
Metric objects can be obtained from most resources, or you can construct
|
|
1516
|
+
custom Metric objects by instantiating one.
|
|
1517
|
+
'''
|
|
1518
|
+
result = self._values.get("metric")
|
|
1519
|
+
assert result is not None, "Required property 'metric' is missing"
|
|
1520
|
+
return typing.cast("IMetric", result)
|
|
1521
|
+
|
|
1522
|
+
@builtins.property
|
|
1523
|
+
def actions_enabled(self) -> typing.Optional[builtins.bool]:
|
|
1524
|
+
'''Whether the actions for this alarm are enabled.
|
|
1525
|
+
|
|
1526
|
+
:default: true
|
|
1527
|
+
'''
|
|
1528
|
+
result = self._values.get("actions_enabled")
|
|
1529
|
+
return typing.cast(typing.Optional[builtins.bool], result)
|
|
1530
|
+
|
|
1531
|
+
@builtins.property
|
|
1532
|
+
def alarm_description(self) -> typing.Optional[builtins.str]:
|
|
1533
|
+
'''Description for the alarm.
|
|
1534
|
+
|
|
1535
|
+
:default: No description
|
|
1536
|
+
'''
|
|
1537
|
+
result = self._values.get("alarm_description")
|
|
1538
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
1539
|
+
|
|
1540
|
+
@builtins.property
|
|
1541
|
+
def alarm_name(self) -> typing.Optional[builtins.str]:
|
|
1542
|
+
'''Name of the alarm.
|
|
1543
|
+
|
|
1544
|
+
:default: Automatically generated name
|
|
1545
|
+
'''
|
|
1546
|
+
result = self._values.get("alarm_name")
|
|
1547
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
1548
|
+
|
|
1549
|
+
@builtins.property
|
|
1550
|
+
def comparison_operator(self) -> typing.Optional["ComparisonOperator"]:
|
|
1551
|
+
'''Comparison operator to use to check if metric is breaching.
|
|
1552
|
+
|
|
1553
|
+
Must be one of the anomaly detection operators:
|
|
1554
|
+
|
|
1555
|
+
- LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD
|
|
1556
|
+
- GREATER_THAN_UPPER_THRESHOLD
|
|
1557
|
+
- LESS_THAN_LOWER_THRESHOLD
|
|
1558
|
+
|
|
1559
|
+
:default: LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD
|
|
1560
|
+
'''
|
|
1561
|
+
result = self._values.get("comparison_operator")
|
|
1562
|
+
return typing.cast(typing.Optional["ComparisonOperator"], result)
|
|
1563
|
+
|
|
1564
|
+
@builtins.property
|
|
1565
|
+
def datapoints_to_alarm(self) -> typing.Optional[jsii.Number]:
|
|
1566
|
+
'''The number of datapoints that must be breaching to trigger the alarm.
|
|
1567
|
+
|
|
1568
|
+
This is used only if you are setting an "M
|
|
1569
|
+
out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon
|
|
1570
|
+
CloudWatch User Guide.
|
|
1571
|
+
|
|
1572
|
+
:default: ``evaluationPeriods``
|
|
1573
|
+
|
|
1574
|
+
:see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation
|
|
1575
|
+
'''
|
|
1576
|
+
result = self._values.get("datapoints_to_alarm")
|
|
1577
|
+
return typing.cast(typing.Optional[jsii.Number], result)
|
|
1578
|
+
|
|
1579
|
+
@builtins.property
|
|
1580
|
+
def evaluate_low_sample_count_percentile(self) -> typing.Optional[builtins.str]:
|
|
1581
|
+
'''Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.
|
|
1582
|
+
|
|
1583
|
+
Used only for alarms that are based on percentiles.
|
|
1584
|
+
|
|
1585
|
+
:default: - Not configured.
|
|
1586
|
+
'''
|
|
1587
|
+
result = self._values.get("evaluate_low_sample_count_percentile")
|
|
1588
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
1589
|
+
|
|
1590
|
+
@builtins.property
|
|
1591
|
+
def period(self) -> typing.Optional[_Duration_4839e8c3]:
|
|
1592
|
+
'''(deprecated) The period over which the specified statistic is applied.
|
|
1593
|
+
|
|
1594
|
+
Cannot be used with ``MathExpression`` objects.
|
|
1595
|
+
|
|
1596
|
+
:default: - The period from the metric
|
|
1597
|
+
|
|
1598
|
+
:deprecated: Use ``metric.with({ period: ... })`` to encode the period into the Metric object
|
|
1599
|
+
|
|
1600
|
+
:stability: deprecated
|
|
1601
|
+
'''
|
|
1602
|
+
result = self._values.get("period")
|
|
1603
|
+
return typing.cast(typing.Optional[_Duration_4839e8c3], result)
|
|
1604
|
+
|
|
1605
|
+
@builtins.property
|
|
1606
|
+
def statistic(self) -> typing.Optional[builtins.str]:
|
|
1607
|
+
'''(deprecated) What function to use for aggregating.
|
|
1608
|
+
|
|
1609
|
+
Can be one of the following:
|
|
1610
|
+
|
|
1611
|
+
- "Minimum" | "min"
|
|
1612
|
+
- "Maximum" | "max"
|
|
1613
|
+
- "Average" | "avg"
|
|
1614
|
+
- "Sum" | "sum"
|
|
1615
|
+
- "SampleCount | "n"
|
|
1616
|
+
- "pNN.NN"
|
|
1617
|
+
|
|
1618
|
+
Cannot be used with ``MathExpression`` objects.
|
|
1619
|
+
|
|
1620
|
+
:default: - The statistic from the metric
|
|
1621
|
+
|
|
1622
|
+
:deprecated: Use ``metric.with({ statistic: ... })`` to encode the period into the Metric object
|
|
1623
|
+
|
|
1624
|
+
:stability: deprecated
|
|
1625
|
+
'''
|
|
1626
|
+
result = self._values.get("statistic")
|
|
1627
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
1628
|
+
|
|
1629
|
+
@builtins.property
|
|
1630
|
+
def std_devs(self) -> typing.Optional[jsii.Number]:
|
|
1631
|
+
'''The number of standard deviations to use for the anomaly detection band.
|
|
1632
|
+
|
|
1633
|
+
The higher the value, the wider the band.
|
|
1634
|
+
|
|
1635
|
+
- Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations.
|
|
1636
|
+
- There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies.
|
|
1637
|
+
|
|
1638
|
+
:default: 2
|
|
1639
|
+
'''
|
|
1640
|
+
result = self._values.get("std_devs")
|
|
1641
|
+
return typing.cast(typing.Optional[jsii.Number], result)
|
|
1642
|
+
|
|
1643
|
+
@builtins.property
|
|
1644
|
+
def treat_missing_data(self) -> typing.Optional["TreatMissingData"]:
|
|
1645
|
+
'''Sets how this alarm is to handle missing data points.
|
|
1646
|
+
|
|
1647
|
+
:default: TreatMissingData.Missing
|
|
1648
|
+
'''
|
|
1649
|
+
result = self._values.get("treat_missing_data")
|
|
1650
|
+
return typing.cast(typing.Optional["TreatMissingData"], result)
|
|
1651
|
+
|
|
1652
|
+
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
1653
|
+
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
1654
|
+
|
|
1655
|
+
def __ne__(self, rhs: typing.Any) -> builtins.bool:
|
|
1656
|
+
return not (rhs == self)
|
|
1657
|
+
|
|
1658
|
+
def __repr__(self) -> str:
|
|
1659
|
+
return "AnomalyDetectionAlarmProps(%s)" % ", ".join(
|
|
1660
|
+
k + "=" + repr(v) for k, v in self._values.items()
|
|
1661
|
+
)
|
|
1662
|
+
|
|
1663
|
+
|
|
1339
1664
|
@jsii.implements(_IInspectable_c2943556, _ITaggableV2_4e6798f8)
|
|
1340
1665
|
class CfnAlarm(
|
|
1341
1666
|
_CfnResource_9df397a6,
|
|
@@ -8932,13 +9257,24 @@ class Metric(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_cloudwatch.Metr
|
|
|
8932
9257
|
|
|
8933
9258
|
Example::
|
|
8934
9259
|
|
|
8935
|
-
#
|
|
9260
|
+
# Create a metric
|
|
9261
|
+
metric = cloudwatch.Metric(
|
|
9262
|
+
namespace="AWS/EC2",
|
|
9263
|
+
metric_name="CPUUtilization",
|
|
9264
|
+
statistic="Average",
|
|
9265
|
+
period=Duration.minutes(5)
|
|
9266
|
+
)
|
|
8936
9267
|
|
|
9268
|
+
# Create an anomaly detection alarm
|
|
9269
|
+
alarm = cloudwatch.AnomalyDetectionAlarm(self, "AnomalyAlarm",
|
|
9270
|
+
metric=metric,
|
|
9271
|
+
evaluation_periods=1,
|
|
8937
9272
|
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
9273
|
+
# Number of standard deviations for the band (default: 2)
|
|
9274
|
+
std_devs=2,
|
|
9275
|
+
# Alarm outside on either side of the band, or just below or above it (default: outside)
|
|
9276
|
+
comparison_operator=cloudwatch.ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
9277
|
+
alarm_description="Alarm when metric is outside the expected band"
|
|
8942
9278
|
)
|
|
8943
9279
|
'''
|
|
8944
9280
|
|
|
@@ -8989,13 +9325,50 @@ class Metric(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_cloudwatch.Metr
|
|
|
8989
9325
|
|
|
8990
9326
|
jsii.create(self.__class__, self, [props])
|
|
8991
9327
|
|
|
8992
|
-
@jsii.member(jsii_name="
|
|
9328
|
+
@jsii.member(jsii_name="anomalyDetectionFor")
|
|
8993
9329
|
@builtins.classmethod
|
|
8994
|
-
def
|
|
8995
|
-
|
|
9330
|
+
def anomaly_detection_for(
|
|
9331
|
+
cls,
|
|
9332
|
+
*,
|
|
9333
|
+
metric: IMetric,
|
|
9334
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
9335
|
+
color: typing.Optional[builtins.str] = None,
|
|
9336
|
+
label: typing.Optional[builtins.str] = None,
|
|
9337
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
9338
|
+
search_account: typing.Optional[builtins.str] = None,
|
|
9339
|
+
search_region: typing.Optional[builtins.str] = None,
|
|
9340
|
+
) -> MathExpression:
|
|
9341
|
+
'''Creates an anomaly detection metric from the provided metric.
|
|
8996
9342
|
|
|
8997
|
-
:param
|
|
8998
|
-
|
|
9343
|
+
:param metric: The metric to add the alarm on. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
|
|
9344
|
+
:param std_devs: The number of standard deviations to use for the anomaly detection band. The higher the value, the wider the band. - Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations. - There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies. Default: 2
|
|
9345
|
+
:param color: Color for this metric when added to a Graph in a Dashboard. Default: - Automatic color
|
|
9346
|
+
:param label: Label for this expression when added to a Graph in a Dashboard. If this expression evaluates to more than one time series (for example, through the use of ``METRICS()`` or ``SEARCH()`` expressions), each time series will appear in the graph using a combination of the expression label and the individual metric label. Specify the empty string (``''``) to suppress the expression label and only keep the metric label. You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_ to show summary information about the 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. If the math expression produces more than one time series, the maximum will be shown for each individual time series produce by this math expression. Default: - Expression value is used as label
|
|
9347
|
+
:param period: The period over which the expression's statistics are applied. This period overrides all periods in the metrics used in this math expression. Default: Duration.minutes(5)
|
|
9348
|
+
:param search_account: Account to evaluate search expressions within. Specifying a searchAccount has no effect to the account used for metrics within the expression (passed via usingMetrics). Default: - Deployment account.
|
|
9349
|
+
:param search_region: Region to evaluate search expressions within. Specifying a searchRegion has no effect to the region used for metrics within the expression (passed via usingMetrics). Default: - Deployment region.
|
|
9350
|
+
|
|
9351
|
+
:return: An anomaly detection metric
|
|
9352
|
+
'''
|
|
9353
|
+
props = AnomalyDetectionMetricOptions(
|
|
9354
|
+
metric=metric,
|
|
9355
|
+
std_devs=std_devs,
|
|
9356
|
+
color=color,
|
|
9357
|
+
label=label,
|
|
9358
|
+
period=period,
|
|
9359
|
+
search_account=search_account,
|
|
9360
|
+
search_region=search_region,
|
|
9361
|
+
)
|
|
9362
|
+
|
|
9363
|
+
return typing.cast(MathExpression, jsii.sinvoke(cls, "anomalyDetectionFor", [props]))
|
|
9364
|
+
|
|
9365
|
+
@jsii.member(jsii_name="grantPutMetricData")
|
|
9366
|
+
@builtins.classmethod
|
|
9367
|
+
def grant_put_metric_data(cls, grantee: _IGrantable_71c4f5de) -> _Grant_a7ae64f8:
|
|
9368
|
+
'''Grant permissions to the given identity to write metrics.
|
|
9369
|
+
|
|
9370
|
+
:param grantee: The IAM identity to give permissions to.
|
|
9371
|
+
'''
|
|
8999
9372
|
if __debug__:
|
|
9000
9373
|
type_hints = typing.get_type_hints(_typecheckingstub__80cc2795f9742554fa1b3991c8df3ae2020ca7ee2fdc5766276d72c863b4eb74)
|
|
9001
9374
|
check_type(argname="argument grantee", value=grantee, expected_type=type_hints["grantee"])
|
|
@@ -9751,29 +10124,24 @@ class MetricProps(CommonMetricOptions):
|
|
|
9751
10124
|
|
|
9752
10125
|
Example::
|
|
9753
10126
|
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
10127
|
+
# Create a metric
|
|
9757
10128
|
metric = cloudwatch.Metric(
|
|
9758
|
-
namespace="
|
|
9759
|
-
metric_name="
|
|
9760
|
-
|
|
10129
|
+
namespace="AWS/EC2",
|
|
10130
|
+
metric_name="CPUUtilization",
|
|
10131
|
+
statistic="Average",
|
|
10132
|
+
period=Duration.minutes(5)
|
|
9761
10133
|
)
|
|
9762
|
-
|
|
10134
|
+
|
|
10135
|
+
# Create an anomaly detection alarm
|
|
10136
|
+
alarm = cloudwatch.AnomalyDetectionAlarm(self, "AnomalyAlarm",
|
|
9763
10137
|
metric=metric,
|
|
9764
|
-
|
|
9765
|
-
evaluation_periods=3,
|
|
9766
|
-
datapoints_to_alarm=2
|
|
9767
|
-
)
|
|
10138
|
+
evaluation_periods=1,
|
|
9768
10139
|
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
alarm_state_to_set=cloudwatch.AlarmState.ALARM
|
|
9775
|
-
)
|
|
9776
|
-
]
|
|
10140
|
+
# Number of standard deviations for the band (default: 2)
|
|
10141
|
+
std_devs=2,
|
|
10142
|
+
# Alarm outside on either side of the band, or just below or above it (default: outside)
|
|
10143
|
+
comparison_operator=cloudwatch.ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
10144
|
+
alarm_description="Alarm when metric is outside the expected band"
|
|
9777
10145
|
)
|
|
9778
10146
|
'''
|
|
9779
10147
|
if __debug__:
|
|
@@ -12898,6 +13266,199 @@ class AlarmWidgetProps(MetricWidgetProps):
|
|
|
12898
13266
|
)
|
|
12899
13267
|
|
|
12900
13268
|
|
|
13269
|
+
@jsii.data_type(
|
|
13270
|
+
jsii_type="aws-cdk-lib.aws_cloudwatch.AnomalyDetectionMetricOptions",
|
|
13271
|
+
jsii_struct_bases=[MathExpressionOptions],
|
|
13272
|
+
name_mapping={
|
|
13273
|
+
"color": "color",
|
|
13274
|
+
"label": "label",
|
|
13275
|
+
"period": "period",
|
|
13276
|
+
"search_account": "searchAccount",
|
|
13277
|
+
"search_region": "searchRegion",
|
|
13278
|
+
"metric": "metric",
|
|
13279
|
+
"std_devs": "stdDevs",
|
|
13280
|
+
},
|
|
13281
|
+
)
|
|
13282
|
+
class AnomalyDetectionMetricOptions(MathExpressionOptions):
|
|
13283
|
+
def __init__(
|
|
13284
|
+
self,
|
|
13285
|
+
*,
|
|
13286
|
+
color: typing.Optional[builtins.str] = None,
|
|
13287
|
+
label: typing.Optional[builtins.str] = None,
|
|
13288
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
13289
|
+
search_account: typing.Optional[builtins.str] = None,
|
|
13290
|
+
search_region: typing.Optional[builtins.str] = None,
|
|
13291
|
+
metric: IMetric,
|
|
13292
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
13293
|
+
) -> None:
|
|
13294
|
+
'''Properties needed to make an anomaly detection alarm from a metric.
|
|
13295
|
+
|
|
13296
|
+
:param color: Color for this metric when added to a Graph in a Dashboard. Default: - Automatic color
|
|
13297
|
+
:param label: Label for this expression when added to a Graph in a Dashboard. If this expression evaluates to more than one time series (for example, through the use of ``METRICS()`` or ``SEARCH()`` expressions), each time series will appear in the graph using a combination of the expression label and the individual metric label. Specify the empty string (``''``) to suppress the expression label and only keep the metric label. You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_ to show summary information about the 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. If the math expression produces more than one time series, the maximum will be shown for each individual time series produce by this math expression. Default: - Expression value is used as label
|
|
13298
|
+
:param period: The period over which the expression's statistics are applied. This period overrides all periods in the metrics used in this math expression. Default: Duration.minutes(5)
|
|
13299
|
+
:param search_account: Account to evaluate search expressions within. Specifying a searchAccount has no effect to the account used for metrics within the expression (passed via usingMetrics). Default: - Deployment account.
|
|
13300
|
+
:param search_region: Region to evaluate search expressions within. Specifying a searchRegion has no effect to the region used for metrics within the expression (passed via usingMetrics). Default: - Deployment region.
|
|
13301
|
+
:param metric: The metric to add the alarm on. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
|
|
13302
|
+
:param std_devs: The number of standard deviations to use for the anomaly detection band. The higher the value, the wider the band. - Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations. - There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies. Default: 2
|
|
13303
|
+
|
|
13304
|
+
:exampleMetadata: fixture=_generated
|
|
13305
|
+
|
|
13306
|
+
Example::
|
|
13307
|
+
|
|
13308
|
+
# The code below shows an example of how to instantiate this type.
|
|
13309
|
+
# The values are placeholders you should change.
|
|
13310
|
+
import aws_cdk as cdk
|
|
13311
|
+
from aws_cdk import aws_cloudwatch as cloudwatch
|
|
13312
|
+
|
|
13313
|
+
# metric: cloudwatch.Metric
|
|
13314
|
+
|
|
13315
|
+
anomaly_detection_metric_options = cloudwatch.AnomalyDetectionMetricOptions(
|
|
13316
|
+
metric=metric,
|
|
13317
|
+
|
|
13318
|
+
# the properties below are optional
|
|
13319
|
+
color="color",
|
|
13320
|
+
label="label",
|
|
13321
|
+
period=cdk.Duration.minutes(30),
|
|
13322
|
+
search_account="searchAccount",
|
|
13323
|
+
search_region="searchRegion",
|
|
13324
|
+
std_devs=123
|
|
13325
|
+
)
|
|
13326
|
+
'''
|
|
13327
|
+
if __debug__:
|
|
13328
|
+
type_hints = typing.get_type_hints(_typecheckingstub__c5ab1cfa142c158cb621ab2339ccaa469bd13773cd7f760d978164625bcdeb80)
|
|
13329
|
+
check_type(argname="argument color", value=color, expected_type=type_hints["color"])
|
|
13330
|
+
check_type(argname="argument label", value=label, expected_type=type_hints["label"])
|
|
13331
|
+
check_type(argname="argument period", value=period, expected_type=type_hints["period"])
|
|
13332
|
+
check_type(argname="argument search_account", value=search_account, expected_type=type_hints["search_account"])
|
|
13333
|
+
check_type(argname="argument search_region", value=search_region, expected_type=type_hints["search_region"])
|
|
13334
|
+
check_type(argname="argument metric", value=metric, expected_type=type_hints["metric"])
|
|
13335
|
+
check_type(argname="argument std_devs", value=std_devs, expected_type=type_hints["std_devs"])
|
|
13336
|
+
self._values: typing.Dict[builtins.str, typing.Any] = {
|
|
13337
|
+
"metric": metric,
|
|
13338
|
+
}
|
|
13339
|
+
if color is not None:
|
|
13340
|
+
self._values["color"] = color
|
|
13341
|
+
if label is not None:
|
|
13342
|
+
self._values["label"] = label
|
|
13343
|
+
if period is not None:
|
|
13344
|
+
self._values["period"] = period
|
|
13345
|
+
if search_account is not None:
|
|
13346
|
+
self._values["search_account"] = search_account
|
|
13347
|
+
if search_region is not None:
|
|
13348
|
+
self._values["search_region"] = search_region
|
|
13349
|
+
if std_devs is not None:
|
|
13350
|
+
self._values["std_devs"] = std_devs
|
|
13351
|
+
|
|
13352
|
+
@builtins.property
|
|
13353
|
+
def color(self) -> typing.Optional[builtins.str]:
|
|
13354
|
+
'''Color for this metric when added to a Graph in a Dashboard.
|
|
13355
|
+
|
|
13356
|
+
:default: - Automatic color
|
|
13357
|
+
'''
|
|
13358
|
+
result = self._values.get("color")
|
|
13359
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
13360
|
+
|
|
13361
|
+
@builtins.property
|
|
13362
|
+
def label(self) -> typing.Optional[builtins.str]:
|
|
13363
|
+
'''Label for this expression when added to a Graph in a Dashboard.
|
|
13364
|
+
|
|
13365
|
+
If this expression evaluates to more than one time series (for
|
|
13366
|
+
example, through the use of ``METRICS()`` or ``SEARCH()`` expressions),
|
|
13367
|
+
each time series will appear in the graph using a combination of the
|
|
13368
|
+
expression label and the individual metric label. Specify the empty
|
|
13369
|
+
string (``''``) to suppress the expression label and only keep the
|
|
13370
|
+
metric label.
|
|
13371
|
+
|
|
13372
|
+
You can use `dynamic labels <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html>`_
|
|
13373
|
+
to show summary information about the displayed time series
|
|
13374
|
+
in the legend. For example, if you use::
|
|
13375
|
+
|
|
13376
|
+
[max: ${MAX}] MyMetric
|
|
13377
|
+
|
|
13378
|
+
As the metric label, the maximum value in the visible range will
|
|
13379
|
+
be shown next to the time series name in the graph's legend. If the
|
|
13380
|
+
math expression produces more than one time series, the maximum
|
|
13381
|
+
will be shown for each individual time series produce by this
|
|
13382
|
+
math expression.
|
|
13383
|
+
|
|
13384
|
+
:default: - Expression value is used as label
|
|
13385
|
+
'''
|
|
13386
|
+
result = self._values.get("label")
|
|
13387
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
13388
|
+
|
|
13389
|
+
@builtins.property
|
|
13390
|
+
def period(self) -> typing.Optional[_Duration_4839e8c3]:
|
|
13391
|
+
'''The period over which the expression's statistics are applied.
|
|
13392
|
+
|
|
13393
|
+
This period overrides all periods in the metrics used in this
|
|
13394
|
+
math expression.
|
|
13395
|
+
|
|
13396
|
+
:default: Duration.minutes(5)
|
|
13397
|
+
'''
|
|
13398
|
+
result = self._values.get("period")
|
|
13399
|
+
return typing.cast(typing.Optional[_Duration_4839e8c3], result)
|
|
13400
|
+
|
|
13401
|
+
@builtins.property
|
|
13402
|
+
def search_account(self) -> typing.Optional[builtins.str]:
|
|
13403
|
+
'''Account to evaluate search expressions within.
|
|
13404
|
+
|
|
13405
|
+
Specifying a searchAccount has no effect to the account used
|
|
13406
|
+
for metrics within the expression (passed via usingMetrics).
|
|
13407
|
+
|
|
13408
|
+
:default: - Deployment account.
|
|
13409
|
+
'''
|
|
13410
|
+
result = self._values.get("search_account")
|
|
13411
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
13412
|
+
|
|
13413
|
+
@builtins.property
|
|
13414
|
+
def search_region(self) -> typing.Optional[builtins.str]:
|
|
13415
|
+
'''Region to evaluate search expressions within.
|
|
13416
|
+
|
|
13417
|
+
Specifying a searchRegion has no effect to the region used
|
|
13418
|
+
for metrics within the expression (passed via usingMetrics).
|
|
13419
|
+
|
|
13420
|
+
:default: - Deployment region.
|
|
13421
|
+
'''
|
|
13422
|
+
result = self._values.get("search_region")
|
|
13423
|
+
return typing.cast(typing.Optional[builtins.str], result)
|
|
13424
|
+
|
|
13425
|
+
@builtins.property
|
|
13426
|
+
def metric(self) -> IMetric:
|
|
13427
|
+
'''The metric to add the alarm on.
|
|
13428
|
+
|
|
13429
|
+
Metric objects can be obtained from most resources, or you can construct
|
|
13430
|
+
custom Metric objects by instantiating one.
|
|
13431
|
+
'''
|
|
13432
|
+
result = self._values.get("metric")
|
|
13433
|
+
assert result is not None, "Required property 'metric' is missing"
|
|
13434
|
+
return typing.cast(IMetric, result)
|
|
13435
|
+
|
|
13436
|
+
@builtins.property
|
|
13437
|
+
def std_devs(self) -> typing.Optional[jsii.Number]:
|
|
13438
|
+
'''The number of standard deviations to use for the anomaly detection band.
|
|
13439
|
+
|
|
13440
|
+
The higher the value, the wider the band.
|
|
13441
|
+
|
|
13442
|
+
- Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations.
|
|
13443
|
+
- There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies.
|
|
13444
|
+
|
|
13445
|
+
:default: 2
|
|
13446
|
+
'''
|
|
13447
|
+
result = self._values.get("std_devs")
|
|
13448
|
+
return typing.cast(typing.Optional[jsii.Number], result)
|
|
13449
|
+
|
|
13450
|
+
def __eq__(self, rhs: typing.Any) -> builtins.bool:
|
|
13451
|
+
return isinstance(rhs, self.__class__) and rhs._values == self._values
|
|
13452
|
+
|
|
13453
|
+
def __ne__(self, rhs: typing.Any) -> builtins.bool:
|
|
13454
|
+
return not (rhs == self)
|
|
13455
|
+
|
|
13456
|
+
def __repr__(self) -> str:
|
|
13457
|
+
return "AnomalyDetectionMetricOptions(%s)" % ", ".join(
|
|
13458
|
+
k + "=" + repr(v) for k, v in self._values.items()
|
|
13459
|
+
)
|
|
13460
|
+
|
|
13461
|
+
|
|
12901
13462
|
@jsii.implements(IWidget)
|
|
12902
13463
|
class Column(metaclass=jsii.JSIIMeta, jsii_type="aws-cdk-lib.aws_cloudwatch.Column"):
|
|
12903
13464
|
'''A widget that contains other widgets in a vertical column.
|
|
@@ -15020,6 +15581,21 @@ class Alarm(
|
|
|
15020
15581
|
'''
|
|
15021
15582
|
return typing.cast(HorizontalAnnotation, jsii.invoke(self, "toAnnotation", []))
|
|
15022
15583
|
|
|
15584
|
+
@jsii.python.classproperty
|
|
15585
|
+
@jsii.member(jsii_name="ANOMALY_DETECTION_NO_THRESHOLD")
|
|
15586
|
+
def ANOMALY_DETECTION_NO_THRESHOLD(cls) -> jsii.Number:
|
|
15587
|
+
'''Conventional value for the threshold property when creating anomaly detection alarms.
|
|
15588
|
+
|
|
15589
|
+
Anomaly detection alarms don't have numbered threshold. Instead, they have a dynamically
|
|
15590
|
+
calculated threshold based on the metric math expression that contains a metric expression.
|
|
15591
|
+
|
|
15592
|
+
The ``threshold`` property is required, but the value is ignored. This
|
|
15593
|
+
constant has the value 0, and has a symbolic name to indicate why the
|
|
15594
|
+
threshold is 0. You can use ``new AnomalyDetectionAlarm()`` to avoid having to pass
|
|
15595
|
+
the ``threshold`` property at all.
|
|
15596
|
+
'''
|
|
15597
|
+
return typing.cast(jsii.Number, jsii.sget(cls, "ANOMALY_DETECTION_NO_THRESHOLD"))
|
|
15598
|
+
|
|
15023
15599
|
@jsii.python.classproperty
|
|
15024
15600
|
@jsii.member(jsii_name="PROPERTY_INJECTION_ID")
|
|
15025
15601
|
def PROPERTY_INJECTION_ID(cls) -> builtins.str:
|
|
@@ -15051,6 +15627,103 @@ class Alarm(
|
|
|
15051
15627
|
return typing.cast(IMetric, jsii.get(self, "metric"))
|
|
15052
15628
|
|
|
15053
15629
|
|
|
15630
|
+
class AnomalyDetectionAlarm(
|
|
15631
|
+
Alarm,
|
|
15632
|
+
metaclass=jsii.JSIIMeta,
|
|
15633
|
+
jsii_type="aws-cdk-lib.aws_cloudwatch.AnomalyDetectionAlarm",
|
|
15634
|
+
):
|
|
15635
|
+
'''CloudWatch Alarm that uses anomaly detection to trigger alarms.
|
|
15636
|
+
|
|
15637
|
+
This alarm type is specifically designed for use with anomaly detection operators
|
|
15638
|
+
like LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD.
|
|
15639
|
+
|
|
15640
|
+
:exampleMetadata: infused
|
|
15641
|
+
|
|
15642
|
+
Example::
|
|
15643
|
+
|
|
15644
|
+
# Create a metric
|
|
15645
|
+
metric = cloudwatch.Metric(
|
|
15646
|
+
namespace="AWS/EC2",
|
|
15647
|
+
metric_name="CPUUtilization",
|
|
15648
|
+
statistic="Average",
|
|
15649
|
+
period=Duration.minutes(5)
|
|
15650
|
+
)
|
|
15651
|
+
|
|
15652
|
+
# Create an anomaly detection alarm
|
|
15653
|
+
alarm = cloudwatch.AnomalyDetectionAlarm(self, "AnomalyAlarm",
|
|
15654
|
+
metric=metric,
|
|
15655
|
+
evaluation_periods=1,
|
|
15656
|
+
|
|
15657
|
+
# Number of standard deviations for the band (default: 2)
|
|
15658
|
+
std_devs=2,
|
|
15659
|
+
# Alarm outside on either side of the band, or just below or above it (default: outside)
|
|
15660
|
+
comparison_operator=cloudwatch.ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,
|
|
15661
|
+
alarm_description="Alarm when metric is outside the expected band"
|
|
15662
|
+
)
|
|
15663
|
+
'''
|
|
15664
|
+
|
|
15665
|
+
def __init__(
|
|
15666
|
+
self,
|
|
15667
|
+
scope: _constructs_77d1e7e8.Construct,
|
|
15668
|
+
id: builtins.str,
|
|
15669
|
+
*,
|
|
15670
|
+
evaluation_periods: jsii.Number,
|
|
15671
|
+
metric: IMetric,
|
|
15672
|
+
actions_enabled: typing.Optional[builtins.bool] = None,
|
|
15673
|
+
alarm_description: typing.Optional[builtins.str] = None,
|
|
15674
|
+
alarm_name: typing.Optional[builtins.str] = None,
|
|
15675
|
+
comparison_operator: typing.Optional[ComparisonOperator] = None,
|
|
15676
|
+
datapoints_to_alarm: typing.Optional[jsii.Number] = None,
|
|
15677
|
+
evaluate_low_sample_count_percentile: typing.Optional[builtins.str] = None,
|
|
15678
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
15679
|
+
statistic: typing.Optional[builtins.str] = None,
|
|
15680
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
15681
|
+
treat_missing_data: typing.Optional[TreatMissingData] = None,
|
|
15682
|
+
) -> None:
|
|
15683
|
+
'''
|
|
15684
|
+
:param scope: -
|
|
15685
|
+
:param id: -
|
|
15686
|
+
:param evaluation_periods: The number of periods over which data is compared to the specified threshold.
|
|
15687
|
+
:param metric: The metric to add the alarm on. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
|
|
15688
|
+
:param actions_enabled: Whether the actions for this alarm are enabled. Default: true
|
|
15689
|
+
:param alarm_description: Description for the alarm. Default: No description
|
|
15690
|
+
:param alarm_name: Name of the alarm. Default: Automatically generated name
|
|
15691
|
+
:param comparison_operator: Comparison operator to use to check if metric is breaching. Must be one of the anomaly detection operators: - LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD - GREATER_THAN_UPPER_THRESHOLD - LESS_THAN_LOWER_THRESHOLD Default: LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD
|
|
15692
|
+
:param datapoints_to_alarm: The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide. Default: ``evaluationPeriods``
|
|
15693
|
+
:param evaluate_low_sample_count_percentile: Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. Used only for alarms that are based on percentiles. Default: - Not configured.
|
|
15694
|
+
:param period: (deprecated) The period over which the specified statistic is applied. Cannot be used with ``MathExpression`` objects. Default: - The period from the metric
|
|
15695
|
+
:param statistic: (deprecated) What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Cannot be used with ``MathExpression`` objects. Default: - The statistic from the metric
|
|
15696
|
+
:param std_devs: The number of standard deviations to use for the anomaly detection band. The higher the value, the wider the band. - Must be greater than 0. A value of 0 or negative values would not make sense in the context of calculating standard deviations. - There is no strict maximum value defined, as standard deviations can theoretically extend infinitely. However, in practice, values beyond 5 or 6 standard deviations are rarely used, as they would result in an extremely wide anomaly detection band, potentially missing significant anomalies. Default: 2
|
|
15697
|
+
:param treat_missing_data: Sets how this alarm is to handle missing data points. Default: TreatMissingData.Missing
|
|
15698
|
+
'''
|
|
15699
|
+
if __debug__:
|
|
15700
|
+
type_hints = typing.get_type_hints(_typecheckingstub__a7086e47981f437b1862310e2c90e4c5bcd6054dc3450e46e526bc835a0fdda0)
|
|
15701
|
+
check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
|
|
15702
|
+
check_type(argname="argument id", value=id, expected_type=type_hints["id"])
|
|
15703
|
+
props = AnomalyDetectionAlarmProps(
|
|
15704
|
+
evaluation_periods=evaluation_periods,
|
|
15705
|
+
metric=metric,
|
|
15706
|
+
actions_enabled=actions_enabled,
|
|
15707
|
+
alarm_description=alarm_description,
|
|
15708
|
+
alarm_name=alarm_name,
|
|
15709
|
+
comparison_operator=comparison_operator,
|
|
15710
|
+
datapoints_to_alarm=datapoints_to_alarm,
|
|
15711
|
+
evaluate_low_sample_count_percentile=evaluate_low_sample_count_percentile,
|
|
15712
|
+
period=period,
|
|
15713
|
+
statistic=statistic,
|
|
15714
|
+
std_devs=std_devs,
|
|
15715
|
+
treat_missing_data=treat_missing_data,
|
|
15716
|
+
)
|
|
15717
|
+
|
|
15718
|
+
jsii.create(self.__class__, self, [scope, id, props])
|
|
15719
|
+
|
|
15720
|
+
@jsii.python.classproperty
|
|
15721
|
+
@jsii.member(jsii_name="PROPERTY_INJECTION_ID")
|
|
15722
|
+
def PROPERTY_INJECTION_ID(cls) -> builtins.str:
|
|
15723
|
+
'''Uniquely identifies this class.'''
|
|
15724
|
+
return typing.cast(builtins.str, jsii.sget(cls, "PROPERTY_INJECTION_ID"))
|
|
15725
|
+
|
|
15726
|
+
|
|
15054
15727
|
__all__ = [
|
|
15055
15728
|
"Alarm",
|
|
15056
15729
|
"AlarmActionConfig",
|
|
@@ -15063,6 +15736,9 @@ __all__ = [
|
|
|
15063
15736
|
"AlarmStatusWidgetSortBy",
|
|
15064
15737
|
"AlarmWidget",
|
|
15065
15738
|
"AlarmWidgetProps",
|
|
15739
|
+
"AnomalyDetectionAlarm",
|
|
15740
|
+
"AnomalyDetectionAlarmProps",
|
|
15741
|
+
"AnomalyDetectionMetricOptions",
|
|
15066
15742
|
"CfnAlarm",
|
|
15067
15743
|
"CfnAlarmProps",
|
|
15068
15744
|
"CfnAnomalyDetector",
|
|
@@ -15205,6 +15881,24 @@ def _typecheckingstub__b487d6400a85492ffe968131ec5a7294320f90cef90f0505f02beffc7
|
|
|
15205
15881
|
"""Type checking stubs"""
|
|
15206
15882
|
pass
|
|
15207
15883
|
|
|
15884
|
+
def _typecheckingstub__d770d314ce70d6c9f6003c8d6c5aa5cc35a2de931e79a5b71b5612d03298011d(
|
|
15885
|
+
*,
|
|
15886
|
+
evaluation_periods: jsii.Number,
|
|
15887
|
+
metric: IMetric,
|
|
15888
|
+
actions_enabled: typing.Optional[builtins.bool] = None,
|
|
15889
|
+
alarm_description: typing.Optional[builtins.str] = None,
|
|
15890
|
+
alarm_name: typing.Optional[builtins.str] = None,
|
|
15891
|
+
comparison_operator: typing.Optional[ComparisonOperator] = None,
|
|
15892
|
+
datapoints_to_alarm: typing.Optional[jsii.Number] = None,
|
|
15893
|
+
evaluate_low_sample_count_percentile: typing.Optional[builtins.str] = None,
|
|
15894
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
15895
|
+
statistic: typing.Optional[builtins.str] = None,
|
|
15896
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
15897
|
+
treat_missing_data: typing.Optional[TreatMissingData] = None,
|
|
15898
|
+
) -> None:
|
|
15899
|
+
"""Type checking stubs"""
|
|
15900
|
+
pass
|
|
15901
|
+
|
|
15208
15902
|
def _typecheckingstub__5adc477b9cef758736625389f1a51dec08eb7b348be35f42b0e37d6d4d1f1b68(
|
|
15209
15903
|
scope: _constructs_77d1e7e8.Construct,
|
|
15210
15904
|
id: builtins.str,
|
|
@@ -16545,6 +17239,19 @@ def _typecheckingstub__8b6bef2cc64a78bffd68dc95a764829a6c125294deaebcd42b56c4935
|
|
|
16545
17239
|
"""Type checking stubs"""
|
|
16546
17240
|
pass
|
|
16547
17241
|
|
|
17242
|
+
def _typecheckingstub__c5ab1cfa142c158cb621ab2339ccaa469bd13773cd7f760d978164625bcdeb80(
|
|
17243
|
+
*,
|
|
17244
|
+
color: typing.Optional[builtins.str] = None,
|
|
17245
|
+
label: typing.Optional[builtins.str] = None,
|
|
17246
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
17247
|
+
search_account: typing.Optional[builtins.str] = None,
|
|
17248
|
+
search_region: typing.Optional[builtins.str] = None,
|
|
17249
|
+
metric: IMetric,
|
|
17250
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
17251
|
+
) -> None:
|
|
17252
|
+
"""Type checking stubs"""
|
|
17253
|
+
pass
|
|
17254
|
+
|
|
16548
17255
|
def _typecheckingstub__76ce8e89badc991e6248d5096f1d0b7ed5c9b4e588f4383e932e8f87c07043c6(
|
|
16549
17256
|
*widgets: IWidget,
|
|
16550
17257
|
) -> None:
|
|
@@ -16798,3 +17505,23 @@ def _typecheckingstub__35e42b79cd71f370c96d9123c26abff1c323e3360845e3957f3fa6b0b
|
|
|
16798
17505
|
) -> None:
|
|
16799
17506
|
"""Type checking stubs"""
|
|
16800
17507
|
pass
|
|
17508
|
+
|
|
17509
|
+
def _typecheckingstub__a7086e47981f437b1862310e2c90e4c5bcd6054dc3450e46e526bc835a0fdda0(
|
|
17510
|
+
scope: _constructs_77d1e7e8.Construct,
|
|
17511
|
+
id: builtins.str,
|
|
17512
|
+
*,
|
|
17513
|
+
evaluation_periods: jsii.Number,
|
|
17514
|
+
metric: IMetric,
|
|
17515
|
+
actions_enabled: typing.Optional[builtins.bool] = None,
|
|
17516
|
+
alarm_description: typing.Optional[builtins.str] = None,
|
|
17517
|
+
alarm_name: typing.Optional[builtins.str] = None,
|
|
17518
|
+
comparison_operator: typing.Optional[ComparisonOperator] = None,
|
|
17519
|
+
datapoints_to_alarm: typing.Optional[jsii.Number] = None,
|
|
17520
|
+
evaluate_low_sample_count_percentile: typing.Optional[builtins.str] = None,
|
|
17521
|
+
period: typing.Optional[_Duration_4839e8c3] = None,
|
|
17522
|
+
statistic: typing.Optional[builtins.str] = None,
|
|
17523
|
+
std_devs: typing.Optional[jsii.Number] = None,
|
|
17524
|
+
treat_missing_data: typing.Optional[TreatMissingData] = None,
|
|
17525
|
+
) -> None:
|
|
17526
|
+
"""Type checking stubs"""
|
|
17527
|
+
pass
|