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
- If you want to use the command-line examples in this guide, do the following:
- Install or update to the latest version of the Google Cloud CLI.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
- Read the Images document.
Deprecate a custom image
Console
In the Google Cloud console, go to the Images page.
For the image you want to deprecate, click
Actions.Select Deprecate.
For state, select either Deprecated or Obsolete. For more information about states, see Deprecation states.
Optional: Specify a replacement image.
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 deprecateSTATE
: the deprecation stateREPLACEMENT
: the image to replace the one that is deprecated
API
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.