Scales instances. The ScaleWithAdjustment operation differs from the ExecuteScalingRule operation in that ScaleWithAdjust can directly scale instances without requiring you to create a scaling rule in advance.
Operation description
-
Before you call this operation, take note of the following items:
- The scaling group is in the Active state.
- The scaling group has no ongoing scaling activities.
-
If no scaling activities in the scaling group are in progress, the operation can trigger scaling activities before the cooldown period of the scaling group expires.
-
If the addition of a specific number of Elastic Compute Service (ECS) instances to the scaling group causes the total number of ECS instances in the scaling group to exceed the maximum allowed number, Auto Scaling adds ECS instances to the scaling group until the total number of instances is equal to the maximum allowed number.
-
If the removal of a specific number of ECS instances from the scaling group causes the total number of ECS instances in the scaling group to be less than the minimum allowed number, Auto Scaling removes ECS instances from the scaling group until the total number of instances is equal to the minimum allowed number.
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 based on the value of ScalingActivityId
in the response.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:ScaleWithAdjustment | update |
|
| none |
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 event. | |
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 | array<object> | No | The list of parameters that you want to use to override specific configurations for containers. | |
object | No | |||
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 arguments that correspond to the startup commands of the container. You can specify up to 10 arguments. | |
string | No | The argument that corresponds to the startup command of the container. You can specify up to 10 arguments. | arg | |
Commands | array | No | The container startup commands. You can specify up to 20 commands. Each command can contain up to 256 characters. | |
string | No | The container startup command. You can specify up to 20 commands. Each command can contain up to 256 characters. | sleep | |
EnvironmentVars | array<object> | No | The information about the environment variables. | |
object | No | |||
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 feature. Valid values:
| 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 | View Change Details |
2023-12-06 | The request parameters of the API has changed | View Change Details |