Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

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 2 1,827
2 REPLIES 2

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.

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