ScaleWithAdjustment
Triggers auto scaling based on a specified adjustment rule by calling the ScaleWithAdjustment operation, eliminating the need to create a scaling rule in advance as required by the ExecuteScalingRule operation.
Operation description
Operation description
-
Before you call this operation, make sure that the following conditions are met:
The scaling group is in the Active state.
No scaling activities are in progress in the scaling group.
-
If no scaling activities are in progress in the scaling group, this operation can bypass the cooldown time and directly execute a scaling activity.
-
If the number of ECS instances to be added specified in the scaling rule plus the current number of instances in the scaling group (Total Capacity) is greater than the maximum number of instances (MaxSize), the scaling activity is executed based on Total Capacity = MaxSize.
-
If the current number of instances in the scaling group (Total Capacity) minus the number of ECS instances to be removed specified in the scaling rule is less than the minimum number of instances (MinSize), the scaling activity is executed based on Total Capacity = MinSize.
A successful response to this operation only indicates that Auto Scaling has accepted the request and can execute the scaling activity. It does not mean that the scaling activity will be executed successfully. You must use the returned ScalingActivityId to check the execution status of the scaling activity.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:ScaleWithAdjustment |
update |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group. |
asg-j6c1o397427hyjdc**** |
| AdjustmentType |
string |
Yes |
The adjustment method for the scaling activity. Valid values:
|
QuantityChangeInCapacity |
| AdjustmentValue |
integer |
Yes |
The adjustment value for the scaling activity. In any case, the number of ECS instances adjusted in a single operation cannot exceed 1,000. Otherwise, the adjustment fails. Valid values vary based on the adjustment method:
|
100 |
| MinAdjustmentMagnitude |
integer |
No |
The minimum number of instances to be adjusted in the scaling activity. This parameter takes effect only when AdjustmentType is set to PercentChangeInCapacity. |
1 |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request and prevent duplicate submissions. You can generate the value of this parameter on the client side. The value must be unique across different requests and can be up to 64 ASCII characters in length. The value cannot contain non-ASCII characters. |
123e4567-e89b-12d3-a456-42665544**** |
| SyncActivity |
boolean |
No |
Specifies whether to synchronously execute the scaling activity. This parameter is valid only for scaling groups that have the expected number of instances configured. Valid values:
Note
For more information about the expected number of instances, see Expected number of instances. Default value: false. |
false |
| Overrides |
object |
No |
The override parameters specified for scaling out an Elastic Container Instance (ECI) scaling group. |
|
| Cpu |
number |
No |
The number of vCPUs for the instance. Unit: cores. |
2 |
| Memory |
number |
No |
The memory size for the instance. Unit: GiB. |
4 |
| UserData |
string |
No |
The user data of the ECS instance. The data must be encoded in Base64. The maximum size of the raw data before encoding is 32 KB. |
ZWNobyBoZWxsbyBlY3Mh |
| ContainerOverride |
array<object> |
No |
The override parameters for the container list. |
|
|
array<object> |
No |
The override parameters for the container list. |
||
| Command |
array |
No |
The startup commands for the container. You can specify up to 20 commands. Each command can contain up to 256 characters. |
|
|
string |
No |
The startup commands for the container. You can specify up to 20 commands. Each command can contain up to 256 characters. |
sleep |
|
| Memory |
number |
No |
The memory size of the container. Unit: GiB. |
4 |
| Arg |
array |
No |
The parameters for the startup commands of the container. You can specify up to 10 parameters. |
|
|
string |
No |
The parameters for the startup commands of the container. You can specify up to 10 parameters. |
arg |
|
| Cpu |
number |
No |
The number of vCPUs for the container. Unit: cores. |
2 |
| EnvironmentVar |
array<object> |
No |
The list of environment variables. |
|
|
object |
No |
The list of environment variables. |
||
| Value |
string |
No |
The value of the environment variable. The value can be 0 to 256 characters in length. |
/usr/local/tomcat |
| Key |
string |
No |
The name of the environment variable. The name must be 1 to 128 characters in length. It can contain letters, digits, and underscores (_), and cannot start with a digit. |
PATH |
| Name |
string |
No |
The name of the container. When you need to override container parameters, you must specify the container name. The container parameters can be overridden only when the container name matches the container name in the scaling configuration. |
container-1 |
| LifecycleHookContext |
object |
No |
The context information of the lifecycle hook. |
|
| DisableLifecycleHook |
boolean |
No |
Specifies whether to disable all lifecycle hook features for the scaling activity. Valid values:
|
false |
| IgnoredLifecycleHookIds |
array |
No |
The list of IDs of the lifecycle hooks that are disabled for the scaling activity. |
|
|
string |
No |
The list of IDs of the lifecycle hooks that are disabled for the scaling activity. |
ash-bp14zolna43z266bq*** |
|
| LifecycleHookResult |
string |
No |
The default execution result of the lifecycle hook in this scaling activity. After this parameter is set, it overrides the original default execution result of the hook. |
CONTINUE |
| ActivityMetadata |
string |
No |
The metadata of the scaling activity. |
{"key":"value"} |
| ExecutionMode |
string |
No |
The execution mode. Valid values:
Default value: None. |
PlanOnly |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters returned when a scaling activity is triggered based on a specified adjustment rule. |
||
| ScalingActivityId |
string |
The ID of the scaling activity. |
asa-bp175o6f6ego3r2j**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| ActivityType |
string |
The type of the scaling activity. If ActivityType is CapacityChange, the scaling activity corresponding to the returned ScalingActivityId only modifies the expected number of instances in the scaling group and does not immediately execute scale-out or scale-in. Applicable scope: scaling groups that use the expected number of instances feature. |
CapacityChange |
| PlanResult |
object |
The elastic planning results returned when ExecutionMode is set to PlanOnly. |
|
| ResourceAllocations |
array<object> |
The resource allocation information in the elastic planning results. |
|
|
object |
|||
| ZoneId |
string |
The zone ID. |
cn-beijing-g |
| InstanceType |
string |
The instance type. |
ecs.u1-c1m8.large |
| SpotStrategy |
string |
The preemption policy for the instance. Valid values:
|
NoSpot |
| Amount |
integer |
The number of instances. |
1 |
| InstanceChargeType |
string |
The billing method. Valid values:
|
Postpaid |
Examples
Success response
JSON format
{
"ScalingActivityId": "asa-bp175o6f6ego3r2j****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"ActivityType": "CapacityChange",
"PlanResult": {
"ResourceAllocations": [
{
"ZoneId": "cn-beijing-g",
"InstanceType": "ecs.u1-c1m8.large",
"SpotStrategy": "NoSpot",
"Amount": 1,
"InstanceChargeType": "Postpaid"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 403 | Forbidden.Forbidden | Operation Forbidden |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.