This topic describes how to call the ModifyInstanceAttribute operation by using Alibaba Cloud CLI to modify information about an ECS instance.

Background information

You can call the ModifyInstanceAttribute operation to modify instance information, such as the password, name, description, hostname, and user data. For a burstable instance, you can also change its performance mode. We recommend that you read the description of the operation before you call the operation. For more information, see ModifyInstanceAttribute.

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

Request examples

  1. Call the DescribeInstances operation to query the ID of the ECS instance whose information you want to modify.

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

    aliyun ecs DescribeInstances --RegionId cn-hangzhou --InstanceName wpdemo --output cols=Instances.Instance[].InstanceId
    Sample response:
  2. Modify the instance information.

    In this example, the name, description, and hostname of the i-bp14a7xie8erwsvo**** instance are modified.

    aliyun ecs ModifyInstanceAttribute --InstanceId i-bp14a7xie8erwsvo**** --HostName newDemo --InstanceName newInsName --Description DescriptionDemo


        "RequestId": "0363E731-19E2-4C94-9C5E-A1F3D6842B9D"