CfnAlarmPropsMixin

class aws_cdk.mixins_preview.aws_cloudwatch.mixins.CfnAlarmPropsMixin(props, *, strategy=None)

Bases: Mixin

The AWS::CloudWatch::Alarm type specifies an alarm and associates it with the specified metric or metric math expression.

When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA . The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.

When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-alarm.html

CloudformationResource:

AWS::CloudWatch::Alarm

Mixin:

true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview import mixins
from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins

cfn_alarm_props_mixin = cloudwatch_mixins.CfnAlarmPropsMixin(cloudwatch_mixins.CfnAlarmMixinProps(
    actions_enabled=False,
    alarm_actions=["alarmActions"],
    alarm_description="alarmDescription",
    alarm_name="alarmName",
    comparison_operator="comparisonOperator",
    datapoints_to_alarm=123,
    dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
        name="name",
        value="value"
    )],
    evaluate_low_sample_count_percentile="evaluateLowSampleCountPercentile",
    evaluation_periods=123,
    extended_statistic="extendedStatistic",
    insufficient_data_actions=["insufficientDataActions"],
    metric_name="metricName",
    metrics=[cloudwatch_mixins.CfnAlarmPropsMixin.MetricDataQueryProperty(
        account_id="accountId",
        expression="expression",
        id="id",
        label="label",
        metric_stat=cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty(
            metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty(
                dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
                    name="name",
                    value="value"
                )],
                metric_name="metricName",
                namespace="namespace"
            ),
            period=123,
            stat="stat",
            unit="unit"
        ),
        period=123,
        return_data=False
    )],
    namespace="namespace",
    ok_actions=["okActions"],
    period=123,
    statistic="statistic",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    threshold=123,
    threshold_metric_id="thresholdMetricId",
    treat_missing_data="treatMissingData",
    unit="unit"
),
    strategy=mixins.PropertyMergeStrategy.OVERRIDE
)

Create a mixin to apply properties to AWS::CloudWatch::Alarm.

Parameters:
  • props (Union[CfnAlarmMixinProps, Dict[str, Any]]) – L1 properties to apply.

  • strategy (Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE

Methods

apply_to(construct)

Apply the mixin properties to the construct.

Parameters:

construct (IConstruct)

Return type:

IConstruct

supports(construct)

Check if this mixin supports the given construct.

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

CFN_PROPERTY_KEYS = ['actionsEnabled', 'alarmActions', 'alarmDescription', 'alarmName', 'comparisonOperator', 'datapointsToAlarm', 'dimensions', 'evaluateLowSampleCountPercentile', 'evaluationPeriods', 'extendedStatistic', 'insufficientDataActions', 'metricName', 'metrics', 'namespace', 'okActions', 'period', 'statistic', 'tags', 'threshold', 'thresholdMetricId', 'treatMissingData', 'unit']

Static Methods

classmethod is_mixin(x)

(experimental) Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.

Stability:

experimental

DimensionProperty

class CfnAlarmPropsMixin.DimensionProperty(*, name=None, value=None)

Bases: object

Dimension is an embedded property of the AWS::CloudWatch::Alarm type.

Dimensions are name/value pairs that can be associated with a CloudWatch metric. You can specify a maximum of 30 dimensions for a given metric.

Parameters:
  • name (Optional[str]) – The name of the dimension, from 1–255 characters in length. This dimension name must have been included when the metric was published.

  • value (Optional[str]) – The value for the dimension, from 1–255 characters in length.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-dimension.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins

dimension_property = cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
    name="name",
    value="value"
)

Attributes

name

The name of the dimension, from 1–255 characters in length.

This dimension name must have been included when the metric was published.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-dimension.html#cfn-cloudwatch-alarm-dimension-name

value

The value for the dimension, from 1–255 characters in length.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-dimension.html#cfn-cloudwatch-alarm-dimension-value

MetricDataQueryProperty

class CfnAlarmPropsMixin.MetricDataQueryProperty(*, account_id=None, expression=None, id=None, label=None, metric_stat=None, period=None, return_data=None)

Bases: object

The MetricDataQuery property type specifies the metric data to return, and whether this call is just retrieving a batch set of data for one metric, or is performing a math expression on metric data.

Any expression used must return a single time series. For more information, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .

