Move data between buckets

This page describes how to move the contents of a bucket by copying objects froma source bucket to a destination bucket.

Overview

When you create a bucket, some of the properties you set are permanent andcannot be changed, including the bucket's name and its parent project.

If you want to use a new name for your bucket, you caneffectively do so bycreating a new bucket with the name you want to use, and then copying yourobjects from the old bucket to the new bucket. You can thendelete theold bucket. Note the following:

Required permissions

Console

In order to complete this guide using theGoogle Cloud console, you musthave the proper IAM permissions. If the buckets you want toaccess exist in a project that you did not create, you might need theproject owner to give you a role that contains the necessary permissions.

For a list of permissions required for specific actions, seeIAMpermissions for the Google Cloud console.

For a list of relevant roles, seeCloud Storage roles.Alternatively, you cancreate a custom role that hasspecific, limited permissions.

Command line

In order to complete this guide using a command-line utility, you musthave the proper IAM permissions. If the buckets you want toaccess exist in a project that you did not create, you might need theproject owner to give you a role that contains the necessary permissions.

For a list of permissions required for specific actions, seeIAMpermissions forgcloud storage commands.

For a list of relevant roles, seeCloud Storage roles.Alternatively, you cancreate a custom role that hasspecific, limited permissions.

REST APIs

JSON API

In order to complete this guide using theJSON API, you must havethe proper IAM permissions. If the buckets you want toaccess exist in a project that you did not create, you might needthe project owner to give you a role that contains the necessarypermissions.

For a list of permissions required for specific actions, seeIAMpermissions for JSON methods.

For a list of relevant roles, seeCloud Storage roles.Alternatively, you cancreate a custom role that hasspecific, limited permissions.

Move data from one bucket to another

Console

Use theStorage Transfer Service from within Google Cloud console:

  1. If you don't have a destination bucket yet,create the bucket.
  2. Open the Transfer page in the Google Cloud console.

    Open theTransfer page

  3. ClickCreate transfer job.
  4. Follow the step-by-step walkthrough, clickingNext step as youcomplete each step:

    • Choose a source: UseGoogle Cloud Storage bucket as your sourcetype, and either enter the name of the wanted bucket directly, orclickBrowse to find and select the bucket you want.

    • Choose a destination: Either enter the name of the wanted bucketdirectly, or clickBrowse to find and select the bucket you want.

    • Choose settings: Select the optionDelete files from source afterthey're transferred.

    • Scheduling options: You can ignore this section.

  5. After you complete the step-by-step walkthrough, clickCreate.

    This begins the process of copying objects from your old bucket intoyour new one. This process may take some time; however, after you clickCreate, you can navigate away from the Google Cloud console.

    To view the transfer's progress:

    Open the Transfer page in the Google Cloud console.

    Open theTransfer page

    To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, seeTroubleshooting.

  6. Once the transfer completes, you don't need to do anything to delete theobjects from your old bucket if you selected theDelete source objectsafter the transfer completes checkbox during setup. You may, however,want to alsodelete your old bucket, which you must do separately.

Command line

  1. If you don't have one yet,create a destination bucket.

  2. To recursively copy the contents of your source bucket to yourdestination bucket, use thegcloud storage cp command withthe--recursive option:

    gcloud storage cp --recursive gs://SOURCE_BUCKET/* gs://DESTINATION_BUCKET

    Where:

    • SOURCE_BUCKET is the name of your originalbucket. For example,old-bucket.

    • DESTINATION_BUCKET is the name of thebucket you are moving your data to. For example,my-bucket.

    If your bucket usesmanaged folders and aflat namespace,you must include the flag--include-managed-folders in the commandfor the managed folders to be copied.

  3. To recursively delete the contents from the source bucket, along withthe source bucket itself, use thegcloud storage rm commandwith the--recursive option:

    gcloud storage rm --recursive gs://SOURCE_BUCKET

    WhereSOURCE_BUCKET is the name of youroriginal bucket. For example,old-bucket.

    Alternatively, to delete the contents from the source bucket withoutdeleting the source bucket itself, use thegcloud storage rm commandwith the--all-versions flag and** wildcard:

    gcloud storage rm --all-versions gs://SOURCE_BUCKET/**

    WhereSOURCE_BUCKET is the name of youroriginal bucket. For example,old-bucket.

REST APIs

JSON API

  1. If you don't have a destination bucket yet,create the bucket.

  2. Copy each object from your source bucket to the destinationbucket.

  3. Delete each object in your source bucket.

  4. Delete your source bucket.

XML API

  1. If you don't have a destination bucket yet,create the bucket.

  2. Copy each object from your source bucket to the destinationbucket.

  3. Delete each object in your source bucket.

  4. Delete your source bucket.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.