Skip to content
v2.278.0

CloudWatchAlarmDefinitionProperty Struct ​

The definition of a CloudWatch metric alarm, which determines when an automatic scaling activity is triggered.

When the defined alarm conditions are satisfied, scaling activity begins.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_stepfunctions_tasks as stepfunctions_tasks } from 'aws-cdk-lib';
const cloudWatchAlarmDefinitionProperty: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmDefinitionProperty = {
  comparisonOperator: stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
  metricName: 'metricName',
  period: cdk.Duration.minutes(30),

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

cloud_watch_alarm_definition_property = stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmDefinitionProperty(
    comparison_operator=stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
    metric_name="metricName",
    period=cdk.Duration.minutes(30),

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

CloudWatchAlarmDefinitionProperty cloudWatchAlarmDefinitionProperty = CloudWatchAlarmDefinitionProperty.builder()
        .comparisonOperator(EmrCreateCluster.getCloudWatchAlarmComparisonOperator().GREATER_THAN_OR_EQUAL)
        .metricName("metricName")
        .period(Duration.minutes(30))

        // the properties below are optional
        .dimensions(List.of(MetricDimensionProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .evaluationPeriods(123)
        .namespace("namespace")
        .statistic(EmrCreateCluster.getCloudWatchAlarmStatistic().SAMPLE_COUNT)
        .threshold(123)
        .unit(EmrCreateCluster.getCloudWatchAlarmUnit().NONE)
        .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;
using Amazon.CDK.AWS.StepFunctions.Tasks;

var cloudWatchAlarmDefinitionProperty = new CloudWatchAlarmDefinitionProperty {
    ComparisonOperator = EmrCreateCluster.CloudWatchAlarmComparisonOperator.GREATER_THAN_OR_EQUAL,
    MetricName = "metricName",
    Period = Duration.Minutes(30),

    // the properties below are optional
    Dimensions = new [] { new MetricDimensionProperty {
        Key = "key",
        Value = "value"
    } },
    EvaluationPeriods = 123,
    Namespace = "namespace",
    Statistic = EmrCreateCluster.CloudWatchAlarmStatistic.SAMPLE_COUNT,
    Threshold = 123,
    Unit = EmrCreateCluster.CloudWatchAlarmUnit.NONE
};
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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

cloudWatchAlarmDefinitionProperty := &CloudWatchAlarmDefinitionProperty{
	ComparisonOperator: awscdk.Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmComparisonOperator_GREATER_THAN_OR_EQUAL,
	MetricName: jsii.String("metricName"),
	Period: cdk.Duration_Minutes(jsii.Number(30)),

	// the properties below are optional
	Dimensions: []MetricDimensionProperty{
		&MetricDimensionProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	EvaluationPeriods: jsii.Number(123),
	Namespace: jsii.String("namespace"),
	Statistic: awscdk.*Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmStatistic_SAMPLE_COUNT,
	Threshold: jsii.Number(123),
	Unit: awscdk.*Aws_stepfunctions_tasks.EmrCreateCluster.CloudWatchAlarmUnit_NONE,
}

Properties ​

Determines how the metric specified by MetricName is compared to the value specified by Threshold.
dimensionsoptionalEmrCreateCluster.MetricDimensionProperty[]dimensionsoptionaltyping.List[MetricDimensionProperty]dimensionsoptionalList<MetricDimensionProperty>DimensionsoptionalMetricDimensionProperty[]Dimensionsoptional*[]MetricDimensionProperty #
A CloudWatch metric dimension.

Default: No dimensions

evaluationPeriodsoptionalnumberevaluation_periodsoptionalint | floatevaluationPeriodsoptionalNumberEvaluationPeriodsoptionaldoubleEvaluationPeriodsoptional*float64 = 1 #
The number of periods, in five-minute increments, during which the alarm condition must exist before the alarm triggers automatic scaling activity.
metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*string required #
The name of the CloudWatch metric that is watched to determine an alarm condition.
namespaceoptionalstringnamespaceoptionalstrnamespaceoptionalStringNamespaceoptionalstringNamespaceoptional*string = 'AWS/ElasticMapReduce' #
The namespace for the CloudWatch metric.
periodDurationperiodDurationperiodDurationPeriodDurationPeriodDuration required #
The period, in seconds, over which the statistic is applied.

EMR CloudWatch metrics are emitted every five minutes (300 seconds), so if an EMR CloudWatch metric is specified, specify 300.

statisticoptionalEmrCreateCluster.CloudWatchAlarmStatisticstatisticoptionalCloudWatchAlarmStatisticstatisticoptionalCloudWatchAlarmStatisticStatisticoptionalCloudWatchAlarmStatisticStatisticoptionalCloudWatchAlarmStatistic = CloudWatchAlarmStatistic.AVERAGE #
The statistic to apply to the metric associated with the alarm.
thresholdoptionalnumberthresholdoptionalint | floatthresholdoptionalNumberThresholdoptionaldoubleThresholdoptional*float64 = None #
The value against which the specified statistic is compared.
unitoptionalEmrCreateCluster.CloudWatchAlarmUnitunitoptionalCloudWatchAlarmUnitunitoptionalCloudWatchAlarmUnitUnitoptionalCloudWatchAlarmUnitUnitoptionalCloudWatchAlarmUnit = CloudWatchAlarmUnit.NONE #
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.