Skip to content
v2.278.0

ScalingTriggerProperty Struct ​

The conditions that trigger an automatic scaling activity and the definition of a CloudWatch metric alarm.

When the defined alarm conditions are met along with other trigger parameters, 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 scalingTriggerProperty: stepfunctions_tasks.EmrCreateCluster.ScalingTriggerProperty = {
  cloudWatchAlarmDefinition: {
    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

scaling_trigger_property = stepfunctions_tasks.EmrCreateCluster.ScalingTriggerProperty(
    cloud_watch_alarm_definition=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.*;

ScalingTriggerProperty scalingTriggerProperty = ScalingTriggerProperty.builder()
        .cloudWatchAlarmDefinition(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())
        .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 scalingTriggerProperty = new ScalingTriggerProperty {
    CloudWatchAlarmDefinition = 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"

scalingTriggerProperty := &ScalingTriggerProperty{
	CloudWatchAlarmDefinition: &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 ​

cloudWatchAlarmDefinitionEmrCreateCluster.CloudWatchAlarmDefinitionPropertycloud_watch_alarm_definitionCloudWatchAlarmDefinitionPropertycloudWatchAlarmDefinitionCloudWatchAlarmDefinitionPropertyCloudWatchAlarmDefinitionCloudWatchAlarmDefinitionPropertyCloudWatchAlarmDefinitionCloudWatchAlarmDefinitionProperty required #
The definition of a CloudWatch metric alarm.

When the defined alarm conditions are met along with other trigger parameters, scaling activity begins.