AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the AWS Auto Scaling StartInstanceRefresh API operation.

Syntax

Start-ASInstanceRefresh
-AutoScalingGroupName <String>
-AlarmSpecification_Alarm <String[]>
-Preferences_AutoRollback <Boolean>
-Preferences_CheckpointDelay <Int32>
-Preferences_CheckpointPercentage <Int32[]>
-Preferences_InstanceWarmup <Int32>
-LaunchTemplate_LaunchTemplateId <String>
-LaunchTemplate_LaunchTemplateName <String>
-Preferences_MaxHealthyPercentage <Int32>
-Preferences_MinHealthyPercentage <Int32>
-DesiredConfiguration_MixedInstancesPolicy <MixedInstancesPolicy>
-Preferences_ScaleInProtectedInstance <ScaleInProtectedInstances>
-Preferences_SkipMatching <Boolean>
-Preferences_StandbyInstance <StandbyInstances>
-Strategy <RefreshStrategy>
-LaunchTemplate_Version <String>
-Select <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>
-ClientConfig <AmazonAutoScalingConfig>

Description

Starts an instance refresh. This operation is part of the instance refresh feature in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group. This feature is helpful, for example, when you have a new AMI or a new user data script. You just need to create a new launch template that specifies the new AMI or user data script. Then start an instance refresh to immediately begin the process of updating instances in the group. If successful, the request's response contains a unique ID that you can use to track the progress of the instance refresh. 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 that is in progress, use the CancelInstanceRefresh API. An instance refresh might fail for several reasons, such as EC2 launch failures, misconfigured health checks, or not ignoring or allowing the termination of instances that are in Standby state or protected from scale in. You can monitor for failed EC2 launches using the scaling activities. To find the scaling activities, call the DescribeScalingActivities API. If you enable auto rollback, your Auto Scaling group will be rolled back automatically when the instance refresh fails. You can enable this feature before starting an instance refresh by specifying the AutoRollback property in the instance refresh preferences. Otherwise, to roll back an instance refresh before it finishes, use the RollbackInstanceRefresh API.

Parameters

-AlarmSpecification_Alarm <String[]>
The names of one or more CloudWatch alarms to monitor for the instance refresh. You can specify up to 10 alarms.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesPreferences_AlarmSpecification_Alarms
-AutoScalingGroupName <String>
The name of the Auto Scaling group.
Required?True
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-ClientConfig <AmazonAutoScalingConfig>
Amazon.PowerShell.Cmdlets.AS.AmazonAutoScalingClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-DesiredConfiguration_MixedInstancesPolicy <MixedInstancesPolicy>
Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-LaunchTemplate_LaunchTemplateId <String>
The ID of the launch template. To get the template ID, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API. Conditional: You must specify either a LaunchTemplateId or a LaunchTemplateName.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesDesiredConfiguration_LaunchTemplate_LaunchTemplateId
-LaunchTemplate_LaunchTemplateName <String>
The name of the launch template. To get the template name, use the Amazon EC2 DescribeLaunchTemplates API operation. New launch templates can be created using the Amazon EC2 CreateLaunchTemplate API. Conditional: You must specify either a LaunchTemplateId or a LaunchTemplateName.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesDesiredConfiguration_LaunchTemplate_LaunchTemplateName
-LaunchTemplate_Version <String>
The version number, $Latest, or $Default. To get the version number, use the Amazon EC2 DescribeLaunchTemplateVersions API operation. New launch template versions can be created using the Amazon EC2 CreateLaunchTemplateVersion API. If the value is $Latest, Amazon EC2 Auto Scaling selects the latest version of the launch template when launching instances. If the value is $Default, Amazon EC2 Auto Scaling selects the default version of the launch template when launching instances. The default value is $Default.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesDesiredConfiguration_LaunchTemplate_Version
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the AutoScalingGroupName parameter. The -PassThru parameter is deprecated, use -Select '^AutoScalingGroupName' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_AutoRollback <Boolean>
(Optional) Indicates whether to roll back the Auto Scaling group to its previous configuration if the instance refresh fails or a CloudWatch alarm threshold is met. The default is false.A rollback is not supported in the following situations:
  • There is no desired configuration specified for the instance refresh.
  • The Auto Scaling group has a launch template that uses an Amazon Web Services Systems Manager parameter instead of an AMI ID for the ImageId property.
  • The Auto Scaling group uses the launch template's $Latest or $Default version.
