This topic describes how to call the StartInstance operation by using Alibaba Cloud CLI to start an ECS instance.

Background information

You can call the StartInstance operation to start an ECS instance. After the call succeeds, the instance enters the Starting state. We recommend that you read the description of the operation before you call the operation. For more information, see StartInstance.

When you call an API operation through Alibaba Cloud CLI, make sure that request parameter values of different data types are in required formats. For more information, see Parameter format overview.

Request examples

  1. Call the DescribeInstances operation to query the ID of the instance that you want to start.

    In this example, the ID of the stopped instance that is bound with the owner:zhangsan tag is queried.

    aliyun ecs DescribeInstances --RegionId cn-hangzhou --Status Stopped --Tag.1.Key owner --Tag.1.Value zhangsan --output cols=Instances.Instance[].InstanceId
    Sample response:
    Instances.Instance[].InstanceId
    -------------------------------
    [i-bp1aq39j2yul5y01****]
  2. Start the i-bp1aq39j2yul5y01**** instance.

    In this example, the ECS instance starts directly after the pre-check without the need for troubleshooting.

    aliyun ecs StartInstance --InstanceId i-bp1aq39j2yul5y01**** --InitLocalDisk false --DryRun false

Result

{
        "RequestId": "2DD09CBD-1F4D-4923-94C7-F3BD67137BBE"
}