# Keep a remote copy

Keep a copy of every object of a bucket on a storage cluster in another location, read from while the cluster is unavailable.

A bucket on a Deutsche Cloud storage cluster (see [Storage locations](storage-locations.md#own-storage))
can also keep a copy of every object in the platform store of the cluster's remote zone; the
answer's `zone` names it (for example `de1b`, Nuremberg). It is on by default for new buckets on a
storage cluster that has a remote zone. Replace _example-uploads_ with your bucket's name.

## Prerequisites

- Permission for `s3:PutBucketRemoteCopy` on the bucket (`s3:GetBucketRemoteCopy` to read it).
- The bucket is on a storage cluster that has a remote zone (`available: true` in
  `dcloud s3 bucket-remote-copy get`).

## Turn the remote copy on or off

**CLI**
```sh
dcloud s3 bucket-remote-copy set example-uploads --enabled
dcloud s3 bucket-remote-copy get example-uploads
```

Turn it off with `--no-enabled`.

**API**
```http
PUT /s3/api/buckets/example-uploads/remote-copy
{ "enabled": true }
```

**Console:** not available. The remote copy is set with the CLI and the API.
**Terraform:** not available. The provider has no resource for the remote copy.

## Result

- Each changed object is queued for copying when it is written, encrypted with the bucket's own
  key; a full comparison once an hour finds what was missed. The copy mirrors each key's current
  state, not its version history. `pendingKeys` and `failedKeys` say how many still wait or failed.
- If the whole storage cluster is unavailable, objects are read from the copy. An object not copied
  yet, listings, versions and every write answer `503 ServiceUnavailable` until the cluster is back,
  never `404`.
- Turning it off deletes the copy after 7 days. Without it, an outage of the cluster makes the
  bucket answer `503` until the cluster is back.
- Turning it on copies every existing object too.

## If it is refused

409 `This bucket’s storage has no remote location: a remote copy is offered for buckets on a storage cluster`.
`available: false` in the answer means the bucket's storage keeps no copy elsewhere (buckets in a
zone, own hosts).

## Related

- [Storage locations](storage-locations.md)
- [Replicate a bucket](replicate-a-bucket.md)
- `s3.bucket-remote-copy.set` · `dcloud s3 bucket-remote-copy set`
