This topic describes how to call the StartInstance operation by using Alibaba Cloud command-line interface (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. 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, query the ID of the unstarted ECS instance that is bound with tag owner:zhangsan.

    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 ECS instance with the ID of i-bp1aq39j2yul5y01****

    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"
}