Deprecate a custom image


Compute Engine lets you deprecate a custom image that you own by setting the deprecation status on the image. Each deprecation status causes a different response from the server, helping you transition users away from unsupported images in a manageable way. Use the Google Cloud console, the Google Cloud CLI, or the Compute Engine API method to deprecate an image.

Deprecation states

The following deprecation states are supported:

  • ACTIVE: the image is active and can be used as normal. Image families point to the most recent and active image in a family.
  • DEPRECATED: the image is marked deprecated but can still be used to create a VM. New links to this image are allowed. Image families no longer point to this image even if it is the most recent image in the family.

    If you create a VM with a deprecated image using the Google Cloud CLI, the request succeeds with a warning.

  • OBSOLETE: the image is marked obsolete and is no longer available for use. An error message is returned if you try to use this image in a request. Existing links to this image are still allowed.

  • DELETED: this image is deleted. An error message is returned if you try to use a deleted image.

You can revert a deprecation (make an image active again), by changing the deprecation state to ACTIVE.

Before you begin

  • Read the Images document.
  • If you haven't already, set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine as follows.

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

    REST

    To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

      Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init

Deprecate a custom image

Console

  1. In the Google Cloud console, go to the Images page.

    Go to Images

  2. For the image you want to deprecate, click Actions.

  3. Select Deprecate.

  4. For state, select either Deprecated or Obsolete. For more information about states, see Deprecation states.

  5. Optional: Specify a replacement image.

  6. Click Deprecate Image.

gcloud

Use the gcloud compute images deprecate command to set the deprecation status of an image.

gcloud compute images deprecate IMAGE_NAME \
    --state STATE \
    --replacement REPLACEMENT

Replace the following:

  • IMAGE_NAME: the name of the image to deprecate
  • STATE: the deprecation state
  • REPLACEMENT: the image to replace the one that is deprecated

REST

Make a POST request to the images().deprecate method. Specify the name of the image you want to deprecate.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images/RESOURCE_ID/deprecate

{
  "state": "STATE",
  "replacement": "REPLACEMENT"
}

Replace the following:

  • PROJECT_ID: the project to which the image belongs.
  • RESOURCE_ID: the name of the image that you are deprecating.
  • STATE: the deprecation state of this resource.
  • REPLACEMENT: the image to replace the one that is deprecated.