Delete and restore projects (original) (raw)

This page explains how to shut down and restore Google Cloud projects. Understand the 30-day recovery window, resource deletion timelines, and how to prevent data loss.

Shut down (delete) a project

Shutting down a project stops all billing and resource usage. This action immediately moves the project into a 30-day recovery period, after which the project and all associated data are permanently deleted. Only projects with a lifecycle state ofACTIVE can be shut down.

Deletion process and timeline

When you initiate a shutdown, the following events occur:

  1. Immediate shutdown: The project is immediately marked for deletion and becomes unusable.
  2. Notification: Google Cloud sends a notification email to the user who initiated the deletion and to any contacts listed in the Technical category of Essential Contacts.
  3. Billing disconnection: Any associated Cloud Billing account is disconnected. This association isn't automatically reinstated if the project is later restored.
  4. 30-day recovery window: The project remains in a DELETE_REQUESTED state for 30 days. During this period, project owners can restore the project.
  5. Permanent deletion: After 30 days, the project and all its resources are permanently deleted and can't be recovered.

Critical considerations

Before shutting down a project, review the following risks:

Safeguards

To prevent accidental deletion of business-critical projects, you can enablechange risk recommendations. These recommendations provide warnings when you attempt to delete projects that Google Cloud has identified as important based on recent activity.

To learn more about data retention and safe deletion, see How Google retains data we collect.

You can shut down projects using the Google Cloud console, Google Cloud CLI, or the API.

Console

  1. In the Google Cloud console, go to the IAM & Admin Settings page.
    Go to IAM & Admin Settings
    The remaining steps appear in the Google Cloud console.
  2. On the IAM & Admin Settings page, select the project you want to delete, and then click Shut down.
    Shut down only appears for users who have the resourcemanager.projects.delete permission in the current project.
  3. Click Shut down.
  4. Enter the project ID, and then click Shut down anyway.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.
    Activate Cloud Shell
    At the bottom of the Google Cloud console, aCloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
  2. To delete a project, use thegcloud projects delete command:
gcloud projects delete PROJECT_ID  

Where PROJECT_ID is the ID of the project you want to delete.

REST

The following code snippet deletes the specified project:

Request:

DELETE https://cloudresourcemanager.googleapis.com/v3/projects/my-project-123

Troubleshoot project deletion

If you encounter issues while attempting to shut down or restore a project, it's typically due to permission constraints or specific resource "liens." For information, see Troubleshoot project deletion.

Restore a project

Project owners can restore a deleted project within the 30-day recovery period that begins when the project is shut down.

Restoring a project returns it to its state prior to shutdown, with the following exceptions:

To restore a project, you must have the resourcemanager.projects.undelete permission on the project. To view projects pending deletion in the console, you also need the following permissions:

To restore a project, use one of the following methods:

Console

  1. In the Google Cloud console, go to the Manage resources page.
    Go to Manage resources
  2. In the Project picker at the top of the page, select your organization resource.
  3. Below the list of organization resources, folders, and projects, clickResources pending deletion.
  4. Select the checkbox for the project you want to restore, and then clickRestore. In the dialog that appears, confirm that you want to restore the project.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.
    Activate Cloud Shell
    At the bottom of the Google Cloud console, aCloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
  2. To restore a project, use thegcloud projects undeletecommand:
gcloud projects undelete PROJECT_ID  

PROJECT_ID is the project ID or project number of the project you want to restore.

REST

The following code snippet restores the specified project:

Request:

POST https://cloudresourcemanager.googleapis.com/v3/projects/my-project-123:undelete

What's next