Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara memindahkan konten bucket dengan menyalin objek dari bucket sumber ke bucket tujuan.
Ringkasan
Saat membuat bucket, beberapa properti yang Anda tetapkan bersifat permanen dan tidak dapat diubah, termasuk nama bucket dan project tempatnya berada.
Namun, Anda dapat secara efektif memindahkan atau mengganti nama bucket:
Jika Anda memiliki data di bucket lama, buat bucket baru dengan properti yang Anda inginkan, salin data dari bucket lama ke bucket baru, lalu hapus bucket lama beserta isinya. Langkah-langkah di halaman ini menjelaskan proses ini.
Jika ingin bucket baru memiliki nama yang sama dengan bucket lama, Anda harus memindahkan data ke bucket dengan nama yang berbeda untuk sementara. Langkah ini memungkinkan Anda menghapus bucket asli sehingga Anda dapat menggunakan kembali nama bucket.
Pemindahan data antar lokasi akan menimbulkan biaya penggunaan jaringan. Selain itu, memindahkan data dapat menimbulkan biaya tambahan, bergantung pada kelas penyimpanan data sumber dan lokasi bucket tujuan. Untuk mengetahui informasi selengkapnya, lihat harga Cloud Storage.
Izin yang diperlukan
Konsol
Untuk menyelesaikan panduan ini menggunakan konsolGoogle Cloud , Anda harus memiliki izin IAM yang sesuai. Jika bucket yang ingin Anda akses ada di project yang tidak Anda buat, pemilik project harus memberi Anda peran yang berisi izin yang diperlukan.
Untuk menyelesaikan panduan ini menggunakan utilitas command line, Anda harus memiliki izin IAM yang sesuai. Jika bucket yang ingin Anda akses ada di project yang tidak Anda buat, pemilik project harus memberi Anda peran yang berisi izin yang diperlukan.
Untuk menyelesaikan panduan ini menggunakan JSON API, Anda harus memiliki izin IAM yang sesuai. Jika bucket yang ingin Anda akses ada di project yang tidak Anda buat, pemilik project harus memberi Anda peran yang berisi izin yang diperlukan.
Ikuti panduan langkah demi langkah, dengan mengklik Langkah berikutnya saat Anda menyelesaikan setiap langkah:
Pilih sumber: Gunakan bucket Google Cloud Storage sebagai jenis sumber, lalu masukkan nama bucket yang diinginkan secara langsung, atau klik Jelajahi untuk menemukan lalu pilih bucket yang Anda inginkan.
Pilih tujuan: Masukkan nama bucket yang diinginkan secara langsung, atau klik Jelajahi untuk menemukan dan memilih bucket yang Anda inginkan.
Pilih setelan: Pilih opsi Hapus file dari sumber setelah file ditransfer.
Opsi penjadwalan: Anda dapat mengabaikan bagian ini.
Setelah menyelesaikan panduan langkah demi langkah, klik Buat.
Tindakan ini akan memulai proses penyalinan objek dari bucket lama ke bucket baru. Proses ini mungkin memakan waktu. Namun, setelah mengklik
Buat, Anda dapat keluar dari konsol Google Cloud .
Untuk mempelajari cara mendapatkan informasi error mendetail tentang operasi Cloud Storage yang gagal di Google Cloud konsol, lihat
Pemecahan masalah.
Setelah transfer selesai, Anda tidak perlu melakukan apa pun untuk menghapus objek dari bucket lama jika telah mencentang kotak Hapus objek sumber setelah transfer selesai selama penyiapan. Namun, Anda mungkin juga ingin menghapus bucket lama, yang harus dilakukan secara terpisah.
SOURCE_BUCKET adalah nama bucket asli Anda. Contoh, old-bucket.
DESTINATION_BUCKET adalah nama bucket tempat Anda memindahkan data. Contoh, my-bucket.
Jika bucket Anda menggunakan folder terkelola dan namespace datar,
Anda harus menyertakan tanda --include-managed-folders dalam perintah
agar folder terkelola dapat disalin.
Untuk menghapus konten dari bucket sumber secara berulang, beserta bucket sumber itu sendiri, gunakan perintah gcloud storage rm dengan opsi --recursive:
gcloud storage rm --recursive gs://SOURCE_BUCKET
Dengan SOURCE_BUCKET adalah nama bucket
asli Anda. Contoh, old-bucket.
Atau, untuk menghapus konten dari bucket sumber tanpa menghapus bucket sumber itu sendiri, gunakan perintah gcloud storage rm dengan flag --all-versions dan karakter pengganti **:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[],[],null,["# Move data between buckets\n\nThis page describes how to move the contents of a bucket by copying objects from\na source bucket to a destination bucket.\n\nOverview\n--------\n\nWhen you create a bucket, some of the properties you set are permanent and\ncannot be changed, including the bucket's name and its parent project.\n\nIf you want to use a new name for your bucket, you can *effectively* do so by\n[creating a new bucket](/storage/docs/creating-buckets) with the name you want to use, and then copying your\nobjects from the old bucket to the new bucket. You can then [delete](/storage/docs/deleting-buckets) the\nold bucket. Note the following:\n\n- When you delete a bucket, the [bucket's name can be reused](/storage/docs/buckets#considerations).\n\n | **Important:** If you create a new bucket with the same name as the original bucket but in a different location, requests made to the new bucket might fail with a `404-Bucket Not Found` error for up to 10 minutes after the deletion of the original bucket. For the [XML API](/storage/docs/xml-api), this behavior includes attempts to create the new bucket.\n- If your primary goal of moving objects from one bucket to another is to\n store your data in a different [bucket location](/storage/docs/locations), we recommend\n [directly relocating your bucket](/storage/docs/bucket-relocation/overview).\n\n- Moving data between locations incurs [network usage costs](/storage/pricing#network-buckets). In\n addition, moving data might incur additional charges, depending on the\n storage classes of the source data and on the location of the destination\n bucket. For more information, see [Cloud Storage pricing](/storage/pricing).\n\nRequired permissions\n--------------------\n\n### Console\n\nIn order to complete this guide using the [Google Cloud console](/storage/docs/cloud-console), you must\nhave the proper IAM permissions. If the buckets you want to\naccess exist in a project that you did not create, you might need the\nproject owner to give you a role that contains the necessary permissions.\n\nFor a list of permissions required for specific actions, see\n[IAM\npermissions for the Google Cloud console](/storage/docs/access-control/iam-console).\n\nFor a list of relevant roles, see\n[Cloud Storage roles](/storage/docs/access-control/iam-roles).\nAlternatively, you can\n[create a custom role](/iam/docs/creating-custom-roles) that has\nspecific, limited permissions.\n\n### Command line\n\nIn order to complete this guide using a command-line utility, you must\nhave the proper IAM permissions. If the buckets you want to\naccess exist in a project that you did not create, you might need the\nproject owner to give you a role that contains the necessary permissions.\n\nFor a list of permissions required for specific actions, see\n[IAM\npermissions for `gcloud storage` commands](/storage/docs/access-control/iam-gcloud).\n\nFor a list of relevant roles, see\n[Cloud Storage roles](/storage/docs/access-control/iam-roles).\nAlternatively, you can\n[create a custom role](/iam/docs/creating-custom-roles) that has\nspecific, limited permissions.\n\n### REST APIs\n\n### JSON API\n\nIn order to complete this guide using the [JSON API](/storage/docs/json_api), you must have\nthe proper IAM permissions. If the buckets you want to\naccess exist in a project that you did not create, you might need\nthe project owner to give you a role that contains the necessary\npermissions.\n\nFor a list of permissions required for specific actions, see\n[IAM\npermissions for JSON methods](/storage/docs/access-control/iam-json).\n\nFor a list of relevant roles, see\n[Cloud Storage roles](/storage/docs/access-control/iam-roles).\nAlternatively, you can\n[create a custom role](/iam/docs/creating-custom-roles) that has\nspecific, limited permissions.\n\nMove data from one bucket to another\n------------------------------------\n\n### Console\n\nUse the [Storage Transfer Service](/storage-transfer) from within Google Cloud console:\n\n1. If you don't have a destination bucket yet, [create the bucket](/storage/docs/creating-buckets).\n2. Open the Transfer page in the Google Cloud console.\n\n\n [Open\n the **Transfer** page](https://console.cloud.google.com/transfer/jobs)\n3. Click **Create transfer job**.\n4. Follow the step-by-step walkthrough, clicking **Next step** as you\n complete each step:\n\n - Choose a source: Use **Google Cloud Storage bucket** as your source\n type, and either enter the name of the wanted bucket directly, or\n click **Browse** to find and select the bucket you want.\n\n - Choose a destination: Either enter the name of the wanted bucket\n directly, or click **Browse** to find and select the bucket you want.\n\n - Choose settings: Select the option **Delete files from source after\n they're transferred**.\n\n - Scheduling options: You can ignore this section.\n\n5. After you complete the step-by-step walkthrough, click **Create**.\n\n This begins the process of copying objects from your old bucket into\n your new one. This process may take some time; however, after you click\n **Create**, you can navigate away from the Google Cloud console.\n\n To view the transfer's progress:\n\n Open the Transfer page in the Google Cloud console.\n\n\n [Open\n the **Transfer** page](https://console.cloud.google.com/transfer/jobs)\n\n \u003cbr /\u003e\n\n To learn how to get detailed error information about failed Cloud Storage\n operations in the Google Cloud console, see\n [Troubleshooting](/storage/docs/troubleshooting#trouble-console).\n6. Once the transfer completes, you don't need to do anything to delete the\n objects from your old bucket if you selected the **Delete source objects\n after the transfer completes** checkbox during setup. You may, however,\n want to also [delete your old bucket](/storage/docs/deleting-buckets), which you must do separately.\n\n### Command line\n\n1. If you don't have one yet, [create a destination bucket](/storage/docs/creating-buckets).\n\n2. To recursively copy the contents of your source bucket to your\n destination bucket, use the [`gcloud storage cp`](/sdk/gcloud/reference/storage/cp) command with\n the `--recursive` option:\n\n ```\n gcloud storage cp --recursive gs://SOURCE_BUCKET/* gs://DESTINATION_BUCKET\n ```\n\n Where:\n - \u003cvar translate=\"no\"\u003eSOURCE_BUCKET\u003c/var\u003e is the name of your original\n bucket. For example, `old-bucket`.\n\n - \u003cvar translate=\"no\"\u003eDESTINATION_BUCKET\u003c/var\u003e is the name of the\n bucket you are moving your data to. For example, `my-bucket`.\n\n If your bucket uses [managed folders](/storage/docs/managed-folders) and a [flat namespace](/storage/docs/objects#namespace),\n you must include the flag `--include-managed-folders` in the command\n for the managed folders to be copied.\n3. To recursively delete the contents from the source bucket, along with\n the source bucket itself, use the [`gcloud storage rm`](/sdk/gcloud/reference/storage/rm) command\n with the `--recursive` option:\n\n ```\n gcloud storage rm --recursive gs://SOURCE_BUCKET\n ```\n\n Where \u003cvar translate=\"no\"\u003eSOURCE_BUCKET\u003c/var\u003e is the name of your\n original bucket. For example, `old-bucket`.\n\n Alternatively, to delete the contents from the source bucket without\n deleting the source bucket itself, use the `gcloud storage rm` command\n with the `--all-versions` flag and `**` wildcard: \n\n ```\n gcloud storage rm --all-versions gs://SOURCE_BUCKET/**\n ```\n\n Where \u003cvar translate=\"no\"\u003eSOURCE_BUCKET\u003c/var\u003e is the name of your\n original bucket. For example, `old-bucket`.\n\n### REST APIs\n\n### JSON API\n\n1. If you don't have a destination bucket yet, [create the bucket](/storage/docs/creating-buckets).\n\n2. [Copy each object](/storage/docs/copying-renaming-moving-objects#copy) from your source bucket to the destination\n bucket.\n\n3. [Delete each object](/storage/docs/deleting-objects) in your source bucket.\n\n4. [Delete your source bucket](/storage/docs/deleting-buckets).\n\n### XML API\n\n1. If you don't have a destination bucket yet, [create the bucket](/storage/docs/creating-buckets).\n\n2. [Copy each object](/storage/docs/copying-renaming-moving-objects#copy) from your source bucket to the destination\n bucket.\n\n3. [Delete each object](/storage/docs/deleting-objects) in your source bucket.\n\n4. [Delete your source bucket](/storage/docs/deleting-buckets).\n\nWhat's next\n-----------\n\n- [Copy, rename, or move individual objects](/storage/docs/copying-renaming-moving-objects).\n\n- Learn about [available bucket locations](/storage/docs/locations) and\n [bucket naming guidelines](/storage/docs/buckets#considerations).\n\n- Learn more about [creating and managing data transfers with the Google Cloud console](/storage-transfer/docs/create-manage-transfer-console#configure)."]]