This topic describes how to call the ModifyInstanceAttribute operation by using Alibaba Cloud command-line interface (CLI) to modify information about an ECS instance.

Background information

You can call the ModifyInstanceAttribute operation to modify information about an ECS instance, such as its password, name, description, hostname, and custom data. For a burstable instance, you can also change its performance mode. 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, query the ID of an ECS instance by using its name.

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

    In this example, change the name of ECS instance i-bp14a7xie8erwsvo****, modify its description, and change the hostname of the operating system.

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


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