- Documentation
Elastic Compute Service
Elastic Compute Service
API Reference
Instances
StopInstances - Stops instances
Instances
StopInstances - Stops instances
StopInstances - Stops instances
Call the StopInstances operation to stop one or more instances.
Usage notes
Only instances in the Running state can be stopped.
Usage notes
- Stopping an instance will interrupt your business operations. Please proceed with caution.
- After you stop an instance, billing will not be stopped, and resources will be reserved for you. To stop billing, you need to delete the instance and its associated resources.
- After a spot instance is stopped, you cannot restart it if the resources are insufficient.
- Stopping a subscription instance does not affect the expiration time.
Debugging
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
Request parameters
Only the request parameters specific to this operation and some common parameters are listed below. For more information, refer to Common parameters. Action string required Sample value: StopInstances
The operation that you want to perform. Valid value: StopInstances.
Version string required Sample value: 2020-04-01
The API version. Value: 2020-04-01.
ClientToken string Optional Sample value: 333456899ff****
The ClientToken is used to ensure the request idempotency. The client automatically generates a token to ensure that the token is unique among different requests. This prevents repeated actions due to multiple client retries when the call of the API action times out or an internal server error occurs.
Value: Only ASCII characters are supported. The length is no more than 64 ASCII characters.
ForceStop boolean Optional Sample value: false
Whether to forcibly shut down the instance. Valid values:
- true: Forcibly shuts down the instance. It is equivalent to a typical power-off operation, and all cached data that has not been written to the storage device will be lost.
- false (default): Normal shutdown.
tip
For the following types of instances, regardless of whether ForceStop is set to true or false, the instances will be forcibly shut down.
- HPC-optimized ebmhpcpni2l, ebmhpcpni2, and ebmhpchfpni2 instances.
ebmhpcpni2l, ebmhpcpni2, and ebmhpchfpni2 instances are currently in Beta. If you need a trial, please contact your account manager.
InstanceIds.N string[] required Sample value: InstanceIds.1=i-ybo349sxoncm9t******&InstanceIds.2=i-ybo349sxolcm9t******
The instance ID. A maximum of 100 instance IDs are supported.
- Argument - N: specifies the serial number of the instance.
- Separate multiple instance IDs with ampersands (&).
StoppedMode string Optional Sample value: KeepCharging
The shutdown mode: Valid values:
- KeepCharging: Normal Mode. After the instance is stopped, it and its associated resources are retained, and you are charged for them in the same way as before the stop.
- StopCharging: Economical Mode. After the instance is stopped, its computing resources (vCPU, GPU, and memory) will be reclaimed and billing will stop. The mounted volumes, images, and EIPs are retained and you are charged for them.
Response parameters
Only the response parameters specific to this operation are listed below. For more information, please refer to Response Structure. tip
The following error code for the operation is displayed only when an invalid value is specified for a request parameter. If valid values are specified for the request parameters, no error code is displayed, and a status code of 200 is returned. However, this does not mean that the operation on all instances is successful. To view the operation result on a single instance, see the information in the following response parameters. OperationDetails object[] Sample value: --
The operation details.
Error object Sample value: --
The error message for the instance being operated on.
Code string Sample value: InvalidInstance.NotFound
The error code for the failure of a specific request during batch operations. Value:
- InvalidInstance.NotFound: The specified instance does not exist.
- MissingParameter.InstanceId: The instance ID cannot be empty.
- InvalidInstanceStatus: The current status of the instance does not support this operation.
- InvalidStoppedMode.Conflict: StoppedMode conflicts with the instance status.
- InvalidStoppedMode.ChargeTypeMismatch: The billing method of the current instance does not support Economical Mode.
- InvalidStoppedMode.InstanceTypeMismatch: The type of the current instance does not support Economical Mode.
- OperationDenied.ResourceLocked: The specified operation is rejected because your resource has been locked by another operation.
- OperationDenied.ResourceCreatedByOtherService: The specified operation is rejected because your resource has been created by another service. You can query the corresponding service based on the system tag of the resource.
- OperationDenied.InstanceIsCreatingImage: The specified operation is rejected because the instance is being used to create a custom image.
- FlowLimitExceeded: You have exceeded the rate limit for resource requests.
- Insufficient.InstanceCapacity: The resources are currently insufficient. Try again later or select other instance types.
- InternalError: An internal error occurred. Try again. If multiple attempts fail, submit a ticket.
- InvalidStoppedModeForScheduledInstance.Unsupported: The specified Elastic Scheduled Instance does not support Economical Mode.
- InvalidStoppedModeForAffinityGroupInstance.Unsupported: The specified affinity group instance does not support Economical Mode.
tip
Each Code corresponds to a Message in sequence.
Message string Sample value: The specified instance does not exist.
The error information for the failure of a specific request during batch operations. Value:
- The specified instance does not exist.
- The required parameter InstanceId is not supplied.
- The status of the specified instance does not support this request.
- The specified StoppedMode conflicts with instance status.
- The specified StopCharging does not match the instance's ChargeType.
- The specified StopCharging does not match the instance's InstanceType.
- The specified operation is denied as your resource is locked for another operation.
- The specified operation is denied as your resource is created by other service. You can check system tags to find the service.
- The specified operation is denied as your instance is creating image.
- You've reached the limit on request rate of resources.
- There is not enough capacity to fulfill your request.
- An internal error has occurred.
- The specified scheduled instance does not support stop charging.
- The specified affinity group instance does not support stop charging.
tip
Each Code corresponds to a Message in sequence.
InstanceId string Sample value: i-ybo349sxoncm9t******
The ID of the instance on which the operation is performed.
Sample request
Sample response
Error codes
The table below lists the business-related error codes of the operation. For more information, refer to Common error codes. Last updated: 2026.06.18 17:48:24