Scales instances in a scaling group based on the specified scaling policy.
Operation description
Compared with the ExecuteScalingRule operation, the ScaleWithAdjustment operation does not require a scaling rule to be created in advance. Before you call the ScaleWithAdjustment operation, take note of the following items:
-
The following conditions must be met:
- The scaling group is in the Active state.
- No scaling activities in the scaling group are in progress.
-
If no scaling activities in the scaling group are in progress, the operation can trigger scaling activities even before the cooldown time expires.
-
If the addition of a specified number of Elastic Compute Service (ECS) instances to a scaling group causes the total number of ECS instances in the scaling group to exceed the maximum number of instances allowed, Auto Scaling adds only a specific number of ECS instances to ensure that the total number of instances is equal to the maximum number of instances.
-
If the removal of a specified number of ECS instances from a scaling group causes the total number of ECS instances in the scaling group to drop below the minimum number of instances allowed, Auto Scaling removes only a specific number of ECS instances to ensure that the total number of instances is equal to the minimum number of instances.
A successful call indicates that Auto Scaling accepts the request. However, the scaling activity may still fail. You can obtain the status of a scaling activity by using the value of the ScalingActivityId
parameter in the response.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ScalingGroupId | string | Yes | The ID of the scaling group. | asg-j6c1o397427hyjdc**** |
AdjustmentType | string | Yes | The type of the scaling policy. Valid values:
| QuantityChangeInCapacity |
AdjustmentValue | integer | Yes | The number of instances in each adjustment. The number of ECS instances in each adjustment cannot exceed 1,000.
| 100 |
MinAdjustmentMagnitude | integer | No | The minimum number of instances allowed in each adjustment. This parameter takes effect only if you set the | 1 |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that the value is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. | 123e4567-e89b-12d3-a456-42665544**** |
SyncActivity | boolean | No | Specifies whether to trigger the scaling activity in a synchronous manner. This parameter takes effect only on scaling groups for which you specified an expected number of instances. Valid values:
Note
For more information about the Expected Number of Instances feature, see Expected number of instances.
Default value: false. | false |
Overrides | object | No | The overrides that allow you to adjust the scaling group of the Elastic Container Instance type during a scale-out. | |
Cpu | float | No | The number of vCPUs that you want to allocate to the instance. | 2 |
Memory | float | No | The memory size that you want to allocate to the instance. Unit: GiB. | 4 |
ContainerOverrides | object [] | No | The list of parameters that you want to use to override specific configurations for containers. | |
Name | string | No | The container name. If you specify ContainerOverrides, you must also specify Name. ContainerOverrides takes effect only when the container name specified by Name matches that specified in the scaling configuration. | container-1 |
Args | array | No | The container startup arguments. You can specify up to 10 arguments. | |
string | No | The container startup argument. | arg | |
Commands | array | No | The container startup commands. You can specify up to 20 commands. Each command contains up to 256 characters. | |
string | No | The container startup command. | sleep | |
EnvironmentVars | object [] | No | The information about the environment variables. | |
Key | string | No | The name of the environment variable. The name must be 1 to 128 characters in length and can contain letters, underscores (_), and digits. The name cannot start with a digit. Specify the value in the | PATH |
Value | string | No | The value of the environment variable. The value can be up to 256 characters in length. | /usr/local/tomcat |
Cpu | float | No | The number of vCPUs that you want to allocate to the container. | 2 |
Memory | float | No | The memory size that you want to allocate to the container. Unit: GiB. | 4 |
LifecycleHookContext | object | No | The context of the lifecycle hook. | |
DisableLifecycleHook | boolean | No | Specifies whether to disable the lifecycle hook. | false |
IgnoredLifecycleHookIds | array | No | The IDs of the lifecycle hooks that you want to disable. | |
string | No | The ID of the lifecycle hook that you want to disable. | ash-bp14zolna43z266bq*** | |
ActivityMetadata | string | No | The metadata of the scaling activity. | {"key":"value"} |
Response parameters
Examples
Sample success responses
JSON
format
{
"ScalingActivityId": "asa-bp175o6f6ego3r2j****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"ActivityType": "CapacityChange"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2024-03-13 | The request parameters of the API has changed | see changesets | ||||||
| ||||||||
2023-12-06 | The request parameters of the API has changed | see changesets | ||||||
|