When you create a bucket, you permanently define its name, its geographic location, and the project it is part of. However, you can effectively move or rename your bucket:
If there is no data in your old bucket, delete the bucket and create another bucket with a new name, in a new location, or in a new project.
If you have data in your old bucket, create a new bucket with the desired name, location, and/or project, copy data from the old bucket to the new bucket, and delete the old bucket and its contents. The steps below describe this process.
If you want your new bucket to have the same name as your old bucket, you must temporarily move your data to a bucket with a different name. This lets you delete the original bucket so that you can reuse the bucket name.
Moving data between locations incurs network usage costs. In addition, moving data between buckets may incur retrieval and early deletion fees, if the data being moved are Nearline Storage, Coldline Storage, or Archive Storage objects.
To move your data from one bucket to another:
Console
Use the Cloud Storage Transfer Service from within Google Cloud Console:
- If you don't have a destination bucket yet, create the bucket.
- Open the Transfer page in the Google Cloud Console.
- Click Create transfer job.
Follow the step-by-step walkthrough, clicking Continue as you complete each step:
Select Source: Use Google Cloud Storage Bucket as your selected source, and click Browse to find and select the bucket you want to move your objects out of.
Select Destination: Click Browse to find and select the bucket you want to move your objects into.
Additionally, select the checkbox Delete source objects after the transfer completes.
Configure Transfer: You can ignore this section.
After you complete the step-by-step walkthrough, click Create.
This begins the process of copying objects from your old bucket into your new one. This process may take some time; however, after you click Create, you can navigate away from the Google Cloud Console.
To view the transfer's progress: Open the Transfer page in the Google Cloud Console.
To learn how to get detailed error information about failed operations in the Cloud Storage browser, see Troubleshooting.
Once the transfer completes, you don't need to do anything to delete the objects from your old bucket if you selected the Delete source objects after the transfer completes checkbox during setup. You may, however, want to also delete your old bucket, which you must do separately.
gsutil
- If you don't have a destination bucket yet, create the bucket.
Use the
gsutil cp
command, with the-r
option, to recursively copy all your objects from the source bucket to the destination bucket:gsutil cp -r gs://SOURCE_BUCKET/* gs://DESTINATION_BUCKET
Where:
SOURCE_BUCKET
is the name of your original bucket. For example,old-bucket
.DESTINATION_BUCKET
is the name of the bucket you are moving your data to. For example,my-bucket
.
Use the
gsutil rm
command, with the-r
option, to recursively delete all your objects from the source bucket, as well as the source bucket itself:gsutil rm -r gs://SOURCE_BUCKET
Where
SOURCE_BUCKET
is the name of your original bucket. For example,old-bucket
.Or, to delete the objects but keep the source bucket:
gsutil rm -a gs://SOURCE_BUCKET/**
REST APIs
JSON API
If you don't have a destination bucket yet, create the bucket.
Copy each object from your source bucket to the destination bucket.
Delete each object in your source bucket.
XML API
If you don't have a destination bucket yet, create the bucket.
Copy each object from your source bucket to the destination bucket.
Delete each object in your source bucket.
What's next
- Copy, rename, or move individual objects.
- Change the default storage class associated with a bucket.
- Add labels to your buckets.
- Learn about available bucket locations and bucket naming guidelines.
- Learn more about creating and managing data transfers with the Console.