StartInstanceRefresh
Refreshes the instances in a scaling group to apply a new scaling configuration or update the images of the instances.
Operation description
A scaling group can have only one running instance refresh node at a time.
This feature is supported only for ECS scaling groups that use the priority policy as the scale-out policy. Scaling groups that use the number of vCPUs to calculate the capacity of the scaling group and scaling groups whose instance revoke pattern is set to shutdown revoke pattern or forced shutdown revoke pattern do not support this feature.
During an instance refresh, normal scale-out and scale-in activities can be performed. However, scale-out activities use the desired configuration specified for the instance refresh.
Instances that are manually added to the scaling group, or are in the standby state or protection status are ignored by the instance refresh node and are not refreshed.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:StartInstanceRefresh |
update |
*ScalingGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ScalingGroupId |
string |
Yes |
The ID of the scaling group. |
asg-bp18p2yfxow2dloq**** |
| ClientToken |
string |
No |
Ensures the idempotence of the request. You can generate the value on the client to ensure that the value is unique across 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**** |
| RegionId |
string |
Yes |
The region ID of the scaling group. |
cn-hangzhou |
| MinHealthyPercentage |
integer |
No |
The minimum percentage of the scaling group capacity that must remain in service 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 scaling group capacity during the instance refresh. Valid values: 100 to 200. Default value: 120. Note
If both MinHealthyPercentage and MaxHealthyPercentage are set to 100, one instance is refreshed at a time. |
100 |
| DesiredConfiguration |
object |
No |
The desired configuration for the instance refresh. Note
|
|
| ImageId |
string |
No |
The ID of the image. Note
|
m-2ze8cqacj7opnf*** |
| ScalingConfigurationId |
string |
No |
The ID of the scaling configuration. |
asc-2zed7lqn4ts4**** |
| LaunchTemplateId |
string |
No |
The ID of the launch template. This parameter is used to specify that the scaling group obtains launch configurations from the launch template. |
lt-2ze2qli30u*** |
| LaunchTemplateVersion |
string |
No |
The version of the launch template. Valid values:
Note
If the version is set to Default or Latest, the instance refresh task cannot be rolled back. |
8 |
| LaunchTemplateOverrides |
array<object> |
No |
The instance type overrides for the launch template. |
|
|
object |
No |
The instance type overrides for the launch template. |
||
| InstanceType |
string |
No |
This parameter is used to specify the instance type, which overrides the instance type in the launch template. Note
This parameter takes effect only when the LaunchTemplateId parameter is specified. |
ecs.c5.2xlarge |
| Containers |
array<object> |
No |
The list of containers included in the instance. Note
|
|
|
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 for the container. You can specify up to 20 commands. Each command can contain up to 256 characters. |
|
|
string |
No |
The startup commands for the container. You can specify up to 20 commands. Each command can contain up to 256 characters. |
sleep |
|
| Args |
array |
No |
The arguments for the container startup commands. You can specify up to 10 arguments. |
|
|
string |
No |
The arguments for the container startup commands. You can specify up to 10 arguments. |
100 |
|
| EnvironmentVars |
array<object> |
No |
The environment variables. |
|
|
object |
No |
The environment variables. |
||
| Key |
string |
No |
The name of the environment variable. The name must be 1 to 128 characters in length. It can contain letters, digits, and underscores (_), and 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. |
fieldPath |
| SkipMatching |
boolean |
No |
Specifies whether to skip instances that match the desired configuration. Note
The system determines whether an instance matches the desired configuration based on the ID of the desired scaling configuration, without comparing specific configuration items. Valid values:
Default value: true. |
true |
| Checkpoints |
array<object> |
No |
The checkpoints for the refresh task. This parameter 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 for the refresh task. This parameter 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.
|
10 |
| Strategy |
string |
No |
The execution strategy for the instance refresh task. Valid values:
Default value: Rolling. |
Rolling |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
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.