# Can one bucket be used for multiple Mongo backup?

**URL:** <https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983>\
**Category:** Percona Operator for MongoDB\
**Tags:** percona, mongodb\
**Created:** [August 31, 2021, 1:56pm UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983 "2021-08-31T13:56:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vhphan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vhphan/32/4187_2.png) [@vhphan](https://forums.percona.com/u/vhphan)\
**Post date:** [August 31, 2021, 1:56pm UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/1 "2021-08-31T13:56:44Z")

</div>

Hi, I will have a lot of Mongo instances provisioned from the operator. In the mongo CR, the `backup.storages` section mentions bucket, but in the operator code there is another field `prefix`.

So I wonder if one S3 bucket can be shared between multiple Mongo to store their backup? The path can be prefixed with the CR name for example? I don’t quite want to create one bucket for each database.

---

<div class="post-metadata">

**Author:** ![1114](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/1114/32/4374_2.png) [@1114](https://forums.percona.com/u/1114)\
**Post date:** [August 31, 2021, 4:50pm UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/2 "2021-08-31T16:50:28Z")

</div>

Very happy to see your post, because I have the same needs  
After testing, I found that the functions you need can indeed be achieved, but the operator will have some problems when deleting s3 backup. You need to comment in backup.yaml and make the operator not delete the backup in s3 when deleting the backup.  
cr.yaml example:  
backup:  
storages:  
s3-backup:  
type: s3  
s3:  
bucket: \< clusterName \>  
region: \< s3.region \>  
credentialsSecret: \< s3.credentialsSecret \>  
endpointUrl: \< s3.endpointUrl \>/\< s3.bucketName \>/\< directoryName \>

---

<div class="post-metadata">

**Author:** ![vhphan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vhphan/32/4187_2.png) [@vhphan](https://forums.percona.com/u/vhphan)\
**Post date:** [August 31, 2021, 5:51pm UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/3 "2021-08-31T17:51:23Z")

</div>

But the s3 bucket will keep growing right? That’s quite inconvenient.  
What’s the problems does the operator have when deleting backup though?

---

<div class="post-metadata">

**Author:** ![1114](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/1114/32/4374_2.png) [@1114](https://forums.percona.com/u/1114)\
**Post date:** [September 1, 2021, 3:18am UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/4 "2021-09-01T03:18:57Z")

</div>

If finalizers.delete-backup is not commented in backup.yaml, the consequence of this configuration is that the operator will get stuck when deleting the backup, causing the deletion of the backup to fail.

Yes, the storage of s3 buckets will continue to increase. This is a compromise solution, because currently no matter what pxc/postgresql/mongodb operatort supports this way of use is not very friendly.  
You can make a suggestion to percona about this usage requirement  
Finally, look forward to percona getting better and better.

---

<div class="post-metadata">

**Author:** ![vhphan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vhphan/32/4187_2.png) [@vhphan](https://forums.percona.com/u/vhphan)\
**Post date:** [September 3, 2021, 8:35am UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/5 "2021-09-03T08:35:00Z")

</div>

Ah okay. Thanks for the information.  
@Sergey_Pronin Sorry for tagging but do you think something like that will be supported?

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [September 3, 2021, 9:43am UTC](https://forums.percona.com/t/can-one-bucket-be-used-for-multiple-mongo-backup/11983/6 "2021-09-03T09:43:48Z")

</div>

I’m not sure what the issue is.

It is possible to use one bucket with prefix:

```auto
backup:
  storages:
    my-s3:
      type: s3
      s3:
        bucket: some-bucket
        prefix: "some-prefix"
        ...

```

I tested and finalizer works normally with prefix. Is there any issue that you see?
