Amazon EMR InstanceGroupConfig AutoScalingPolicy
AutoScalingPolicy
is a property of the AWS::EMR::InstanceGroupConfig resource that specifies
the constraints and rules for an Auto Scaling group policy. For more information,
see
PutAutoScalingPolicy in the Amazon EMR API Reference.
Syntax
JSON
{ "
Constraints
" :ScalingConstraints
, "Rules
" : [ScalingRule
] }
YAML
Constraints
:ScalingConstraints
Rules
: -ScalingRule
Properties
Constraints
-
The upper and lower Amazon EC2 instance limits for an automatic scaling policy. Automatic scaling activity doesn't cause an instance group to grow above or below these limits.
Required: Yes
Type: Amazon EMR InstanceGroupConfig ScalingConstraints
Update requires: No interruption
Rules
-
The scale-in and scale-out rules that compose the automatic scaling policy.
Required: Yes
Type: List of Amazon EMR InstanceGroupConfig ScalingRule
Update requires: No interruption
Example
The following example defines an AutoScalingPolicy
for an InstanceGroupConfig
resource.
JSON
"MyInstanceGroupConfig": { "Type": "AWS::EMR::InstanceGroupConfig", "Properties": { "InstanceCount": 1, "InstanceType": { "Ref": "InstanceType" }, "InstanceRole": "TASK", "Market": "ON_DEMAND", "Name": "cfnTask", "JobFlowId": { "Ref": "MyCluster" }, "AutoScalingPolicy": { "Constraints": { "MinCapacity": { "Ref": "MinCapacity" }, "MaxCapacity": { "Ref": "MaxCapacity" } }, "Rules": [ { "Name": "Scale-out", "Description": "Scale-out policy", "Action": { "SimpleScalingPolicyConfiguration": { "AdjustmentType": "CHANGE_IN_CAPACITY", "ScalingAdjustment": 1, "CoolDown": 300 } }, "Trigger": { "CloudWatchAlarmDefinition": { "Dimensions": [ { "Key": "JobFlowId", "Value": "${emr.clusterId}" } ], "EvaluationPeriods": 1, "Namespace": "AWS/ElasticMapReduce", "Period": 300, "ComparisonOperator": "LESS_THAN", "Statistic": "AVERAGE", "Threshold": 15, "Unit": "PERCENT", "MetricName": "YARNMemoryAvailablePercentage" } } }, { "Name": "Scale-in", "Description": "Scale-in policy", "Action": { "SimpleScalingPolicyConfiguration": { "AdjustmentType": "CHANGE_IN_CAPACITY", "ScalingAdjustment": -1, "CoolDown": 300 } }, "Trigger": { "CloudWatchAlarmDefinition": { "Dimensions": [ { "Key": "JobFlowId", "Value": "${emr.clusterId}" } ], "EvaluationPeriods": 1, "Namespace": "AWS/ElasticMapReduce", "Period": 300, "ComparisonOperator": "GREATER_THAN", "Statistic": "AVERAGE", "Threshold": 75, "Unit": "PERCENT", "MetricName": "YARNMemoryAvailablePercentage" } } } ] } } }
YAML
MyInstanceGroupConfig: Type: 'AWS::EMR::InstanceGroupConfig' Properties: InstanceCount: 1 InstanceType: !Ref InstanceType InstanceRole: TASK Market: ON_DEMAND Name: cfnTask JobFlowId: !Ref MyCluster AutoScalingPolicy: Constraints: MinCapacity: !Ref MinCapacity MaxCapacity: !Ref MaxCapacity Rules: - Name: Scale-out Description: Scale-out policy Action: SimpleScalingPolicyConfiguration: AdjustmentType: CHANGE_IN_CAPACITY ScalingAdjustment: 1 CoolDown: 300 Trigger: CloudWatchAlarmDefinition: Dimensions: - Key: JobFlowId Value: '${emr.clusterId}' EvaluationPeriods: 1 Namespace: AWS/ElasticMapReduce Period: 300 ComparisonOperator: LESS_THAN Statistic: AVERAGE Threshold: 15 Unit: PERCENT MetricName: YARNMemoryAvailablePercentage - Name: Scale-in Description: Scale-in policy Action: SimpleScalingPolicyConfiguration: AdjustmentType: CHANGE_IN_CAPACITY ScalingAdjustment: -1 CoolDown: 300 Trigger: CloudWatchAlarmDefinition: Dimensions: - Key: JobFlowId Value: '${emr.clusterId}' EvaluationPeriods: 1 Namespace: AWS/ElasticMapReduce Period: 300 ComparisonOperator: GREATER_THAN Statistic: AVERAGE Threshold: 75 Unit: PERCENT MetricName: YARNMemoryAvailablePercentage