[ aws . autoscaling ]
Starts a new instance refresh operation, which triggers a rolling replacement of all previously launched instances in the Auto Scaling group with a new group of instances.
If successful, this call creates a new instance refresh request with a unique ID that you can use to track its progress. To query its status, call the DescribeInstanceRefreshes API. To describe the instance refreshes that have already run, call the DescribeInstanceRefreshes API. To cancel an instance refresh operation in progress, use the CancelInstanceRefresh API.
For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh .
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
start-instance-refresh
--auto-scaling-group-name <value>
[--strategy <value>]
[--preferences <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--auto-scaling-group-name
(string)
The name of the Auto Scaling group.
--strategy
(string)
The strategy to use for the instance refresh. The only valid value is
Rolling
.A rolling update is an update that is applied to all instances in an Auto Scaling group until all instances have been updated. A rolling update can fail due to failed health checks or if instances are on standby or are protected from scale in. If the rolling update process fails, any instances that were already replaced are not rolled back to their previous configuration.
Possible values:
Rolling
--preferences
(structure)
Set of preferences associated with the instance refresh request.
If not provided, the default values are used. For
MinHealthyPercentage
, the default value is90
. ForInstanceWarmup
, the default is to use the value specified for the health check grace period for the Auto Scaling group.For more information, see RefreshPreferences in the Amazon EC2 Auto Scaling API Reference .
MinHealthyPercentage -> (integer)
The amount of capacity in the Auto Scaling group that must remain healthy during an instance refresh to allow the operation to continue, as a percentage of the desired capacity of the Auto Scaling group (rounded up to the nearest integer). The default is
90
.InstanceWarmup -> (integer)
The number of seconds until a newly launched instance is configured and ready to use. During this time, Amazon EC2 Auto Scaling does not immediately move on to the next replacement. The default is to use the value for the health check grace period defined for the group.
Shorthand Syntax:
MinHealthyPercentage=integer,InstanceWarmup=integer
JSON Syntax:
{
"MinHealthyPercentage": integer,
"InstanceWarmup": integer
}
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
Example 1: To start an instance refresh with command line parameters
The following start-instance-refresh
example starts an instance refresh using command line arguments. The optional preferences
parameter specifies an InstanceWarmup
of 400
seconds and a MinHealthyPercentage
of 50
percent.
aws autoscaling start-instance-refresh \
--auto-scaling-group-name my-asg \
--preferences '{"InstanceWarmup": 400, "MinHealthyPercentage": 50}'
Output:
{
"InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh in the Amazon EC2 Auto Scaling User Guide.
Example 2: To start an instance refresh using a JSON file
The following start-instance-refresh
example starts an instance refresh using a JSON file. You can specify the Auto Scaling group and define your preferences in a JSON file, as shown in the following example.
aws autoscaling start-instance-refresh \
--cli-input-json file://config.json
Contents of config.json
:
{
"AutoScalingGroupName": "my-asg",
"Preferences": {
"InstanceWarmup": 400,
"MinHealthyPercentage": 50
}
}
Output:
{
"InstanceRefreshId": "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b"
}
For more information, see Replacing Auto Scaling Instances Based on an Instance Refresh in the Amazon EC2 Auto Scaling User Guide.