Skip to content
v2.278.0

ScalingRuleProperty Struct ​

ScalingRule is a subproperty of the AutoScalingPolicy property type.

ScalingRule defines the scale-in or scale-out rules for scaling activity, including the CloudWatch metric alarm that triggers activity, how EC2 instances are added or removed, and the periodicity of adjustments. The automatic scaling policy for an instance group can comprise one or more automatic scaling rules.

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

      // the properties below are optional
      adjustmentType: 'adjustmentType',
      coolDown: 123,
    },

    // the properties below are optional
    market: 'market',
  },
  name: 'name',
  trigger: {
    cloudWatchAlarmDefinition: {
      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',
    },
  },

  // 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.
from aws_cdk import aws_emr as emr

scaling_rule_property = emr.CfnInstanceGroupConfig.ScalingRuleProperty(
    action=emr.CfnInstanceGroupConfig.ScalingActionProperty(
        simple_scaling_policy_configuration=emr.CfnInstanceGroupConfig.SimpleScalingPolicyConfigurationProperty(
            scaling_adjustment=123,

            # the properties below are optional
            adjustment_type="adjustmentType",
            cool_down=123
        ),

        # the properties below are optional
        market="market"
    ),
    name="name",
    trigger=emr.CfnInstanceGroupConfig.ScalingTriggerProperty(
        cloud_watch_alarm_definition=emr.CfnInstanceGroupConfig.CloudWatchAlarmDefinitionProperty(
            comparison_operator="comparisonOperator",
            metric_name="metricName",
            period=123,
            threshold=123,

            # the properties below are optional
            dimensions=[emr.CfnInstanceGroupConfig.MetricDimensionProperty(
                key="key",
                value="value"
            )],
            evaluation_periods=123,
            namespace="namespace",
            statistic="statistic",
            unit="unit"
        )
    ),

    # 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.services.emr.*;

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

                        // the properties below are optional
                        .adjustmentType("adjustmentType")
                        .coolDown(123)
                        .build())

                // the properties below are optional
                .market("market")
                .build())
        .name("name")
        .trigger(ScalingTriggerProperty.builder()
                .cloudWatchAlarmDefinition(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())
                .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.AWS.EMR;

var scalingRuleProperty = new ScalingRuleProperty {
    Action = new ScalingActionProperty {
        SimpleScalingPolicyConfiguration = new SimpleScalingPolicyConfigurationProperty {
            ScalingAdjustment = 123,

            // the properties below are optional
            AdjustmentType = "adjustmentType",
            CoolDown = 123
        },

        // the properties below are optional
        Market = "market"
    },
    Name = "name",
    Trigger = new ScalingTriggerProperty {
        CloudWatchAlarmDefinition = 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"
        }
    },

    // 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 "github.com/aws/aws-cdk-go/awscdk"

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

			// the properties below are optional
			AdjustmentType: jsii.String("adjustmentType"),
			CoolDown: jsii.Number(123),
		},

		// the properties below are optional
		Market: jsii.String("market"),
	},
	Name: jsii.String("name"),
	Trigger: &ScalingTriggerProperty{
		CloudWatchAlarmDefinition: &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"),
		},
	},

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

Properties ​

The conditions that trigger an automatic scaling activity.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
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.

triggerIResolvable | CfnInstanceGroupConfig.ScalingTriggerPropertytriggertyping.Union[IResolvable, ScalingTriggerProperty]triggerIResolvableTriggerIResolvableTriggerinterface{} required #
The CloudWatch alarm definition that determines when automatic scaling activity is triggered.