# How to restore from a read-only S3 bucket?

**URL:** <https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206>\
**Category:** Percona Backup for MongoDB\
**Tags:** mongodb, pbm\
**Created:** [January 18, 2025, 2:24am UTC](https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206 "2025-01-18T02:24:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_Neulinger](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nathan_neulinger/32/176_2.png) [@Nathan\_Neulinger](https://forums.percona.com/u/Nathan_Neulinger)\
**Post date:** [January 18, 2025, 2:24am UTC](https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206/1 "2025-01-18T02:24:00Z")

</div>

I’m trying to restore to an secondary test cluster (with identical replset name) for the purposes of validating a backup. However, the first thing pbm tries to do with a force-resync is to rewrite .pbm.init in the repository, which it cannot do because it doesn’t have permissions.

I’m going to try doing a very limited IAM role that would allow it to delete/upload JUST that one file, but that seems rather hackish. Is there a proper way to be able to restore from a protected path that I don’t have permission to write to? I see another thread asking a similar question about whether it’s safe to remove that file. ([PBM-INIT File safe for removal?](https://forums.percona.com/t/pbm-init-file-safe-for-removal/35763))

Based on that thread of it having just a version in it - why does it even have to rewrite that file when it’s got the exact same version as the pbm I’m using to try to do the restore as is on the live production instances?

Interestingly - it also looks like it’s trying to delete/put BUCKET/.pbm.init without the prefix. That seems like a bug.

---

<div class="post-metadata">

**Author:** ![Nathan\_Neulinger](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nathan_neulinger/32/176_2.png) [@Nathan\_Neulinger](https://forums.percona.com/u/Nathan_Neulinger)\
**Post date:** [January 18, 2025, 2:38am UTC](https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206/2 "2025-01-18T02:38:46Z")

</div>

It does look the limited IAM profile was sufficient to get this to work, though seems like that should not be required. At the bare minimum, consider making it not a requirement to rewrite that file _if it has the same content_.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [January 19, 2025, 6:47pm UTC](https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206/3 "2025-01-19T18:47:21Z")

</div>

Hi @Nathan_Neulinger,  
I suggest you open a bug on this at [https://jira.percona.com/](https://jira.percona.com/) as I agree that it shouldn’t need to rewrite a file with the same contents.

---

<div class="post-metadata">

**Author:** ![Nathan\_Neulinger](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nathan_neulinger/32/176_2.png) [@Nathan\_Neulinger](https://forums.percona.com/u/Nathan_Neulinger)\
**Post date:** [January 19, 2025, 6:54pm UTC](https://forums.percona.com/t/how-to-restore-from-a-read-only-s3-bucket/36206/4 "2025-01-19T18:54:54Z")

</div>

[PBM-1480](https://perconadev.atlassian.net/browse/PBM-1480) - forgot to add that link yesterday to the forum post.
