This topic describes how to call the CreateImage operation by using Alibaba Cloud 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 ECS instances (RunInstances) or replace the system disk of an ECS instance (ReplaceSystemDisk). We recommend that you read the description of the operation before you call the operation. 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 the ECS instance from which you want to create a custom image by using Alibaba Cloud CLI. For more information, see Query the details of ECS instances.
  2. Create a custom image from the 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"