Listing Recently Deleted Buckets

Hello, I was wondering if it’s possible to list out all buckets that have been deleted within a 24h time window. I would like to do this in a cloud function. So I was wondering which API to use and which method would work best. Thank you!

1 Like

Hi @IsaacShoong ,

Welcome to Google Cloud Community!

To list recently deleted buckets in Google Cloud, you can use the Cloud Logging API’s locations.buckets.undelete method. This method allows you to restore deleted buckets within a seven-day grace period.

The steps involved are:

  • Enable Cloud Logging for your project.
  • Identify the name of the bucket you want to undelete.
  • Construct the API request using the locations.buckets.undelete method.
  • Execute the API request.
  • Verify that the bucket has been recovered

Note: this method only works within the seven-day grace period after deletion.

1 Like

This only works for restoring logging buckets, not cloud storage buckets. For that you would need to contact GCP support.

1 Like