Skip to content
v2.278.0

ScalingRuleProperty Struct ​

A scale-in or scale-out rule that defines scaling activity, including the CloudWatch metric alarm that triggers activity, how EC2 instances are added or removed, and the periodicity of adjustments.

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 scalingRuleProperty: stepfunctions_tasks.EmrCreateCluster.ScalingRuleProperty = {
  action: {
    simpleScalingPolicyConfiguration: {
      scalingAdjustment: 123,

      // the properties below are optional
      adjustmentType: stepfunctions_tasks.EmrCreateCluster.ScalingAdjustmentType.CHANGE_IN_CAPACITY,
      coolDown: 123,
    },

    // the properties below are optional
    market: stepfunctions_tasks.EmrCreateCluster.InstanceMarket.ON_DEMAND,
  },
  name: 'name',
  trigger: {
    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,
    },
  },

  // the properties below are optional
  description: 'description',
};
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_rule_property = stepfunctions_tasks.EmrCreateCluster.ScalingRuleProperty(
    action=stepfunctions_tasks.EmrCreateCluster.ScalingActionProperty(
        simple_scaling_policy_configuration=stepfunctions_tasks.EmrCreateCluster.SimpleScalingPolicyConfigurationProperty(
            scaling_adjustment=123,

            # the properties below are optional
            adjustment_type=stepfunctions_tasks.EmrCreateCluster.ScalingAdjustmentType.CHANGE_IN_CAPACITY,
            cool_down=123
        ),

        # the properties below are optional
        market=stepfunctions_tasks.EmrCreateCluster.InstanceMarket.ON_DEMAND
    ),
    name="name",
    trigger=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
        )
    ),

    # the properties below are optional
    description="description"
)
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.*;

ScalingRuleProperty scalingRuleProperty = ScalingRuleProperty.builder()
        .action(ScalingActionProperty.builder()
                .simpleScalingPolicyConfiguration(SimpleScalingPolicyConfigurationProperty.builder()
                        .scalingAdjustment(123)

                        // the properties below are optional
                        .adjustmentType(EmrCreateCluster.getScalingAdjustmentType().CHANGE_IN_CAPACITY)
                        .coolDown(123)
                        .build())

                // the properties below are optional
                .market(EmrCreateCluster.getInstanceMarket().ON_DEMAND)
                .build())
        .name("name")
        .trigger(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())

        // the properties below are optional
        .description("description")
        .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 scalingRuleProperty = new ScalingRuleProperty {
    Action = new ScalingActionProperty {
        SimpleScalingPolicyConfiguration = new SimpleScalingPolicyConfigurationProperty {
            ScalingAdjustment = 123,

            // the properties below are optional
            AdjustmentType = EmrCreateCluster.ScalingAdjustmentType.CHANGE_IN_CAPACITY,
            CoolDown = 123
        },

        // the properties below are optional
        Market = EmrCreateCluster.InstanceMarket.ON_DEMAND
    },
    Name = "name",
    Trigger = 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
        }
    },

    // the properties below are optional
    Description = "description"
};
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"

scalingRuleProperty := &ScalingRuleProperty{
	Action: &ScalingActionProperty{
		SimpleScalingPolicyConfiguration: &SimpleScalingPolicyConfigurationProperty{
			ScalingAdjustment: jsii.Number(123),

			// the properties below are optional
			AdjustmentType: awscdk.Aws_stepfunctions_tasks.EmrCreateCluster.ScalingAdjustmentType_CHANGE_IN_CAPACITY,
			CoolDown: jsii.Number(123),
		},

		// the properties below are optional
		Market: awscdk.*Aws_stepfunctions_tasks.EmrCreateCluster.InstanceMarket_ON_DEMAND,
	},
	Name: jsii.String("name"),
	Trigger: &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,
		},
	},

	// the properties below are optional
	Description: jsii.String("description"),
}

Properties ​

The conditions that trigger an automatic scaling activity.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = None #
A friendly, more verbose description of the automatic scaling rule.
namestringnamestrnameStringNamestringName*string required #
The name used to identify an automatic scaling rule.

Rule names must be unique within a scaling policy.

The CloudWatch alarm definition that determines when automatic scaling activity is triggered.