Skip to content
v2.278.0

AutoScalingPolicyProperty Struct ​

An automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster.

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 autoScalingPolicyProperty: stepfunctions_tasks.EmrCreateCluster.AutoScalingPolicyProperty = {
  constraints: {
    maxCapacity: 123,
    minCapacity: 123,
  },
  rules: [{
    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

auto_scaling_policy_property = stepfunctions_tasks.EmrCreateCluster.AutoScalingPolicyProperty(
    constraints=stepfunctions_tasks.EmrCreateCluster.ScalingConstraintsProperty(
        max_capacity=123,
        min_capacity=123
    ),
    rules=[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.*;

AutoScalingPolicyProperty autoScalingPolicyProperty = AutoScalingPolicyProperty.builder()
        .constraints(ScalingConstraintsProperty.builder()
                .maxCapacity(123)
                .minCapacity(123)
                .build())
        .rules(List.of(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()))
        .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 autoScalingPolicyProperty = new AutoScalingPolicyProperty {
    Constraints = new ScalingConstraintsProperty {
        MaxCapacity = 123,
        MinCapacity = 123
    },
    Rules = new [] { 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"

autoScalingPolicyProperty := &AutoScalingPolicyProperty{
	Constraints: &ScalingConstraintsProperty{
		MaxCapacity: jsii.Number(123),
		MinCapacity: jsii.Number(123),
	},
	Rules: []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 upper and lower EC2 instance limits for an automatic scaling policy.

Automatic scaling activity will not cause an instance group to grow above or below these limits.

The scale-in and scale-out rules that comprise the automatic scaling policy.