Delete a machine image
Delete a machine image's snapshot so it stops costing storage; the image's record stays as deleted.
Replace ewi-1a2b3c4d with your image's id.
Warning
The snapshot is deleted and cannot be recovered. Nothing can be launched from the image afterwards.
Prerequisites
- Permission for
ec2:DeregisterImage. - In the console, also
ec2:DescribeImagesto open Images (without it the page says "Access denied"). - An image of yours. A platform base image is refused with
409("… is a platform base image shared by every organization, not a snapshot of yours, so it cannot be removed. …"). An id that is not one of your images answers404"Image not found".
Delete the image
- Open Compute, then Images, and choose the image's row. Its details open in a side panel.
- Under Delete this image, choose Delete image.
- In the confirmation dialog, enter the image name.
- Choose Delete image. The image's state changes to Deleted.
dcloud ec2 machine-images deregister ewi-1a2b3c4dDELETE /ec2/api/machine-images/ewi-1a2b3c4dRemove the dcloud_machine_image resource and run terraform apply.
Result
The snapshot is deleted, which stops the storage charge, and the image moves to state
deregistered (Deleted in the console). The record stays: instances built from it still name
it, and so do invoice lines already written. Instances already running are untouched. Deleting an
image that is already deleted answers the same. If the provider cannot delete the snapshot, the
request answers 502 "The snapshot is still at the provider and still billing: …" (for an image on
your own hosts, "The image is still on the hosts: …") and the image is unchanged; try again.