Skip to content
v2.278.0

CloudWatchAlarmDefinitionProperty Struct ​

CloudWatchAlarmDefinition is a subproperty of the ScalingTrigger property, which determines when to trigger an automatic scaling activity.

Scaling activity begins when you satisfy the defined alarm conditions.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_emr as emr } from 'aws-cdk-lib';
const cloudWatchAlarmDefinitionProperty: emr.CfnCluster.CloudWatchAlarmDefinitionProperty = {
  comparisonOperator: 'comparisonOperator',
  metricName: 'metricName',
  period: 123,
  threshold: 123,

  // the properties below are optional
  dimensions: [{
    key: 'key',
    value: 'value',
  }],
  evaluationPeriods: 123,
  namespace: 'namespace',
  statistic: 'statistic',
  unit: 'unit',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_emr as emr

cloud_watch_alarm_definition_property = emr.CfnCluster.CloudWatchAlarmDefinitionProperty(
    comparison_operator="comparisonOperator",
    metric_name="metricName",
    period=123,
    threshold=123,

    # the properties below are optional
    dimensions=[emr.CfnCluster.MetricDimensionProperty(
        key="key",
        value="value"
    )],
    evaluation_periods=123,
    namespace="namespace",
    statistic="statistic",
    unit="unit"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.emr.*;

CloudWatchAlarmDefinitionProperty cloudWatchAlarmDefinitionProperty = CloudWatchAlarmDefinitionProperty.builder()
        .comparisonOperator("comparisonOperator")
        .metricName("metricName")
        .period(123)
        .threshold(123)

        // the properties below are optional
        .dimensions(List.of(MetricDimensionProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .evaluationPeriods(123)
        .namespace("namespace")
        .statistic("statistic")
        .unit("unit")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EMR;

var cloudWatchAlarmDefinitionProperty = new CloudWatchAlarmDefinitionProperty {
    ComparisonOperator = "comparisonOperator",
    MetricName = "metricName",
    Period = 123,
    Threshold = 123,

    // the properties below are optional
    Dimensions = new [] { new MetricDimensionProperty {
        Key = "key",
        Value = "value"
    } },
    EvaluationPeriods = 123,
    Namespace = "namespace",
    Statistic = "statistic",
    Unit = "unit"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cloudWatchAlarmDefinitionProperty := &CloudWatchAlarmDefinitionProperty{
	ComparisonOperator: jsii.String("comparisonOperator"),
	MetricName: jsii.String("metricName"),
	Period: jsii.Number(123),
	Threshold: jsii.Number(123),

	// the properties below are optional
	Dimensions: []interface{}{
		&MetricDimensionProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	EvaluationPeriods: jsii.Number(123),
	Namespace: jsii.String("namespace"),
	Statistic: jsii.String("statistic"),
	Unit: jsii.String("unit"),
}

Properties ​

comparisonOperatorstringcomparison_operatorstrcomparisonOperatorStringComparisonOperatorstringComparisonOperator*string required #
Determines how the metric specified by `MetricName` is compared to the value specified by `Threshold` .
dimensionsoptionalIResolvable | IResolvable | CfnCluster.MetricDimensionProperty[]dimensionsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricDimensionProperty]]]dimensionsoptionalIResolvableDimensionsoptionalIResolvableDimensionsoptionalinterface{} #
A CloudWatch metric dimension.
evaluationPeriodsoptionalnumberevaluation_periodsoptionalint | floatevaluationPeriodsoptionalNumberEvaluationPeriodsoptionaldoubleEvaluationPeriodsoptional*float64 #
The number of periods, in five-minute increments, during which the alarm condition must exist before the alarm triggers automatic scaling activity.

The default value is 1 .

metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*string required #
The name of the CloudWatch metric that is watched to determine an alarm condition.
namespaceoptionalstringnamespaceoptionalstrnamespaceoptionalStringNamespaceoptionalstringNamespaceoptional*string #
The namespace for the CloudWatch metric.

The default is AWS/ElasticMapReduce .

periodnumberperiodint | floatperiodNumberPerioddoublePeriod*float64 required #
The period, in seconds, over which the statistic is applied.

CloudWatch metrics for Amazon EMR are emitted every five minutes (300 seconds), so if you specify a CloudWatch metric, specify 300 .

statisticoptionalstringstatisticoptionalstrstatisticoptionalStringStatisticoptionalstringStatisticoptional*string #
The statistic to apply to the metric associated with the alarm.

The default is AVERAGE .

thresholdnumberthresholdint | floatthresholdNumberThresholddoubleThreshold*float64 required #
The value against which the specified statistic is compared.
unitoptionalstringunitoptionalstrunitoptionalStringUnitoptionalstringUnitoptional*string #
The unit of measure associated with the CloudWatch metric being watched.

The value specified for Unit must correspond to the units specified in the CloudWatch metric.