Starts one or more Elastic Compute Service (ECS) instances that are in the Stopped state. After the operation is called, the instances enter the Starting state.

Usage notes

When you call this operation, take note of the following items:

  • The instances that you want to start must be in the Stopped (Stopped) state.
  • If a response contains {"OperationLocks": {"LockReason" : "security"}} when you query instance information, the instance is locked for security reasons and all operations are prohibited on it.
  • Batch operations are supported. You can use the BatchOptimization parameter to specify the batch operation mode.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes StartInstances

The operation that you want to perform. Set the value to StartInstances.

DryRun Boolean No false

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request syntax, and instance status. If the request fails the dry run, an error message is returned. If the request passes the dry run, DRYRUN.SUCCESS is returned.
    Note If you set BatchOptimization to SuccessFirst and DryRun to true, only DRYRUN.SUCCESS is returned regardless of whether the request passes the dry run.
  • false: performs a dry run and sends the request. If the request passes the dry run, the operation is performed.

Default value: false.

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

BatchOptimization String No AllTogether

The batch operation mode. Valid values:

  • AllTogether: In this mode, a success message is returned if all specified instances are started. If one or more of the specified instances fail the check when you set the DryRun parameter to false, none of the specified instances can be started and an error message is returned.
  • SuccessFirst: In this mode, each instance is separately started. The response contains the operation results of each instance.

Default value: AllTogether.

InstanceId.N String Yes i-bp67acfmxazb4p****

The ID of instance N. Valid values of N: 1 to 100.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

InstanceResponses Array of InstanceResponse

Details about instance-specific responses, which contain the status of each instance before and after the operation is called and the results of the operation.

InstanceResponse
Code String 200

The error code returned for the instance. The return value 200 indicates success. For more information, see the "Error codes" section in this topic.

Message String success

The error message returned for the instance. A return value of success indicates operation success. For more information, see the "Error codes" section in this topic.

InstanceId String i-bp67acfmxazb4p****

The ID of the instance.

CurrentStatus String Starting

The current state of the instance.

PreviousStatus String Stopped

The state of the instance before the operation was called.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=StartInstances
&RegionId=cn-hangzhou
&BatchOptimization=AllTogether
&InstanceId=["i-bp67acfmxazb4p****"]
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<StartInstancesResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <InstanceResponses>
        <InstanceResponse>
            <Message>success</Message>
            <InstanceId>i-bp67acfmxazb4p****</InstanceId>
            <PreviousStatus>Stopped</PreviousStatus>
            <CurrentStatus>Starting</CurrentStatus>
            <Code>200</Code>
        </InstanceResponse>
        <InstanceResponse>
            <Message>success</Message>
            <InstanceId>i-bp67acfmxazb4p****</InstanceId>
            <PreviousStatus>Stopped</PreviousStatus>
            <CurrentStatus>Starting</CurrentStatus>
            <Code>200</Code>
        </InstanceResponse>
        <InstanceResponse>
            <Message>The specified InstanceId does not exist.</Message>
            <InstanceId>i-TestID</InstanceId>
            <PreviousStatus/>
            <CurrentStatus/>
            <Code>InvalidInstanceId.NotFound</Code>
        </InstanceResponse>
    </InstanceResponses>
</StartInstancesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "InstanceResponses" : {
    "InstanceResponse" : [ {
      "Message" : "success",
      "InstanceId" : "i-bp67acfmxazb4p****",
      "PreviousStatus" : "Stopped",
      "CurrentStatus" : "Starting",
      "Code" : "200"
    }, {
      "Message" : "success",
      "InstanceId" : "i-bp67acfmxazb4p****",
      "PreviousStatus" : "Stopped",
      "CurrentStatus" : "Starting",
      "Code" : "200"
    }, {
      "Message" : "The specified InstanceId does not exist.",
      "InstanceId" : "i-TestID",
      "PreviousStatus" : "",
      "CurrentStatus" : "",
      "Code" : "InvalidInstanceId.NotFound"
    } ]
  }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled. The error message returned because the customer master key (CMK) is not enabled when a KMS key ID is specified for a disk. You can call the DescribeKey operation of KMS to query the information about the specified CMK.
400 DRYRUN.SUCCESS This request is a dryrun request with successful result. The error message returned because a dry run is performed and the request passes the dry run.
403 Abs.InvalidInstanceIds.MalFormed The specified instanceIds is not valid. The error message returned because the specified InstanceId.N parameter is invalid.
403 IncorrectInstanceStatus %s The error message returned because the operation is not supported while the instance is in the current state.
403 InvalidInstance.NotFoundSystemDisk %s The error message returned because the specified instance has no system disk and cannot be started. For more information, see the return value of the %s placeholder in the error message. You must call the AttachDisk operation to attach a system disk to the specified instance.
403 OperationDenied.NoStock The requested resource is sold out in the specified zone; try other types of resources or other regions and zones. The error message returned because the requested resources are unavailable in the specified zone. Try another instance type or zone. You can call the DescribeZones operation to query available resources.
403 OperationDenied.SpotPriceLowerThanPublicPrice The spot instance price is lower than public price. The error message returned because the user-defined maximum hourly price of a preemptible instance is lower than the current market price.
403 InsufficientBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. Add funds to your account and try again.
403 InstanceNotReady The specified instance is not ready for use. The error message returned because the operation is not supported while the resource is in the current state. Try again later.
404 InvalidInstanceId.NotFound %s The error message returned because the specified instance does not exist. Check whether the specified instance ID is valid.
404 InvalidInstanceIds.NotFound The specified InstanceIds does not exist. The error message returned because the specified instance does not exist. Check whether the specified instance ID is valid. You can call the DescribeInstances operation to query the status of specific instances.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified instance does not exist. Check whether the specified instance ID is valid.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later.

For a list of error codes, see Service error codes.