All Products
Search
Document Center

Auto Scaling:ScaleWithAdjustment

最終更新日:Nov 11, 2024

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ess:ScaleWithAdjustmentupdate
  • All Resources
    *
    none
none

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 event.

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
ContainerOverridesarray<object>No

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

objectNo
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 arguments that correspond to the startup commands of the container. You can specify up to 10 arguments.

stringNo

The argument that corresponds to the startup command of the container. You can specify up to 10 arguments.

arg
CommandsarrayNo

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

stringNo

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

sleep
EnvironmentVarsarray<object>No

The information about the environment variables.

objectNo
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 feature. Valid values:

  • true
  • false
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****
ActivityTypestring

The type of the scaling activity.

If ActivityType is set to CapacityChange, only the expected number of instances is changed during the scaling activity specified by ScalingActivityId and no scale-out is triggered.

This parameter is applicable to only scaling groups that have an expected number of instances.

CapacityChange

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 changedView Change Details
2023-12-06The request parameters of the API has changedView Change Details