Rebuild the whole bucket

I have several buckets in Google Cloud Storage, and I assume that my lifecycle file was not configured correctly, because all my buckets are now empty.

{
  "lifecycle": {
    "rule": [
      {
        "action": {"type": "Delete"},
        "condition": {
          "age": 60,
          "isLive": false
        }
      },
      {
        "action": {"type": "Delete"},
        "condition": {
          "numNewerVersions": 3 
        }
      }
    ]
  }
}

Since I have version control turned on and I see the files using ls -lain the bucket, is there a way to recover ALL files and how can I delete them again?

+4
source share
1 answer

Given the lifecycle configuration above, your living objects should not be deleted, at least not through the GCS lifecycle management process.

, , , gsutil :

$ gsutil mb gs://mynewbucket

# This step is only necessary if you want to keep all archived versions.
$ gsutil versioning set on gs://mynewbucket

$ gsutil cp -r -A gs://oldbucket/* gs://mynewbucket

, . , ( ). , , , , , .

0

Source: https://habr.com/ru/post/1677387/


All Articles