Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment utiliser la réplication entre buckets, qui utilise le service de transfert de stockage pour copier de manière asynchrone des objets nouveaux et mis à jour d'un bucket source vers un bucket de destination. Lorsque vous utilisez la réplication entre buckets, vous créez et gérez des jobs de réplication, qui sont un type de jobs dans le service de transfert de stockage.
Avant de commencer
Pour utiliser la réplication entre buckets, vous devez effectuer les étapes préalables. Pour obtenir des instructions, consultez la section Avant de commencer de la documentation du service de transfert de stockage.
Créer un job de réplication
Console
Lorsque vous créez un job de réplication entre buckets à l'aide de la consoleGoogle Cloud , le rôle storage.legacyBucketOwner est automatiquement attribué à l'agent de service du service de transfert de stockage sur le bucket source, et le rôle storage.legacyBucketWriter sur le bucket de destination.
Lorsque vous utilisez la console Google Cloud , vous pouvez créer un job de réplication pour des buckets existants ou pour de nouveaux buckets lors du processus de création de bucket.
Pour créer un job de réplication pour un nouveau bucket, suivez les instructions de création d'un bucket.
Pour créer un job de réplication pour un bucket existant, procédez comme suit :
Dans la console Google Cloud , accédez à la page Buckets de Cloud Storage.
Dans la liste des buckets, cliquez sur le nom du bucket source dont vous souhaitez répliquer les objets.
Sur la page Informations sur le bucket, cliquez sur l'onglet Configuration.
Recherchez l'option Réplication entre buckets, puis cliquez sur editModifier.
Dans le volet Modifier la réplication entre buckets qui s'ouvre, cliquez sur Ajouter une destination.
Dans la section Choisir une destination, sélectionnez un bucket de destination, puis cliquez sur Suivant.
Dans la section Sélectionner les paramètres de réplication, procédez comme suit :
Facultatif : Pour filtrer les objets à répliquer en fonction du préfixe de leur nom, cochez la case Répliquer les objets en fonction du préfixe dans la section Choisir les objets à répliquer.
Pour inclure des objets par préfixe, saisissez un préfixe dans la section Inclure les objets avec un préfixe, puis cliquez sur addAjouter un préfixe.
Pour exclure des objets par préfixe, saisissez un préfixe dans la section Exclure les objets avec un préfixe, puis cliquez sur addAjouter un préfixe.
Facultatif : Pour définir une classe de stockage pour les objets répliqués, sélectionnez une classe de stockage dans le menu de la section Définir la classe de stockage pour les objets répliqués.
Si vous ignorez cette étape, les objets répliqués utilisent la classe de stockage du bucket de destination par défaut.
Vous ne pouvez pas lister les jobs de réplication à l'aide de la console Google Cloud . Consultez Afficher un job de réplication pour savoir comment afficher un seul job de réplication à la fois.
Dans la liste des buckets, cliquez sur le nom du bucket source dont vous souhaitez afficher le job de réplication entre buckets.
Sur la page Informations sur le bucket, cliquez sur l'onglet Configuration.
Recherchez l'option Réplication entre buckets, puis cliquez sur editModifier.
Le volet Modifier la réplication entre les buckets s'ouvre et affiche le job de réplication pour chaque bucket de destination.
Sur la page Buckets, vous pouvez consulter la colonne Réplication, qui indique si un bucket exécute un job de réplication Turbo ou un job de réplication entre buckets. Pour savoir comment afficher la colonne Réplication, consultez Afficher des colonnes.
Dans la liste des buckets, cliquez sur le nom du bucket source dont vous souhaitez suspendre ou réactiver la réplication.
Sur la page Informations sur le bucket, cliquez sur l'onglet Configuration.
Recherchez l'option Réplication entre buckets, puis cliquez sur editModifier.
Dans le volet Modifier la réplication entre les buckets, cliquez sur pauseSuspendre ou sur play_arrowRéactiver à côté du job de réplication que vous souhaitez mettre à jour.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/05 (UTC)."],[],[],null,["# Use cross-bucket replication\n\nThis page describes how to use [cross-bucket replication](/storage/docs/availability-durability#cross-bucket-replication), which uses\n[Storage Transfer Service](/storage-transfer/docs/overview) to copy new and updated objects asynchronously from a\nsource bucket to a destination bucket. When you use cross-bucket replication,\nyou create and manage replication jobs, which are a type of job in\nStorage Transfer Service.\n\nBefore you begin\n----------------\n\nTo use cross-bucket replication, you must complete prerequisite steps. For\ninstructions, refer to [Before you begin](/storage-transfer/docs/cross-bucket-replication#before-you-begin) in the Storage Transfer Service\ndocumentation.\n\nCreate a replication job\n------------------------\n\n### Console\n\nWhen you create a cross-bucket replication job using the\nGoogle Cloud console, the Storage Transfer Service service agent is\nautomatically granted the `storage.legacyBucketOwner` role on the source\nbucket and the `storage.legacyBucketWriter` role on the destination\nbucket.\n\nWhen using the Google Cloud console, you can create a replication job for\nexisting buckets or for new buckets during the bucket creation process.\n\nTo create a replication job for a new bucket, follow the instructions for\n[creating a new bucket](/storage/docs/creating-buckets#create-bucket).\n\nTo create a replication job for an existing bucket, complete the following\nsteps:\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. In the list of buckets, click the name of the source bucket whose objects\n you want to replicate.\n\n3. On the **Bucket details** page, click the **Configuration** tab.\n\n4. Locate the **Cross-bucket replication** option and click\n edit **Edit**.\n\n5. In the **Edit cross-bucket replication** pane that opens, click\n **Add a destination**.\n\n6. In the **Choose a destination** section, select a destination bucket,\n then click **Next**.\n\n7. In the **Choose replication settings** section, do the following:\n\n - Optional: To filter objects to replicate by object name prefix,\n select the **Replicate objects based on prefix** checkbox in the\n **Choose which objects to replicate** section.\n\n - To include objects by prefix, enter a prefix in the\n **Include objects with prefix** section, then\n click add **Add a prefix**.\n\n - To exclude objects by prefix, enter a prefix in the\n **Exclude objects with prefix** section, then click\n add **Add a prefix**.\n\n - Optional: To set a storage class for replicated objects, select a\n storage class from the menu in the\n **Set storage class for replicated objects** section.\n\n If you skip this step, replicated objects use the destination bucket's\n storage class by default.\n\n 1. Click **Save**.\n\n### Command line\n\nFor Google Cloud CLI instructions on how to create a replication job,\nrefer to [Create a replication job using the Google Cloud CLI](/storage-transfer/docs/cross-bucket-replication#create-replication-job).\n\n### REST APIs\n\n### JSON API\n\nFor JSON API instructions on how to create a replication job,\nrefer to [Create a replication job using the JSON API](/storage-transfer/docs/cross-bucket-replication#create-replication-job).\n\nTo check the status of the replication job,\n[view Cloud Logging for Storage Transfer Service logs](/storage-transfer/docs/transfer-logs#view-logs).\n\nList replication jobs\n---------------------\n\n### Console\n\nYou cannot list replication jobs using the Google Cloud console. See\n[View replication job](#view-replication-job) for instructions on how to view a single\nreplication job at a time.\n\n### Command line\n\nFor Google Cloud CLI instructions on how to list replication jobs,\nrefer to [List replication jobs using the Google Cloud CLI](/storage-transfer/docs/cross-bucket-replication#list-replication-jobs).\n\n### REST APIs\n\n### JSON API\n\nFor JSON API instructions on how to list replication jobs,\nrefer to [List replication jobs using the JSON API](/storage-transfer/docs/cross-bucket-replication#list-replication-jobs).\n\nView a replication job\n----------------------\n\n### Console\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. In the list of buckets, click the name of the source bucket whose\n cross-bucket replication job you want to view.\n\n3. On the **Bucket details** page, click the **Configuration** tab.\n\n4. Locate the **Cross-bucket replication** option and click\n edit **Edit**.\n\n The **Edit cross-bucket replication** pane appears, which displays\n the replication job for each destination bucket.\n\nOn the **Buckets** page, you can view the **Replication** column, which\ndisplays whether a bucket has a Turbo replication job or a cross-bucket\nreplication job running. For instructions on displaying the **Replication**\ncolumn, see [Show columns](/storage/docs/cloud-console#show-columns).\n\n### Command line\n\nFor Google Cloud CLI instructions on how to view a replication job,\nrefer to [View a replication job using the Google Cloud CLI](/storage-transfer/docs/cross-bucket-replication#view-replication-job).\n\n### REST APIs\n\n### JSON API\n\nFor JSON API instructions on how to view a replication job,\nrefer to [View a replication job using the JSON API](/storage-transfer/docs/cross-bucket-replication#view-replication-job).\n\nUpdate a replication job\n------------------------\n\nYou can update the following fields of a replication job:\n\n- The description of the replication job\n\n- The configuration for running a replication job\n\n- The configuration of notifications published to Pub/Sub\n\n- The logging behavior for replication job operations\n\n- The status of the replication job (whether it's enabled, disabled, or deleted)\n\n### Console\n\nWhen using the Google Cloud console, you can only update a replication\njob by pausing or unpausing the job.\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. In the list of buckets, click the name of the source bucket that\n you want to pause or unpause replicating.\n\n3. On the **Bucket details** page, click the **Configuration** tab.\n\n4. Locate the **Cross-bucket replication** option and click\n edit **Edit**.\n\n5. In the **Edit cross-bucket replication** pane that appears, click\n pause **Pause** or\n play_arrow **Unpause** next to the\n replication job you want to update.\n\n### Command line\n\nFor Google Cloud CLI instructions on how to update a replication job,\nrefer to [Update a replication job using the Google Cloud CLI](/storage-transfer/docs/cross-bucket-replication#update-replication-job).\n\n### REST APIs\n\n### JSON API\n\nFor JSON API instructions on how to update a replication job,\nrefer to [Update a replication job using the JSON API](/storage-transfer/docs/cross-bucket-replication#update-replication-job).\n\nDelete a replication job\n------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page. \n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. In the list of buckets, click the name of the source bucket you\n want to stop replicating.\n\n3. On the **Bucket details** page, click the **Configuration** tab.\n\n4. Locate the **Cross-bucket replication** option and click\n edit **Edit**.\n\n5. In the **Edit cross-bucket replication** pane that appears, click\n delete **Delete** next to the\n replication job you want to delete.\n\n6. In the dialogue that appears, click **Confirm**.\n\n### Command line\n\nFor Google Cloud CLI instructions on how to delete a replication job,\nrefer to [Delete a replication job using the Google Cloud CLI](/storage-transfer/docs/cross-bucket-replication#delete-replication-job).\n\n### REST APIs\n\n### JSON API\n\nFor JSON API instructions on how to delete a replication job,\nrefer to [Delete a replication job using the JSON API](/storage-transfer/docs/cross-bucket-replication#delete-replication-job).\n\nWhat's next\n-----------\n\n[Monitor your replicated objects](/storage/docs/monitoring#cross-bucket_replication_graphs)."]]