All Products
Search
Document Center

Auto Scaling:ScaleWithAdjustment

Last Updated:May 16, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringYes

The ID of the scaling group.

asg-j6c1o397427hyjdc****
AdjustmentTypestringYes

The type of the scaling policy. Valid values:

  • QuantityChangeInCapacity: adds the specified number of ECS instances to or removes the specified number of ECS instances from the scaling group.
  • PercentChangeInCapacity: adds the specified percentage of ECS instances to or removes the specified percentage of ECS instances from the scaling group.
  • TotalCapacity: adjusts the number of ECS instances in the scaling group to a specified number.
QuantityChangeInCapacity
AdjustmentValueintegerYes

The number of instances in each adjustment. The number of ECS instances in each adjustment cannot exceed 1,000.

  • Valid values if you set the AdjustmentType parameter to QuantityChangeInCapacity: -1000 to 1000.
  • Valid values if you set the AdjustmentType parameter to PercentChangeInCapacity: -100 to 10000.
  • Valid values if you set the AdjustmentType parameter to TotalCapacity: 0 to 2000.
100
MinAdjustmentMagnitudeintegerNo

The minimum number of instances allowed in each adjustment. This parameter takes effect only if you set the AdjustmentType parameter to PercentChangeInCapacity.

1
ClientTokenstringNo

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****
SyncActivitybooleanNo

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:

  • true: triggers the scaling activity in a synchronous manner. The scaling activity is triggered at the time when the scaling rule is executed.
  • false: does not trigger the scaling activity in a synchronous manner. After you change the expected number of instances for the scaling group, Auto Scaling checks whether the total number of instances in the scaling group matches the new expected number of instances and determines whether to trigger the scaling activity based on the check result.
Note For more information about the Expected Number of Instances feature, see Expected number of instances.

Default value: false.

false
OverridesobjectNo

The overrides that allow you to adjust the scaling group of the Elastic Container Instance type during a scale-out.

CpufloatNo

The number of vCPUs that you want to allocate to the instance.

2
MemoryfloatNo

The memory size that you want to allocate to the instance. Unit: GiB.

4
ContainerOverridesobject []No

The list of parameters that you want to use to override specific configurations for containers.

NamestringNo

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
ArgsarrayNo

The container startup arguments. You can specify up to 10 arguments.

stringNo

The container startup argument.

arg
CommandsarrayNo

The container startup commands. You can specify up to 20 commands. Each command contains up to 256 characters.

stringNo

The container startup command.

sleep
EnvironmentVarsobject []No

The information about the environment variables.

KeystringNo

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 [0-9a-zA-Z] format.

PATH
ValuestringNo

The value of the environment variable. The value can be up to 256 characters in length.

/usr/local/tomcat
CpufloatNo

The number of vCPUs that you want to allocate to the container.

2
MemoryfloatNo

The memory size that you want to allocate to the container. Unit: GiB.

4
LifecycleHookContextobjectNo

The context of the lifecycle hook.

DisableLifecycleHookbooleanNo

Specifies whether to disable the lifecycle hook.

false
IgnoredLifecycleHookIdsarrayNo

The IDs of the lifecycle hooks that you want to disable.

stringNo

The ID of the lifecycle hook that you want to disable.

ash-bp14zolna43z266bq***
ActivityMetadatastringNo

The metadata of the scaling activity.

{"key":"value"}

Response parameters

ParameterTypeDescriptionExample
object
ScalingActivityIdstring

The ID of the scaling activity.

asa-bp175o6f6ego3r2j****
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
2024-03-13The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: LifecycleHookContext
    Added Input Parameters: ActivityMetadata
2023-12-06The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Overrides