For more information, see Undo changes with a rollback in the Amazon EC2 Auto Scaling User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_CheckpointDelay <Int32>
(Optional) The amount of time, in seconds, to wait after a checkpoint before continuing. This property is optional, but if you specify a value for it, you must also specify a value for CheckpointPercentages. If you specify a value for CheckpointPercentages and not for CheckpointDelay, the CheckpointDelay defaults to 3600 (1 hour).
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_CheckpointPercentage <Int32[]>
(Optional) Threshold values for each checkpoint in ascending order. Each number must be unique. To replace all instances in the Auto Scaling group, the last number in the array must be 100.For usage examples, see Adding checkpoints to an instance refresh in the Amazon EC2 Auto Scaling User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesPreferences_CheckpointPercentages
-Preferences_InstanceWarmup <Int32>
A time period, in seconds, during which an instance refresh waits before moving on to replacing the next instance after a new instance enters the InService state.This property is not required for normal usage. Instead, use the DefaultInstanceWarmup property of the Auto Scaling group. The InstanceWarmup and DefaultInstanceWarmup properties work the same way. Only specify this property if you must override the DefaultInstanceWarmup property. If you do not specify this property, the instance warmup by default is the value of the DefaultInstanceWarmup property, if defined (which is recommended in all cases), or the HealthCheckGracePeriod property otherwise.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_MaxHealthyPercentage <Int32>
Specifies the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 100 to 200.If you specify MaxHealthyPercentage, you must also specify MinHealthyPercentage, and the difference between them cannot be greater than 100. A larger range increases the number of instances that can be replaced at the same time.If you do not specify this property, the default is 100 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_MinHealthyPercentage <Int32>
Specifies the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload to allow the operation to continue. The value is expressed as a percentage of the desired capacity of the Auto Scaling group. Value range is 0 to 100.If you do not specify this property, the default is 90 percent, or the percentage set in the instance maintenance policy for the Auto Scaling group, if defined.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_ScaleInProtectedInstance <ScaleInProtectedInstances>
Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances protected from scale in are found. The following lists the valid values:
Refresh
Amazon EC2 Auto Scaling replaces instances that are protected from scale in.
Ignore
Amazon EC2 Auto Scaling ignores instances that are protected from scale in and continues to replace instances that are not protected.
Wait (default)
Amazon EC2 Auto Scaling waits one hour for you to remove scale-in protection. Otherwise, the instance refresh will fail.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesPreferences_ScaleInProtectedInstances
-Preferences_SkipMatching <Boolean>
(Optional) Indicates whether skip matching is enabled. If enabled (true), then Amazon EC2 Auto Scaling skips replacing instances that match the desired configuration. If no desired configuration is specified, then it skips replacing instances that have the same launch template and instance types that the Auto Scaling group was using before the start of the instance refresh. The default is false.For more information, see Use an instance refresh with skip matching in the Amazon EC2 Auto Scaling User Guide.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Preferences_StandbyInstance <StandbyInstances>
Choose the behavior that you want Amazon EC2 Auto Scaling to use if instances in Standby state are found.The following lists the valid values:
Terminate
Amazon EC2 Auto Scaling terminates instances that are in Standby.
Ignore
Amazon EC2 Auto Scaling ignores instances that are in Standby and continues to replace instances that are in the InService state.
Wait (default)
Amazon EC2 Auto Scaling waits one hour for you to return the instances to service. Otherwise, the instance refresh will fail.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesPreferences_StandbyInstances
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is 'InstanceRefreshId'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.AutoScaling.Model.StartInstanceRefreshResponse). Specifying the name of a property of type Amazon.AutoScaling.Model.StartInstanceRefreshResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Strategy <RefreshStrategy>
The strategy to use for the instance refresh. The only valid value is Rolling.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns a System.String object. The service call response (type Amazon.AutoScaling.Model.StartInstanceRefreshResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Supported Version

AWS Tools for PowerShell: 2.x.y.z