StopInstance

Last Updated: Jan 29, 2018

Description

Stop an ECS instance. When stopping a specified instance, consider the following:

  • You can only stop an instance in Running status.

  • The instance becomes Stopping after a successful API request, and the instance becomes Stopped after it is stopped successfully.

  • You can force an instance to stop, and the force stop operation is same as the power failure. The temporary files and data in the instance may be lost.

  • If the instance is locked, and the OperationLocks of the instance indicates LockReason: security, you cannot stop the instance.

  • For an instance from the I1 type family that has a local disk (Local_storage) configured, the request parameter ConfirmStop is required. The interface can only be called successfully when the parameter ConfirmStop is set to True.

  • For an instance from the I1 type family that has a local disk (Local_storage) configured, after it is stopped, the data of the local disk is cleared. We recommend that you implement data redundancy at the application layer to guarantee the data availability.

  • This API automatically ignores the parameter ConfirmStop for all of the instance types except the instance of I1 type family.

  • After you enable the feature of No fees for stopped instances for a VPC instance, you can set Stopped=KeepCharging to disable the feature, the ECS instance will be billed after it is stopped, and its resource and Internet IP address are reserved.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: StopInstance.
InstanceId String Yes The specified instance ID.
ForceStop String No Whether to force shutdown upon device restart. Optional values:
  • true: force the instance to shut down
  • false: the instance shuts down normally
Default value: false.
ConfirmStop String No Whether to stop an I1 ECS instance or not. A required parameter for I1 type family instance, it only takes effect when the instance is of I1 type family. Optional values:
  • true
  • false
The default value is false.
StoppedMode String No Whether a VPC ECS instance is billed after it is stopped or not. Optional value: KeepCharging
After you enable the feature of No fees for stopped instances for a VPC instance, you can set Stopped=KeepCharging to disable the feature, the ECS instance will be billed after it is stopped, and its resource and Internet IP address are reserved.

Response parameters

All parameters are common response parameters. For more information, see Common parameters.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=StopInstance
  2. &InstanceId=i-instance1
  3. &<Common Request Parameters>

Response example

XML format

  1. <StopInstanceResponse>
  2. <RequestId>1C488B66-B819-4D14-8711-C4EAAA13AC01</RequestId>
  3. </StopInstanceResponse>

JSON format

  1. {
  2. "RequestId": "1C488B66-B819-4D14-8711-C4EAAA13AC01"
  3. }

Error codes

Error code Error message HTTP status code Meaning
InvalidParameter The specified parameter ForceStop is not valid. 400 The specified ForceStop is invalid, the parameter is not in the enumerated range.
MissingParameter The input parameter InstanceId that is mandatory for processing this request is not supplied. 400 The parameter InstanceId is required.
IncorrectInstanceStatus The current status of the resource does not support this operation. 403 The status of the instance does not support this operation.
InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons. 403 The instance is locked for security reasons.
InstanceType.ParameterMismatch The input parameter ConfirmStop must be true when an instance have localstorage. 403 Incorrect value of ConfirmStop.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified InstanceId does not exist.
Thank you! We've received your feedback.