This topic describes how to call the CreateImage operation by using Alibaba Cloud command-line interface (CLI) to create a custom image.

Background information

You can call the CreateImage operation to create a custom image. After you create a custom image, you can use it to create an ECS instance (RunInstances) or replace the system disk of an ECS instance (ReplaceSystemDisk). For more information, see CreateImage.

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. Query the ID of an ECS instance by using Alibaba Cloud CLI. For more information, see Query the details of ECS instances.
  2. Create a custom image for an ECS instance that is in the running state.
    aliyun ecs CreateImage --RegionId cn-hangzhou --InstanceId i-bp1aq39j2yul5y01**** --ImageName demoimage --Description demoimage --Platform CentOS


        "ImageId": "m-bp1503ydxxrppctb****",
        "RequestId": "011AE447-20CE-4043-81AC-7AF2BBC45C38"