Remediation
Migrate Google Cloud Storage Bucketsβ
The migration depends on the size of the data to transfer:
- Option 1: Use
gcloud
(for transfers < 1 TB) - Option 2: Use Storage Transfer Service (for transfers β₯ 1 TB)
Determine Transfer Strategyβ
New bucket name:
- Applications must be updated to point to
{{destination-bucket}}
. - Steps: copy data β update applications β verify β delete original bucket.
Keep bucket name:
- Use a temporary bucket
{{temp-bucket}}
. - Steps: copy data β downtime β delete original bucket β create new bucket with same name β copy data from temporary bucket β delete temporary bucket β verify.
Note: Bucket names must be globally unique. When retaining the same name, create the new bucket immediately after deleting the old one.
From gcloud CLI (< 1 TB)β
Use this option when your data is small enough to be handled efficiently via gcloud
CLI.
Create the Destination Bucketβ
gcloud storage buckets create gs://{{destination-bucket}} \
--location={{target-region}} \
--storage-class={{storage-class}}
Copy Data to the New Bucketβ
gcloud storage cp --recursive gs://{{source-bucket}}/* gs://{{destination-bucket}}
- Include
--include-managed-folders
if your bucket uses managed folders.
Verify Dataβ
- Compare object counts, sizes, and metadata between source and destination buckets.
Update Applicationsβ
- Update all applications, scripts, and services to use the new bucket name.
- Confirm proper access via Cloud Audit Logs.
Delete the Original Bucketβ
gcloud storage rm --recursive gs://{{source-bucket}}
Or, delete the contents from the source bucket without deleting the source bucket itself:
gcloud storage rm --all-versions gs://{{source-bucket}}/**
Use Storage Transfer Service (β₯ 1 TB)β
Use this option for large-scale transfers, as it provides managed reliability, performance, and security.
Grant IAM Permissionsβ
gcloud storage buckets add-iam-policy-binding gs://{{destination-bucket}} \
--member=serviceAccount:{{project-id}}@storage-transfer-service.iam.gserviceaccount.com \
--role=roles/storage.admin
Create a Storage Transfer Jobβ
gcloud transfer jobs create gs://{{source-bucket}} gs://{{destination-bucket}}
Verify Transferβ
- Check that objects, versions, and metadata are copied correctly.
- Review Cloud Logging for transfer success and errors.
Update Applicationsβ
- Point applications and workloads to
{{destination-bucket}}
. - Verify proper access via Cloud Audit Logs.
Delete Original Bucketβ
- Use
deleteObjectsFromSourceAfterTransfer=true
in the transfer job, or manually usinggcloud storage rm
.