Parameters:
  • account_id (Optional[str]) – The ID of the account where the metrics are located, if this is a cross-account alarm.

  • expression (Optional[str]) –

    The math expression to be performed on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide . Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.

  • id (Optional[str]) – A short name used to tie this object to the results in the response. This name must be unique within a single call to GetMetricData . If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.

  • label (Optional[str]) – A human-readable label for this metric or expression. This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default.

  • metric_stat (Union[IResolvable, MetricStatProperty, Dict[str, Any], None]) – The metric to be returned, along with statistics, period, and units. Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data. Within one MetricDataQuery object, you must specify either Expression or MetricStat but not both.

  • period (Union[int, float, None]) – The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData operation that includes a StorageResolution of 1 second .

  • return_data (Union[bool, IResolvable, None]) – This option indicates whether to return the timestamps and raw data values of this metric. When you create an alarm based on a metric math expression, specify True for this value for only the one math expression that the alarm is based on. You must specify False for ReturnData for all the other metrics and expressions used in the alarm. This field is required.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins

metric_data_query_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricDataQueryProperty(
    account_id="accountId",
    expression="expression",
    id="id",
    label="label",
    metric_stat=cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty(
        metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty(
            dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
                name="name",
                value="value"
            )],
            metric_name="metricName",
            namespace="namespace"
        ),
        period=123,
        stat="stat",
        unit="unit"
    ),
    period=123,
    return_data=False
)

Attributes

account_id

The ID of the account where the metrics are located, if this is a cross-account alarm.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-accountid

expression

The math expression to be performed on the returned data, if this object is performing a math expression.

This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .

Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-expression

id

A short name used to tie this object to the results in the response.

This name must be unique within a single call to GetMetricData . If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-id

label

A human-readable label for this metric or expression.

This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-label

metric_stat

The metric to be returned, along with statistics, period, and units.

Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data.

Within one MetricDataQuery object, you must specify either Expression or MetricStat but not both.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-metricstat

period

The granularity, in seconds, of the returned data points.

For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData operation that includes a StorageResolution of 1 second .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-period

return_data

This option indicates whether to return the timestamps and raw data values of this metric.

When you create an alarm based on a metric math expression, specify True for this value for only the one math expression that the alarm is based on. You must specify False for ReturnData for all the other metrics and expressions used in the alarm.

This field is required.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricdataquery.html#cfn-cloudwatch-alarm-metricdataquery-returndata

MetricProperty

class CfnAlarmPropsMixin.MetricProperty(*, dimensions=None, metric_name=None, namespace=None)

Bases: object

The Metric property type represents a specific metric.

Metric is a property of the MetricStat property type.

Parameters:
  • dimensions (Union[IResolvable, Sequence[Union[IResolvable, DimensionProperty, Dict[str, Any]]], None]) – The metric dimensions that you want to be used for the metric that the alarm will watch.

  • metric_name (Optional[str]) – The name of the metric that you want the alarm to watch. This is a required field.

  • namespace (Optional[str]) – The namespace of the metric that the alarm will watch.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metric.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins

metric_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty(
    dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
        name="name",
        value="value"
    )],
    metric_name="metricName",
    namespace="namespace"
)

Attributes

dimensions

The metric dimensions that you want to be used for the metric that the alarm will watch.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metric.html#cfn-cloudwatch-alarm-metric-dimensions

metric_name

The name of the metric that you want the alarm to watch.

This is a required field.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metric.html#cfn-cloudwatch-alarm-metric-metricname

namespace

The namespace of the metric that the alarm will watch.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metric.html#cfn-cloudwatch-alarm-metric-namespace

MetricStatProperty

class CfnAlarmPropsMixin.MetricStatProperty(*, metric=None, period=None, stat=None, unit=None)

Bases: object

This structure defines the metric to be returned, along with the statistics, period, and units.

MetricStat is a property of the MetricDataQuery property type.

Parameters:
  • metric (Union[IResolvable, MetricProperty, Dict[str, Any], None]) – The metric to return, including the metric name, namespace, and dimensions.

  • period (Union[int, float, None]) – The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData call that includes a StorageResolution of 1 second. If the StartTime parameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned: - Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute). - Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes). - Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).

  • stat (Optional[str]) – The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

  • unit (Optional[str]) – The unit to use for the returned data points. Valid values are: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, or None.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricstat.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins

metric_stat_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty(
    metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty(
        dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty(
            name="name",
            value="value"
        )],
        metric_name="metricName",
        namespace="namespace"
    ),
    period=123,
    stat="stat",
    unit="unit"
)

Attributes

metric

The metric to return, including the metric name, namespace, and dimensions.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricstat.html#cfn-cloudwatch-alarm-metricstat-metric

period

The granularity, in seconds, of the returned data points.

For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a PutMetricData call that includes a StorageResolution of 1 second.

If the StartTime parameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned:

  • Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).

  • Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).

  • Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricstat.html#cfn-cloudwatch-alarm-metricstat-period

stat

The statistic to return.

It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricstat.html#cfn-cloudwatch-alarm-metricstat-stat

unit

The unit to use for the returned data points.

Valid values are: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, or None.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudwatch-alarm-metricstat.html#cfn-cloudwatch-alarm-metricstat-unit