Unlike the ExecuteScalingRule API, you can use the ScaleWithAdjustment API to trigger elastic scaling based on a specified adjustment rule, without first creating a scaling rule.
Operation description
- Ensure the following conditions are met before calling this operation:
The scaling group is in the Active state.
No scaling activities are in progress in the scaling group.
This operation bypasses the cooldown to immediately execute a scaling activity, provided no other scaling activities are in progress.
If adding the specified ECS instances would cause the total capacity to exceed the maximum size, Auto Scaling sets the total capacity to the maximum size.
If removing the specified ECS instances would reduce the total capacity below the minimum size, Auto Scaling sets the total capacity to the minimum size.
A successful response indicates that the API request was accepted, but this does not guarantee that the scaling activity will succeed. You must use the returned ScalingActivityId to check the 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 method used to adjust the number of instances in a scaling activity. Valid values:
|
QuantityChangeInCapacity |
| AdjustmentValue |
integer |
Yes |
The adjustment value for the scaling activity. A single adjustment cannot add or remove more than 1,000 ECS instances. The valid range depends on
|
100 |
| MinAdjustmentMagnitude |
integer |
No |
The minimum number of instances to adjust in a scaling activity. This parameter takes effect only when |
1 |
| ClientToken |
string |
No |
A client-generated token to ensure the idempotence of the request. This token must be a unique string of up to 64 ASCII characters. |
123e4567-e89b-12d3-a456-42665544**** |
| SyncActivity |
boolean |
No |
Specifies whether to execute the scaling activity synchronously. This parameter applies only to scaling groups that are configured with an expected number of instances. Valid values:
Note
For more information about the expected number of instances, see Expected number of instances. Default value: false. |
false |
| ParallelTask |
boolean |
No |
Specifies whether the current scaling activity supports concurrency. |
false |
| Overrides |
object |
No |
The parameters to override when scaling out an 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 |
| ContainerOverrides |
array<object> |
No |
A list of container-specific overrides. |
|
|
array<object> |
No |
Specifies the overrides for a single container. |
||
| Name |
string |
No |
The name of the container to override. The override takes effect only if this name matches a container name in the scaling configuration. |
container-1 |
| Args |
array |
No |
The arguments for the container's startup command. You can specify up to 10 arguments. |
|
|
string |
No |
A single startup command argument. |
arg |
|
| Commands |
array |
No |
The container's startup command, specified as an array of strings. You can specify up to 20 strings, and each can be up to 256 characters long. |
|
|
string |
No |
A single string in the command array. |
sleep |
|
| EnvironmentVars |
array<object> |
No |
Environment variables to set in the container. |
|
|
object |
No |
A single environment variable, specified as a key-value pair. |
||
| Key |
string |
No |
The name of the environment variable. It must be 1 to 128 characters long, cannot start with a digit, and can contain only letters (a-z, A-Z), digits (0-9), and underscores (_). |
PATH |
| Value |
string |
No |
The value of the environment variable, up to 256 characters long. |
/usr/local/tomcat |
| Cpu |
number |
No |
The number of vCPUs for the container. Unit: cores. |
2 |
| Memory |
number |
No |
The memory size for the container. Unit: GiB. |
4 |
| UserData |
string |
No |
The user data for the ECS instance. It must be Base64-encoded, and the raw data cannot exceed 32 KB. |
ZWNobyBoZWxsbyBlY3Mh |
| LifecycleHookContext |
object |
No |
The lifecycle hook context. |
|
| DisableLifecycleHook |
boolean |
No |
Specifies whether to disable all lifecycle hooks for the scaling activity. Valid values:
|
false |
| IgnoredLifecycleHookIds |
array |
No |
A list of lifecycle hook IDs to ignore during the scaling activity. |
|
|
string |
No |
The ID of a lifecycle hook to ignore. |
ash-bp14zolna43z266bq*** |
|
| LifecycleHookResult |
string |
No |
||
| ActivityMetadata |
string |
No |
The metadata for the scaling activity. |
{"key":"value"} |
| ExecutionMode |
string |
No |
The execution mode. Valid values:
Default value: None. |
PlanOnly |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| 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 this parameter is set to This setting only affects scaling groups with a configured desired capacity. |
CapacityChange |
| PlanResult |
object |
The scaling plan result returned when ExecutionMode is set to PlanOnly. |
|
| ResourceAllocations |
array<object> |
The resource allocation details in the scaling plan result. |
|
|
object |
|||
| ZoneId |
string |
The availability zone ID. |
cn-beijing-g |
| InstanceType |
string |
The instance type. |
ecs.u1-c1m8.large |
| SpotStrategy |
string |
The spot strategy of the instance. Valid values:
|
NoSpot |
| Amount |
integer |
The number of instances. |
1 |
| InstanceChargeType |
string |
The billing method of the instance. 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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.