# GetBucketReplication

{% hint style="info" %}
**Note**

It can take a while to propagate the put or delete a replication configuration to all Petabox systems. Therefore, a get request soon after put or delete can return a wrong result.
{% endhint %}

This action requires permissions for the `s3:GetReplicationConfiguration` action.&#x20;

If you include the `Filter` element in a replication configuration, you must also include the `DeleteMarkerReplication` and `Priority` elements. The response also returns those elements.

## Request Syntax <a href="#api_getbucketreplication_requestsyntax" id="api_getbucketreplication_requestsyntax"></a>

```http
GET /?replication HTTP/1.1
Host: Bucket.s3.petabox.io
x-amz-expected-bucket-owner: ExpectedBucketOwner
```

## URI Request Parameters <a href="#api_getbucketreplication_requestparameters" id="api_getbucketreplication_requestparameters"></a>

The request uses the following URI parameters.

#### Bucket

The bucket name for which to get the replication information.

Required: Yes

#### x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code `403 Forbidden` (access denied).

## Request Body <a href="#api_getbucketreplication_requestbody" id="api_getbucketreplication_requestbody"></a>

The request does not have a request body.

## Response Syntax <a href="#api_getbucketreplication_responsesyntax" id="api_getbucketreplication_responsesyntax"></a>

```xml
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<ReplicationConfiguration>
   <Role>string</Role>
   <Rule>
      <DeleteMarkerReplication>
         <Status>string</Status>
      </DeleteMarkerReplication>
      <Destination>
         <AccessControlTranslation>
            <Owner>string</Owner>
         </AccessControlTranslation>
         <Account>string</Account>
         <Bucket>string</Bucket>
         <EncryptionConfiguration>
            <ReplicaKmsKeyID>string</ReplicaKmsKeyID>
         </EncryptionConfiguration>
         <Metrics>
            <EventThreshold>
               <Minutes>integer</Minutes>
            </EventThreshold>
            <Status>string</Status>
         </Metrics>
         <ReplicationTime>
            <Status>string</Status>
            <Time>
               <Minutes>integer</Minutes>
            </Time>
         </ReplicationTime>
         <StorageClass>string</StorageClass>
      </Destination>
      <ExistingObjectReplication>
         <Status>string</Status>
      </ExistingObjectReplication>
      <Filter>
         <And>
            <Prefix>string</Prefix>
            <Tag>
               <Key>string</Key>
               <Value>string</Value>
            </Tag>
            ...
         </And>
         <Prefix>string</Prefix>
         <Tag>
            <Key>string</Key>
            <Value>string</Value>
         </Tag>
      </Filter>
      <ID>string</ID>
      <Prefix>string</Prefix>
      <Priority>integer</Priority>
      <SourceSelectionCriteria>
         <ReplicaModifications>
            <Status>string</Status>
         </ReplicaModifications>
         <SseKmsEncryptedObjects>
            <Status>string</Status>
         </SseKmsEncryptedObjects>
      </SourceSelectionCriteria>
      <Status>string</Status>
   </Rule>
   ...
</ReplicationConfiguration>
```

## Response Elements <a href="#api_getbucketreplication_responseelements" id="api_getbucketreplication_responseelements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

#### ReplicationConfiguration

Root level tag for the ReplicationConfiguration parameters.

Required: Yes

#### Role

The Resource Name of the Identity and Access Management role that Petabox assumes when replicating objects.

Type: String

#### Rule

A container for one or more replication rules. A replication configuration must have at least one rule and can contain a maximum of 1,000 rules.

Type: Array of ReplicationRule data types

## Examples <a href="#api_getbucketreplication_examples" id="api_getbucketreplication_examples"></a>

### Sample Request: Retrieve replication configuration information <a href="#api_getbucketreplication_example_1" id="api_getbucketreplication_example_1"></a>

The following GET request retrieves information about the replication configuration set for the `examplebucket` bucket:

```http
GET /?replication HTTP/1.1
Host: examplebucket.s3.<Region>.petabox.io
Date: Tue, 10 Feb 2015 00:17:21 GMT
Authorization: authorization string
```

### Sample Response <a href="#api_getbucketreplication_example_2" id="api_getbucketreplication_example_2"></a>

The following response shows that replication is enabled on the bucket. The empty prefix indicates that Petabox will replicate all objects that are created in the `examplebucket` bucket. The `Destination` element identifies the target bucket where Petabox creates the object replicas, and the storage class (STANDARD\_IA) that Petabox uses when creating replicas.

Petabox assumes the specified IAM role to replicate objects on behalf of the bucket owner, which is the account that created the bucket.

```xml
HTTP/1.1 200 OK
x-amz-id-2: ITnGT1y4RyTmXa3rPi4hklTXouTf0hccUjo0iCPjz6FnfIutBj3M7fPGlWO2SEWp
x-amz-request-id: 51991C342example
Date: Tue, 10 Feb 2015 00:17:23 GMT
Server: Amazon S3
Content-Length: contentlength

<?xml version="1.0" encoding="UTF-8"?>
<ReplicationConfiguration>
  <Role>arn:aws:iam::35667example:role/CrossRegionReplicationRoleForS3</Role>
 <Rule>
   <ID>rule1</ID>
   <Status>Enabled</Status>
   <Priority>1</Priority>
   <DeleteMarkerReplication>
       <Status>Disabled</Status>
   </DeleteMarkerReplication>
   <Filter>
      <And>
           <Prefix>TaxDocs</Prefix>
           <Tag>
             <Key>key1</Key>
             <Value>value1</Value>
           </Tag>
           <Tag>
           <Key>key1</Key>
            <Value>value1</Value>
          </Tag>
      </And>
    </Filter>
   <Destination>
      <Bucket>arn:aws:s3:::exampletargetbucket</Bucket>
   </Destination>
  </Rule>
</ReplicationConfiguration>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petabox.io/http-api-compatible-with-amazon-s3/api-reference/getbucketreplication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
