StartInstanceRefresh

Updated at:

Refreshes the instances in a scaling group to apply a new scaling configuration or update the images of the instances.

Operation description

Operation description

  • A scaling group can have only one running instance refresh node at a time.

  • This feature supports only ECS scaling groups whose scale-out policy is set to priority policy. This feature does not support scaling groups that use the number of vCPUs to calculate the capacity of the scaling group, or scaling groups whose instance revoke pattern is set to shutdown and revoke pattern or forcible shutdown and revoke pattern.

  • During an instance refresh, normal scale-out and scale-in operations can be performed. However, scale-out operations use the desired configuration of the instance refresh.

  • Instances that are manually added to the scaling group, instances in the standby state, and instances in the protection status are ignored by the instance refresh node and do not participate in the instance refresh.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ess:StartInstanceRefresh

update

*ScalingGroup

acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the scaling group.

cn-hangzhou

ClientToken

string

No

Ensures the idempotence of the request. You can generate the value from your client to ensure that the value is unique among different requests. The value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-42665544****

ScalingGroupId

string

Yes

The ID of the scaling group.

asg-bp18p2yfxow2dloq****

MinHealthyPercentage

integer

No

The minimum percentage of healthy instances that must remain in service in the scaling group during the instance refresh. Valid values: 0 to 100. Default value: 80.

80

MaxHealthyPercentage

integer

No

The maximum percentage by which the number of instances in the scaling group can exceed the capacity of the scaling group during the instance refresh. Valid values: 100 to 200. Default value: 120.

Note

When MinHealthyPercentage and MaxHealthyPercentage are both set to 100, one instance is refreshed at a time.

100

DesiredConfiguration

object

No

The desired configuration for the instance refresh.

Note
  • You cannot specify ScalingConfigurationId, ImageId, LaunchTemplateId, and Containers at the same time, and you must specify at least one of them.

  • The refresh task skips instances in the scaling group that match the desired configuration.

ImageId

string

No

The ID of the image.

Note
  • After the instance refresh task is successfully executed, the image configuration in the currently effective configuration of the scaling group is updated to this image.

  • This parameter is not supported if the source of the currently effective configuration of the scaling group is a launch template.

  • Images that contain data cloud disks are not supported.

m-2ze8cqacj7opnf***

ScalingConfigurationId

string

No

The ID of the scaling configuration.

Note

After the instance refresh task is successfully executed, the effective scaling configuration of the scaling group is updated to this configuration.

asc-2zed7lqn4ts4****

LaunchTemplateId

string

No

The ID of the instance launch template, which is used to specify that the scaling group obtains the launch configuration information from the instance launch template.

lt-2ze2qli30u***

LaunchTemplateVersion

string

No

The version of the instance launch template. Valid values:

  • A fixed template version number.

  • Default: Always uses the default version of the template.

  • Latest: Always uses the latest version of the template.

Note

When the version is set to Default or Latest, the instance refresh task does not support rollback.

8

LaunchTemplateOverrides

array<object>

No

The instance type information that extends the launch template.

object

No

The instance type information that extends the launch template.

InstanceType

string

No

Specifies the instance type, which overrides the instance type in the launch template.

ecs.g7.2xlarge

Containers

array<object>

No

The list of containers included in the instance.

array<object>

No

The list of containers included in the instance.

Name

string

No

The custom name of the container.

nginx

Image

string

No

The container image.

registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:latest

Commands

array

No

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

string

No

The startup command of the container. The command can contain up to 256 characters.

sleep

Args

array

No

The parameters corresponding to the startup commands of the container. You can specify up to 10 parameters.

string

No

The parameter corresponding to the startup command of the container.

100

EnvironmentVars

array<object>

No

The information about the environment variables.

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. Format requirements: [0-9a-zA-Z] and underscores (_), and it cannot start with a digit.

PATH

Value

string

No

The value of the environment variable. The value must be 0 to 256 characters in length.

/usr/local/bin

FieldRefFieldPath

string

No

Note

This parameter is not available for use.

fieldPath

SkipMatching

boolean

No

Specifies whether to skip instances that match the desired configuration.

Note

The system determines whether an instance matches based on the ID of the desired scaling configuration, and does not compare specific configuration items.

Valid values:

  • true: Skips the instances. When the instance refresh task is started, the system checks the configuration of each instance. No refresh operation is performed on instances that are already created by using the desired configuration.

  • false: Does not skip. After the instance refresh task is started, the task refreshes all instances in the scaling group.

Default value: true.

true

Checkpoints

array<object>

No

The checkpoints of the refresh task. Specifies that the task is automatically paused for the duration specified by CheckpointPauseTime in minutes when the percentage of new instances reaches the specified value during the instance refresh.

object

No

The checkpoints of the refresh task. Specifies that the task is automatically paused for the duration specified by CheckpointPauseTime in minutes when the percentage of new instances reaches the specified value during the instance refresh.

Percentage

integer

No

The percentage of new instances out of the total instances in the scaling group. When this percentage is reached, the task is automatically paused. Valid values: 1 to 100. Unit: %.

Note

The values must be set in ascending order, and the last percentage must be 100.

20

CheckpointPauseTime

integer

No

The pause duration when a checkpoint of the refresh task is reached.

  • Unit: minutes.

  • Valid values: 1 to 2880.

  • Default value: 60.

10

Strategy

string

No

The execution strategy of the instance refresh task. Valid values:

  • Rolling: The instance refresh task refreshes instances by creating new instances and releasing old instances.

  • ReplaceSystemDisk: Updates the system cloud disks of the existing instances. You can specify DesiredConfiguration.image to update the system cloud disks of the instances.

Default value: Rolling.

Rolling

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

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

InstanceRefreshTaskId

string

The ID of the instance refresh task.

ir-a12ds234fasd*****

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "InstanceRefreshTaskId": "ir-a12ds234fasd*****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.