ScalingRule
This class encapsulates and extends the ROS resource type ALIYUN::ESS::ScalingRule
, which is used to create a scaling rule.
Initializers
import com.aliyun.ros.cdk.ess.ScalingRule;
ScalingRule.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.scalingGroupId(java.lang.String)
.scalingGroupId(IResolvable)
// .adjustmentType(java.lang.String)
// .adjustmentType(IResolvable)
// .adjustmentValue(java.lang.Number)
// .adjustmentValue(IResolvable)
// .cooldown(java.lang.Number)
// .cooldown(IResolvable)
// .disableScaleIn(java.lang.Boolean)
// .disableScaleIn(IResolvable)
// .estimatedInstanceWarmup(java.lang.Number)
// .estimatedInstanceWarmup(IResolvable)
// .initialMaxSize(java.lang.Number)
// .initialMaxSize(IResolvable)
// .metricName(java.lang.String)
// .metricName(IResolvable)
// .minAdjustmentMagnitude(java.lang.Number)
// .minAdjustmentMagnitude(IResolvable)
// .predictiveScalingMode(java.lang.String)
// .predictiveScalingMode(IResolvable)
// .predictiveTaskBufferTime(java.lang.Number)
// .predictiveTaskBufferTime(IResolvable)
// .predictiveValueBehavior(java.lang.String)
// .predictiveValueBehavior(IResolvable)
// .predictiveValueBuffer(java.lang.Number)
// .predictiveValueBuffer(IResolvable)
// .scaleInEvaluationCount(java.lang.Number)
// .scaleInEvaluationCount(IResolvable)
// .scaleOutEvaluationCount(java.lang.Number)
// .scaleOutEvaluationCount(IResolvable)
// .scalingRuleName(java.lang.String)
// .scalingRuleName(IResolvable)
// .scalingRuleType(java.lang.String)
// .scalingRuleType(IResolvable)
// .stepAdjustment(IResolvable)
// .stepAdjustment(java.util.List<IResolvable)
// .stepAdjustment(StepAdjustmentProperty>)
// .targetValue(java.lang.Number)
// .targetValue(IResolvable)
.build();
Name | Type | Description |
---|---|---|
scope |
com.aliyun.ros.cdk.core.Construct |
No description. |
id |
java.lang.String |
No description. |
enableResourcePropertyConstraint |
java.lang.Boolean |
No description. |
scalingGroupId |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property scalingGroupId: ID of the scaling group of a scaling rule. |
adjustmentType |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property adjustmentType: Adjustment mode of a scaling rule. |
adjustmentValue |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property adjustmentValue: Adjusted value of a scaling rule. |
cooldown |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property cooldown: Cool-down time of a scaling rule. |
disableScaleIn |
java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable |
Property disableScaleIn: Specifies whether to disable scale-in. |
estimatedInstanceWarmup |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property estimatedInstanceWarmup: The warm-up period of the ECS instances. |
initialMaxSize |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property initialMaxSize: The maximum number of ECS instances in the scaling group, which is used together with PredictiveValueBehavior. |
metricName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property metricName: The predefined metric to monitor. |
minAdjustmentMagnitude |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property minAdjustmentMagnitude: The minimum number of ECS instances to be adjusted in a scaling rule. |
predictiveScalingMode |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property predictiveScalingMode: The mode of the predictive scaling rule. |
predictiveTaskBufferTime |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property predictiveTaskBufferTime: The amount of buffer time ahead of the forecast task execution time. |
predictiveValueBehavior |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property predictiveValueBehavior: The action taken on the predicted maximum value. |
predictiveValueBuffer |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property predictiveValueBuffer: The ratio of the increment to the predicted value when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer. |
scaleInEvaluationCount |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property scaleInEvaluationCount: The number of consecutive times that the event-triggered task created for scale-in activities meets the threshold conditions before an alert is triggered. |
scaleOutEvaluationCount |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property scaleOutEvaluationCount: The number of consecutive times that the event-triggered task created for scale-out activities meets the threshold conditions before an alert is triggered. |
scalingRuleName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property scalingRuleName: Name shown for the scaling group, which is a string containing 2 to 40 English or Chinese characters. |
scalingRuleType |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property scalingRuleType: The type of the scaling rule. |
stepAdjustment |
com.aliyun.ros.cdk.core.IResolvable OR java.util.List |
Property stepAdjustment:. |
targetValue |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property targetValue: The target value of a metric. |
scope
Required
- Type: com.aliyun.ros.cdk.core.Construct
id
Required
- Type: java.lang.String
enableResourcePropertyConstraint
Optional
- Type: java.lang.Boolean
scalingGroupId
Required
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property scalingGroupId: ID of the scaling group of a scaling rule.
adjustmentType
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property adjustmentType: Adjustment mode of a scaling rule.
Optional values:
- QuantityChangeInCapacity: It is used to increase or decrease a specified number of ECS instances.
- PercentChangeInCapacity: It is used to increase or decrease a specified proportion of ECS instances.
- TotalCapacity: It is used to adjust the quantity of ECS instances in the current scaling group to a specified value.
adjustmentValue
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property adjustmentValue: Adjusted value of a scaling rule.
Value range:
- QuantityChangeInCapacity: [-500, 500]
- PercentChangeInCapacity: [-100, 10000]
- TotalCapacity: [0, 1000]
cooldown
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property cooldown: Cool-down time of a scaling rule.
Value range: [0, 86,400], in seconds. The default value is empty.
disableScaleIn
Optional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property disableScaleIn: Specifies whether to disable scale-in.
This parameter is applicable only to target tracking scaling rules. Default value: false
estimatedInstanceWarmup
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property estimatedInstanceWarmup: The warm-up period of the ECS instances.
This parameter is applicable to target tracking scaling rules and step scaling rules. The system adds ECS instances that are in the warm-up state to the scaling group, but does not report monitoring data during the warm-up period to CloudMonitor. Note: When calculating the number of ECS instances to be adjusted, the system does not count ECS instances in the warm-up state as part of the current capacity of the scaling group. Valid values: 0 to 86400. Unit: seconds. Default value: 300.
initialMaxSize
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property initialMaxSize: The maximum number of ECS instances in the scaling group, which is used together with PredictiveValueBehavior.
Default value: the same as the value of MaxSize
metricName
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property metricName: The predefined metric to monitor.
This parameter is required and applicable only to target tracking scaling rules and predictive scaling rules. Valid values of a target tracking scaling rule:
- CpuUtilization: the average CPU utilization- ClassicInternetRx: the average public network inbound traffic over the classic network
- ClassicInternetTx: the average public network outbound traffic over the classic network
- VpcInternetRx: the average public network inbound traffic over the VPC
- VpcInternetTx: the average public network outbound traffic over the VPC
- IntranetRx: the average internal network inbound traffic
- IntranetTx: the average internal network outbound traffic Valid values of a predictive scaling rule:
- CpuUtilization: the average CPU utilization
- IntranetRx: the average internal network inbound traffic
- IntranetTx: the average internal network outbound traffic
minAdjustmentMagnitude
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property minAdjustmentMagnitude: The minimum number of ECS instances to be adjusted in a scaling rule.
This parameter takes effect only when the scaling rule type is SimpleScalingRule or StepScalingRule and AdjustmentType is PercentChangeInCapacity.
predictiveScalingMode
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property predictiveScalingMode: The mode of the predictive scaling rule.
Valid values:
- PredictAndScale: generates forecasts and creates forecast tasks.
- PredictOnly: generates forecasts but does not create forecast tasks. Default value: PredictAndScale
predictiveTaskBufferTime
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property predictiveTaskBufferTime: The amount of buffer time ahead of the forecast task execution time.
By default, all scheduled tasks that are automatically created for a predictive scaling rule are executed at the beginning of each hour. You can set a buffer time to execute forecast tasks ahead of schedule, so that resources can be prepared in advance. Valid values: 0 to 60. Unit: minutes. Default value: 0
predictiveValueBehavior
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property predictiveValueBehavior: The action taken on the predicted maximum value.
Valid values:
-
MaxOverridePredictiveValue: uses the initial maximum capacity as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.
-
PredictiveValueOverrideMax: uses the predicted value as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.
- PredictiveValueOverrideMaxWithBuffer: increases the predicted value with a ratio, which is specified by PredictiveValueBuffer. If the value after the increase is greater than the initial maximum capacity, the value after the increase is used as the maximum value for forecast tasks. Default value: MaxOverridePredictiveValue
predictiveValueBuffer
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property predictiveValueBuffer: The ratio of the increment to the predicted value when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer.
When the value after the increase is greater than the initial maximum capacity, the value after the increase is used for forecast tasks. Valid values: 0 to 100 Default value: 0
scaleInEvaluationCount
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property scaleInEvaluationCount: The number of consecutive times that the event-triggered task created for scale-in activities meets the threshold conditions before an alert is triggered.
After a target tracking scaling rule is created, an event-triggered task is automatically created and then associated with the target tracking scaling rule. Default value: 15.
scaleOutEvaluationCount
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property scaleOutEvaluationCount: The number of consecutive times that the event-triggered task created for scale-out activities meets the threshold conditions before an alert is triggered.
After a target tracking scaling rule is created, an event-triggered task is automatically created and then associated with the target tracking scaling rule. Default value: 3.
scalingRuleName
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property scalingRuleName: Name shown for the scaling group, which is a string containing 2 to 40 English or Chinese characters.
It must begin with a number, a letter (case-insensitive) or a Chinese character and can contain numbers, "_", "-" or ".". The account name in the same scaling group is unique in the same region. If this parameter value is not specified, the default value is ScalingRuleId.
scalingRuleType
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property scalingRuleType: The type of the scaling rule.
Valid values:
- SimpleScalingRule: scales ECS instances based on the values of AdjustmentType and AdjustmentValue.
- TargetTrackingScalingRule: dynamically calculates the number of ECS instances to be adjusted and tries to keep the value of a predefined monitoring metric close to TargetValue.
- StepScalingRule: scales ECS instances in steps based on specified thresholds and metric values.
- PredictiveScalingRule: uses machine learning to analyze historical monitoring data of the scaling group and then predicts the future values of monitored metrics, the rule then automatically creates scheduled tasks to set the boundary values for the scaling group. If this parameter value is not specified, the default value is SimpleScalingRule.
stepAdjustment
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
StepAdjustmentProperty>
Property stepAdjustment:.
targetValue
Optional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property targetValue: The target value of a metric.
This parameter is required and applicable only to target tracking scaling rules and predictive scaling rules. The value of TargetValue must be greater than 0 and can have a maximum of three decimal places.
Methods
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition |
No description. |
addCount |
No description. |
addDependency |
No description. |
addResourceDesc |
No description. |
applyRemovalPolicy |
No description. |
getAtt |
No description. |
setMetadata |
No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
- Type: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
Name | Description |
---|---|
isConstruct |
Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.ess.ScalingRule;
ScalingRule.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
com.aliyun.ros.cdk.core.ConstructNode |
The construct tree node associated with this construct. |
ref |
java.lang.String |
No description. |
stack |
com.aliyun.ros.cdk.core.Stack |
The stack in which this resource is defined. |
resource |
com.aliyun.ros.cdk.core.RosResource |
No description. |
attrScalingRuleAri |
com.aliyun.ros.cdk.core.IResolvable |
Attribute ScalingRuleAri: Unique identifier of a scaling rule. |
attrScalingRuleId |
com.aliyun.ros.cdk.core.IResolvable |
Attribute ScalingRuleId: ID of a scaling rule, generated by the system and globally unique. |
node
Required
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
ref
Required
public java.lang.String getRef();
- Type: java.lang.String
stack
Required
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resource
Optional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrScalingRuleAri
Required
public IResolvable getAttrScalingRuleAri();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute ScalingRuleAri: Unique identifier of a scaling rule.
attrScalingRuleId
Required
public IResolvable getAttrScalingRuleId();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute ScalingRuleId: ID of a scaling rule, generated by the system and globally unique.