Deprecate a faulty custom image in an image family to fall back to an older version, or restore a deprecated image to active state.
Prerequisites
Two custom images are created and added to the same image family. See Set an image family.
In this example, the image family image-test contains two images: image1 and image2. image2 is the latest active custom image.
Limitations
Deprecated and active images have the following limitations:
-
Unshare a shared custom image before deprecating it.
-
A deprecated custom image can create instances or replace system disks, but cannot be shared or copied.
Deprecate an image in an image family
After you deprecate the latest active custom image in an image family, new ECS instances created from the image family use the next latest active custom image by default.
If an image family contains only one active custom image, deprecating it leaves no active images for instance creation. Proceed with caution.
Go to ECS console - Images.
In the upper-left corner of the page, select a region and resource group.
-
Deprecate
image2in theimage-testimage family.-
(Optional) In the upper-right corner of the custom images list, click
to display image families. -
In the Image Family section, click
image-test. -
In the Actions column for
image2, choose
> Deprecate Image. -
Confirm the deprecation details and click OK.
-
Verify that the Status column for
image2shows Deprecated.
-
-
Log on to the OpenAPI Explorer.
-
Call DescribeImageFromFamily to query the latest image in a specified image family.
Query the latest image in
image-test. Set the following request parameters:-
RegionId: The region where the image family resides.
-
ImageFamily: The image family name. Set to
image-test.
The response shows that the latest active image is
image1, confirming thatimage2is deprecated.After a successful call, the
ImageNamevalue in the response isimage1, indicating that the latest active image in the image family is image1."OSName": "CentOS 7.2 64位", "IsSupportIoOptimized": true, "IsSupportCloudinit": true, "ImageName": "image1", "DiskDeviceMappings": { "DiskDeviceMapping": [ -
Restore an image in an image family
Restore a deprecated custom image in an image family to make it active again.
Go to ECS console - Images.
In the upper-left corner of the page, select a region and resource group.
-
Restore
image2in theimage-testimage family.-
(Optional) In the upper-right corner of the custom images list, click
to display image families. -
In the Image Family section, click
image-test. -
In the Actions column for the deprecated image
image2, click
and then select Restore Image. -
Confirm the restoration details and click OK.
-
Verify that the Status column for
image2shows Available.
-
-
Log on to the OpenAPI Explorer.
-
Call DescribeImageFromFamily to query the latest image in a specified image family.
Query the latest image in
image-test. Set the following request parameters:-
RegionId: The region where the image family resides.
-
ImageFamily: The image family name. Set to
image-test.
The response shows that the latest active image is
image2, confirming thatimage2is restored to active state.After calling the API, the
ImageNamevalue in the response isimage2, indicating that the latest active image in the image family is image2."OSName": "CentOS 8.0 64位", "IsSupportIoOptimized": true, "IsSupportCloudinit": true, "ImageName": "image2", "DiskDeviceMappings": { "DiskDeviceMapping": [ -