tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

PUT Bucket replication

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-12-15 10:07:36

Overview

This API is used to add a cross-bucket replication rule to a versioning-enabled bucket. Note that the existing cross-bucket replication rule (if any) will be overwritten.
Note:
To use this API, ensure that versioning is enabled for the bucket. For the API documentation of versioning, please see PUT Bucket versioning.
Objects in MAZ buckets cannot be replicated to an OAZ bucket. For example, objects in MAZ_STANDARD cannot be replicated to STANDARD.


Requests

Request example

PUT /?replication HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-MD5: MD5
Authorization: Auth String
request body
Note:
In Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, <BucketName-APPID> is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
Authorization: Auth String (See Request Signature for details.)

Request headers

This API only uses Common Request Headers.

Request body

You can set the cross-bucket replication configuration in the request body, which includes the rule status, priority, objects to replicate, filter scope, name and region of the destination bucket, and more.
<ReplicationConfiguration>
<Role>qcs::cam::uin/<OwnerUin>:uin/<SubUin></Role>
<Rule>
<Status></Status>
<ID></ID>
<Prefix></Prefix>
<Destination>
<Bucket>qcs::cos:<Region>::<BucketName-APPID></Bucket>
<StorageClass></StorageClass>
</Destination>
<DeleteMarkerReplication>
<Status></Status>
</DeleteMarkerReplication>
</Rule>
</ReplicationConfiguration>
The nodes are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required
ReplicationConfiguration
None
All replication configurations
Container
Yes
Role
ReplicationConfiguration
Request initiator identifier, formatted as qcs::cam::uin/<OwnerUin>:uin/<SubUin>
String
Yes
Rule
ReplicationConfiguration
Specific configuration. You can set a maximum of 1,000 rules.
Container
Yes
ID
ReplicationConfiguration.Rule
Name of a specific rule
String
No
Status
ReplicationConfiguration.Rule
Rule status identifier. Enumerated values: Enabled, Disabled.
String
Yes
Prefix
ReplicationConfiguration.Rule
Prefix of the object to be replicated
String
No
Destination
ReplicationConfiguration.Rule
Destination bucket information
Container
Yes
Bucket
ReplicationConfiguration.Rule.Destination
Resource identifier, formatted as qcs::cos:<Region>::<BucketName-APPID>
String
Yes
DeleteMarkerReplication
ReplicationConfiguration.Rule
Whether to sync the delete marker
Container
No
Status
ReplicationConfiguration.Rule. DeleteMarkerReplication
Whether to sync the delete marker. Valid values: Disabled, Enabled. Default value: Enabled.
String
No

Response

Response headers

This API only returns Common Response Headers.

Response body

The response body is empty.

Error codes

This API returns uniform error responses and error codes. For more information, see Error Codes.

Examples

Request

The following request adds a cross-bucket replication rule to the originbucket-1250000000 bucket. The ReplicationConfiguration specifies that all objects prefixed with testPrefix are to be replicated to the destinationbucket-1250000000 destination bucket in Guangzhou region.
PUT /?replication HTTP/1.1
Date: Mon, 28 Aug 2017 02:53:38 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1503888878;1503889238&q-key-time=1503888878;1503889238&q-header-list=host&q-url-param-list=replication&q-signature=254bf9cd3d6615e89a36ab652437f9d45c5f****
Content-MD5: AAq9nzrpsz5LJ4UEe1f6Q==
Host: originbucket-1250000000.cos.ap-guangzhou.myqcloud.com
Content-Length: 312

<ReplicationConfiguration>
<Role>qcs::cam::uin/100000000001:uin/100000000001</Role>
<Rule>
<Status>Enabled</Status>
<ID>RuleId_01</ID>
<Prefix>testPrefix</Prefix>
<Destination>
<Bucket>qcs::cos:ap-guangzhou::destinationbucket-1250000000</Bucket>
</Destination>
</Rule>
</ReplicationConfiguration>

Response

After the request above is made, COS returns the following response, indicating that the cross-bucket replication rule has been successfully configured.
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 0
Connection: keep-alive
Date: Fri, 14 Apr 2019 07:06:19 GMT
Server: tencent-cos
x-cos-bucket-region: ap-guangzhou
x-cos-request-id: NWQwMzQ3NmJfMjRiMjU4NjRfOTM4NV82ZDU1****
x-cos-trace-id: OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OWE4OGMxZjNjY2JiNTBmMTVmMWY1MzAzYzkyZGQ2ZWM4MzUyZTg1NGRhNWY0NTJiOGUyNTViYzgyNzgxZTEwOTY=


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan