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

Background information

You can call the DeleteImage operation to delete a custom image. For more information, see DeleteImage.

Note For more information about the precautions for deleting a custom image, see Delete custom images.

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 DescribeImages operation to query the ID of the image that you want to delete.
    In this example, query the ID of an image by using its name.
    aliyun ecs DescribeImages --RegionId cn-hangzhou --ImageName demoName --output cols=Images.Image[].ImageId
    Sample response:
  2. Delete the image by using its ID.
    aliyun ecs DeleteImage --RegionId cn-hangzhou --ImageId m-bp1503ydxxrppctb**** --Force false


        "RequestId": "2A6B5473-4B15-4F1D-B454-A792770612C3"