Class: AWSCDK::AutoScalingPlans::CfnScalingPlan::ScalingInstructionProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::AutoScalingPlans::CfnScalingPlan::ScalingInstructionProperty
- Defined in:
- auto_scaling_plans/cfn_scaling_plan.rb
Overview
ScalingInstruction is a property of ScalingPlan that specifies the scaling instruction for a scalable resource in a scaling plan. Each scaling instruction applies to one resource.
AWS Auto Scaling creates target tracking scaling policies based on the scaling instructions. Target tracking scaling policies adjust the capacity of your scalable resource as required to maintain resource utilization at the target value that you specified.
AWS Auto Scaling also configures predictive scaling for your Amazon EC2 Auto Scaling groups using a subset of properties, including the load metric, the scaling metric, the target value for the scaling metric, the predictive scaling mode (forecast and scale or forecast only), and the desired behavior when the forecast capacity exceeds the maximum capacity of the resource. With predictive scaling, AWS Auto Scaling generates forecasts with traffic predictions for the two days ahead and schedules scaling actions that proactively add and remove resource capacity to match the forecast.
We recommend waiting a minimum of 24 hours after creating an Auto Scaling group to configure predictive scaling. At minimum, there must be 24 hours of historical data to generate a forecast. For more information, see Best practices for scaling plans in the Scaling Plans User Guide .
Instance Attribute Summary collapse
-
#customized_load_metric_specification ⇒ AWSCDK::IResolvable, ...
readonly
The customized load metric to use for predictive scaling.
-
#disable_dynamic_scaling ⇒ Boolean, ...
readonly
Controls whether dynamic scaling is disabled.
-
#max_capacity ⇒ Numeric
readonly
The maximum capacity of the resource.
-
#min_capacity ⇒ Numeric
readonly
The minimum capacity of the resource.
-
#predefined_load_metric_specification ⇒ AWSCDK::IResolvable, ...
readonly
The predefined load metric to use for predictive scaling.
-
#predictive_scaling_max_capacity_behavior ⇒ String?
readonly
Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity specified for the resource.
-
#predictive_scaling_max_capacity_buffer ⇒ Numeric?
readonly
The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity.
-
#predictive_scaling_mode ⇒ String?
readonly
The predictive scaling mode.
-
#resource_id ⇒ String
readonly
The ID of the resource.
-
#scalable_dimension ⇒ String
readonly
The scalable dimension associated with the resource.
-
#scaling_policy_update_behavior ⇒ String?
readonly
Controls whether a resource's externally created scaling policies are deleted and new target tracking scaling policies created.
-
#scheduled_action_buffer_time ⇒ Numeric?
readonly
The amount of time, in seconds, to buffer the run time of scheduled scaling actions when scaling out.
-
#service_namespace ⇒ String
readonly
The namespace of the AWS service.
-
#target_tracking_configurations ⇒ AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::AutoScalingPlans::CfnScalingPlan::TargetTrackingConfigurationProperty>
readonly
The target tracking configurations (up to 10).
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(max_capacity:, min_capacity:, resource_id:, scalable_dimension:, service_namespace:, target_tracking_configurations:, customized_load_metric_specification: nil, disable_dynamic_scaling: nil, predefined_load_metric_specification: nil, predictive_scaling_max_capacity_behavior: nil, predictive_scaling_max_capacity_buffer: nil, predictive_scaling_mode: nil, scaling_policy_update_behavior: nil, scheduled_action_buffer_time: nil) ⇒ ScalingInstructionProperty
constructor
A new instance of ScalingInstructionProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(max_capacity:, min_capacity:, resource_id:, scalable_dimension:, service_namespace:, target_tracking_configurations:, customized_load_metric_specification: nil, disable_dynamic_scaling: nil, predefined_load_metric_specification: nil, predictive_scaling_max_capacity_behavior: nil, predictive_scaling_max_capacity_buffer: nil, predictive_scaling_mode: nil, scaling_policy_update_behavior: nil, scheduled_action_buffer_time: nil) ⇒ ScalingInstructionProperty
Returns a new instance of ScalingInstructionProperty.
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 932 def initialize(max_capacity:, min_capacity:, resource_id:, scalable_dimension:, service_namespace:, target_tracking_configurations:, customized_load_metric_specification: nil, disable_dynamic_scaling: nil, predefined_load_metric_specification: nil, predictive_scaling_max_capacity_behavior: nil, predictive_scaling_max_capacity_buffer: nil, predictive_scaling_mode: nil, scaling_policy_update_behavior: nil, scheduled_action_buffer_time: nil) @max_capacity = max_capacity Jsii::Type.check_type(@max_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxCapacity") @min_capacity = min_capacity Jsii::Type.check_type(@min_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minCapacity") @resource_id = resource_id Jsii::Type.check_type(@resource_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceId") @scalable_dimension = scalable_dimension Jsii::Type.check_type(@scalable_dimension, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "scalableDimension") @service_namespace = service_namespace Jsii::Type.check_type(@service_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "serviceNamespace") @target_tracking_configurations = target_tracking_configurations Jsii::Type.check_type(@target_tracking_configurations, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmdwbGFucy5DZm5TY2FsaW5nUGxhbi5UYXJnZXRUcmFja2luZ0NvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "targetTrackingConfigurations") @customized_load_metric_specification = customized_load_metric_specification.is_a?(Hash) ? ::AWSCDK::AutoScalingPlans::CfnScalingPlan::CustomizedLoadMetricSpecificationProperty.new(**customized_load_metric_specification.transform_keys(&:to_sym)) : customized_load_metric_specification Jsii::Type.check_type(@customized_load_metric_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZ3BsYW5zLkNmblNjYWxpbmdQbGFuLkN1c3RvbWl6ZWRMb2FkTWV0cmljU3BlY2lmaWNhdGlvblByb3BlcnR5In1dfX0=")), "customizedLoadMetricSpecification") unless @customized_load_metric_specification.nil? @disable_dynamic_scaling = disable_dynamic_scaling Jsii::Type.check_type(@disable_dynamic_scaling, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "disableDynamicScaling") unless @disable_dynamic_scaling.nil? @predefined_load_metric_specification = predefined_load_metric_specification.is_a?(Hash) ? ::AWSCDK::AutoScalingPlans::CfnScalingPlan::PredefinedLoadMetricSpecificationProperty.new(**predefined_load_metric_specification.transform_keys(&:to_sym)) : predefined_load_metric_specification Jsii::Type.check_type(@predefined_load_metric_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZ3BsYW5zLkNmblNjYWxpbmdQbGFuLlByZWRlZmluZWRMb2FkTWV0cmljU3BlY2lmaWNhdGlvblByb3BlcnR5In1dfX0=")), "predefinedLoadMetricSpecification") unless @predefined_load_metric_specification.nil? @predictive_scaling_max_capacity_behavior = predictive_scaling_max_capacity_behavior Jsii::Type.check_type(@predictive_scaling_max_capacity_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "predictiveScalingMaxCapacityBehavior") unless @predictive_scaling_max_capacity_behavior.nil? @predictive_scaling_max_capacity_buffer = predictive_scaling_max_capacity_buffer Jsii::Type.check_type(@predictive_scaling_max_capacity_buffer, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "predictiveScalingMaxCapacityBuffer") unless @predictive_scaling_max_capacity_buffer.nil? @predictive_scaling_mode = predictive_scaling_mode Jsii::Type.check_type(@predictive_scaling_mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "predictiveScalingMode") unless @predictive_scaling_mode.nil? @scaling_policy_update_behavior = scaling_policy_update_behavior Jsii::Type.check_type(@scaling_policy_update_behavior, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "scalingPolicyUpdateBehavior") unless @scaling_policy_update_behavior.nil? @scheduled_action_buffer_time = scheduled_action_buffer_time Jsii::Type.check_type(@scheduled_action_buffer_time, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "scheduledActionBufferTime") unless @scheduled_action_buffer_time.nil? end |
Instance Attribute Details
#customized_load_metric_specification ⇒ AWSCDK::IResolvable, ... (readonly)
The customized load metric to use for predictive scaling.
This property or a PredefinedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.
1019 1020 1021 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1019 def customized_load_metric_specification @customized_load_metric_specification end |
#disable_dynamic_scaling ⇒ Boolean, ... (readonly)
Controls whether dynamic scaling is disabled.
When dynamic scaling is enabled, AWS Auto Scaling creates target tracking scaling policies based on the specified target tracking configurations.
The default is enabled ( false ).
1028 1029 1030 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1028 def disable_dynamic_scaling @disable_dynamic_scaling end |
#max_capacity ⇒ Numeric (readonly)
The maximum capacity of the resource.
The exception to this upper limit is if you specify a non-default setting for PredictiveScalingMaxCapacityBehavior .
969 970 971 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 969 def max_capacity @max_capacity end |
#min_capacity ⇒ Numeric (readonly)
The minimum capacity of the resource.
974 975 976 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 974 def min_capacity @min_capacity end |
#predefined_load_metric_specification ⇒ AWSCDK::IResolvable, ... (readonly)
The predefined load metric to use for predictive scaling.
This property or a CustomizedLoadMetricSpecification is required when configuring predictive scaling, and cannot be used otherwise.
1035 1036 1037 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1035 def predefined_load_metric_specification @predefined_load_metric_specification end |
#predictive_scaling_max_capacity_behavior ⇒ String? (readonly)
Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity specified for the resource.
The default value is SetForecastCapacityToMaxCapacity .
The following are possible values:
SetForecastCapacityToMaxCapacity- AWS Auto Scaling cannot scale resource capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit.SetMaxCapacityToForecastCapacity- AWS Auto Scaling can scale resource capacity higher than the maximum capacity to equal but not exceed forecast capacity.SetMaxCapacityAboveForecastCapacity- AWS Auto Scaling can scale resource capacity higher than the maximum capacity by a specified buffer value. The intention is to give the target tracking scaling policy extra capacity if unexpected traffic occurs.
Valid only when configuring predictive scaling.
1050 1051 1052 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1050 def predictive_scaling_max_capacity_behavior @predictive_scaling_max_capacity_behavior end |
#predictive_scaling_max_capacity_buffer ⇒ Numeric? (readonly)
The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity.
The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer. With a 10 percent buffer, if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.
Valid only when configuring predictive scaling. Required if PredictiveScalingMaxCapacityBehavior is set to SetMaxCapacityAboveForecastCapacity , and cannot be used otherwise.
The range is 1-100.
1061 1062 1063 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1061 def predictive_scaling_max_capacity_buffer @predictive_scaling_max_capacity_buffer end |
#predictive_scaling_mode ⇒ String? (readonly)
The predictive scaling mode.
The default value is ForecastAndScale . Otherwise, AWS Auto Scaling forecasts capacity but does not apply any scheduled scaling actions based on the capacity forecast.
1068 1069 1070 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1068 def predictive_scaling_mode @predictive_scaling_mode end |
#resource_id ⇒ String (readonly)
The ID of the resource. This string consists of the resource type and unique identifier.
- Auto Scaling group - The resource type is
auto_scaling_groupand the unique identifier is the name of the Auto Scaling group. Example:autoScalingGroup/my-asg. - ECS service - The resource type is
serviceand the unique identifier is the cluster name and service name. Example:service/default/sample-webapp. - Spot Fleet request - The resource type is
spot-fleet-requestand the unique identifier is the Spot Fleet request ID. Example:spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE. - DynamoDB table - The resource type is
tableand the unique identifier is the resource ID. Example:table/my-table. - DynamoDB global secondary index - The resource type is
indexand the unique identifier is the resource ID. Example:table/my-table/index/my-table-index. - Aurora DB cluster - The resource type is
clusterand the unique identifier is the cluster name. Example:cluster:my-db-cluster.
986 987 988 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 986 def resource_id @resource_id end |
#scalable_dimension ⇒ String (readonly)
The scalable dimension associated with the resource.
autoscaling:autoScalingGroup:DesiredCapacity- The desired capacity of an Auto Scaling group.ecs:service:DesiredCount- The desired task count of an ECS service.ec2:spot-fleet-request:TargetCapacity- The target capacity of a Spot Fleet request.dynamodb:table:ReadCapacityUnits- The provisioned read capacity for a DynamoDB table.dynamodb:table:WriteCapacityUnits- The provisioned write capacity for a DynamoDB table.dynamodb:index:ReadCapacityUnits- The provisioned read capacity for a DynamoDB global secondary index.dynamodb:index:WriteCapacityUnits- The provisioned write capacity for a DynamoDB global secondary index.rds:cluster:ReadReplicaCount- The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition and Aurora PostgreSQL-compatible edition.
1000 1001 1002 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1000 def scalable_dimension @scalable_dimension end |
#scaling_policy_update_behavior ⇒ String? (readonly)
Controls whether a resource's externally created scaling policies are deleted and new target tracking scaling policies created.
The default value is KeepExternalPolicies .
Valid only when configuring dynamic scaling.
1077 1078 1079 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1077 def scaling_policy_update_behavior @scaling_policy_update_behavior end |
#scheduled_action_buffer_time ⇒ Numeric? (readonly)
The amount of time, in seconds, to buffer the run time of scheduled scaling actions when scaling out.
For example, if the forecast says to add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run time of the corresponding scheduled scaling action will be 9:55 AM. The intention is to give resources time to be provisioned. For example, it can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.
The value must be less than the forecast interval duration of 3600 seconds (60 minutes). The default is 300 seconds.
Valid only when configuring predictive scaling.
1088 1089 1090 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1088 def scheduled_action_buffer_time @scheduled_action_buffer_time end |
#service_namespace ⇒ String (readonly)
The namespace of the AWS service.
1005 1006 1007 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1005 def service_namespace @service_namespace end |
#target_tracking_configurations ⇒ AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::AutoScalingPlans::CfnScalingPlan::TargetTrackingConfigurationProperty> (readonly)
The target tracking configurations (up to 10).
Each of these structures must specify a unique scaling metric and a target value for the metric.
1012 1013 1014 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1012 def target_tracking_configurations @target_tracking_configurations end |
Class Method Details
.jsii_properties ⇒ Object
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1090 def self.jsii_properties { :max_capacity => "maxCapacity", :min_capacity => "minCapacity", :resource_id => "resourceId", :scalable_dimension => "scalableDimension", :service_namespace => "serviceNamespace", :target_tracking_configurations => "targetTrackingConfigurations", :customized_load_metric_specification => "customizedLoadMetricSpecification", :disable_dynamic_scaling => "disableDynamicScaling", :predefined_load_metric_specification => "predefinedLoadMetricSpecification", :predictive_scaling_max_capacity_behavior => "predictiveScalingMaxCapacityBehavior", :predictive_scaling_max_capacity_buffer => "predictiveScalingMaxCapacityBuffer", :predictive_scaling_mode => "predictiveScalingMode", :scaling_policy_update_behavior => "scalingPolicyUpdateBehavior", :scheduled_action_buffer_time => "scheduledActionBufferTime", } end |
Instance Method Details
#to_jsii ⇒ Object
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'auto_scaling_plans/cfn_scaling_plan.rb', line 1109 def to_jsii result = {} result.merge!({ "maxCapacity" => @max_capacity, "minCapacity" => @min_capacity, "resourceId" => @resource_id, "scalableDimension" => @scalable_dimension, "serviceNamespace" => @service_namespace, "targetTrackingConfigurations" => @target_tracking_configurations, "customizedLoadMetricSpecification" => @customized_load_metric_specification, "disableDynamicScaling" => @disable_dynamic_scaling, "predefinedLoadMetricSpecification" => @predefined_load_metric_specification, "predictiveScalingMaxCapacityBehavior" => @predictive_scaling_max_capacity_behavior, "predictiveScalingMaxCapacityBuffer" => @predictive_scaling_max_capacity_buffer, "predictiveScalingMode" => @predictive_scaling_mode, "scalingPolicyUpdateBehavior" => @scaling_policy_update_behavior, "scheduledActionBufferTime" => @scheduled_action_buffer_time, }) result.compact end |