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

Background information

You can call the RebootInstance operation to restart an ECS instance that is in the Running state. 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 RebootInstance.

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 ECS instance that you want to restart.

    In this example, the instance name is used to query the ID of the instance.

    aliyun ecs DescribeInstances --RegionId cn-hangzhou --InstanceName namedemo --Status Running --output cols=Instances.Instance[].InstanceId
    Sample response:
  2. Restart the i-bp14a7xie8erwsvo**** instance, which is in the Running state.

    In this example, the ECS instance is stopped properly and it starts directly after the pre-check.

    aliyun ecs RebootInstance --InstanceId i-bp14a7xie8erwsvo**** --ForceStop false --DryRun false


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