Custom images can be put into the Deprecated state or be restored. You can set the state of an available custom image in an image family to Deprecated to roll back the image. You can also restore the latest custom image in the image family.

Prerequisites

Two custom images are available in the same image family. For more information, see Set an image family. In this example, the image family is named image-test and contains two images: image1 and image2. image2 is the latest available custom image.

Background information

The state of a custom image can be changed regardless of whether the custom image belongs to an image family. The state of a custom image can be changed from Available to Deprecated, and an image in the Deprecated state can be restored to the Available state. Operations vary based on the states of images:
  • A custom image that has been shared must be unshared before the image can be put into the Deprecated state.
  • Custom images in the Deprecated state can be used to create instances or replace system disks, but cannot be shared or copied.
  • You can set the state of the latest available custom image in an image family to Deprecated to roll back the image. When you use the image family to create Elastic Compute Service (ECS) instances, the latest available custom image that is not in the Deprecated state is used. Custom images in the Deprecated state are not used.
    Notice If you want to roll back a custom image in the image family to a previous version, you can put the latest available custom image into the Deprecated state. However, if the custom image that you want to roll back is the only image in the Available state within the image family, the image family does not contain available custom images that can be used to create instances after you put the custom image into the Deprecated state. Proceed with caution when you put a custom image into the Deprecated state.
  • If you want to use the latest custom image that is in the Deprecated state in an image family, you can restore the image and use the image as the latest available custom image.

Set the state of an image in an image family to Deprecated to roll back the image

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Images.
  3. In the top navigation bar, select a region.
  4. Set the state of the latest image named image2 in the image-test image family to Deprecated.
    1. In the Image Family section of the Custom Images tab, enter image-test in the search box for exact match.
    2. Click the More icon icon and choose More > Deprecate Image in the Actions column that corresponds to image2.
    3. Deprecated is displayed in the Status column that corresponds to image2.
  5. Log on to OpenAPI Explorer.
  6. Call the DescribeImageFromFamily operation to query the latest available custom image in the specified image family.
    In this example, the latest image in the image-test image family is queried. Specify the following API request parameters:
    • RegionId: Specify the region ID of the image family.
    • ImageFamily: Specify the image family name. In this example, the name image-test is used.
    The following figure shows a sample response. The name of the latest available image is displayed as image1, which indicates that the image in the image family is rolled back. if1

Restore an image in an image family

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Images.
  3. In the top navigation bar, select a region.
  4. In the Image Family section of the Custom Images tab, enter image-test in the search box for exact match.
  5. Click the More icon icon and choose More > Restore in the Actions column that corresponds to image2.
  6. Available is displayed in the Status column that corresponds to image2.
    image2 is restored to the latest available custom image. You can call the DescribeImageFromFamily operation to query the latest available custom image in the specified image family.
  7. Call the DescribeImageFromFamily operation to query the latest available custom image in the specified image family.
    In this example, the latest image in the image-test image family is queried. Specify the following API request parameters:
    • RegionId: Specify the region ID of the image family.
    • ImageFamily: Specify the image family name. In this example, the name image-test is used.
    The following figure shows a sample response. The name of the latest available custom image is displayed as image2. image2