# S3 bucket name not accepted

**URL:** <https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868>\
**Category:** Help with Setup/Upgrade\
**Created:** [April 4, 2021, 11:39am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868 "2021-04-04T11:39:22Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 4, 2021, 11:39am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/1 "2021-04-04T11:39:22Z")

</div>

I’m trying to set up Scaleway’s “S3 compatible” object storage for MIAB backups. I’ve created a bucket, and I have the endpoint and credentials. When I enter the details in MIAB’s backup config it doesn’t accept the submission, saying “Enter an S3 bucket name.”. There is no field labelled bucket name, but I assume it means the path. My bucket is called `mail-backup`, which as far as I know is a valid name. What’s wrong with this?

I’ve also tried ‘backup/mail’, ‘mailbackup’ paths, but they are not accepted. It doesn’t like it appended to the endpoint either.

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 4, 2021, 5:21pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/2 "2021-04-04T17:21:46Z")

</div>

Try removing the hyphens? If I recall correctly there is an upstream problem with one of MIAB’s packages which doesn’t handle the allowed names properly.

It took me a few goes to get my S3 backup working but it has run properly for a couple of months now.

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 4, 2021, 5:43pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/3 "2021-04-04T17:43:05Z")

</div>

No, I tried that and several other variations, but nothing is accepted.

The rejection is instant, making me think it’s a client-side validation, but I’ve not managed to track down its code to find out what it wants.

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 4, 2021, 7:00pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/4 "2021-04-04T19:00:12Z")

</div>

Ah sorry

For me in the S3 Path I have:

bucketname/folder

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 4, 2021, 9:39pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/5 "2021-04-04T21:39:56Z")

</div>

Mine rejects that too! I’ve no idea what’s going on here.

---

<div class="post-metadata">

**Author:** ![S4\_Hosting](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/s4_hosting/32/1465_2.png) [@S4\_Hosting](https://discourse.mailinabox.email/u/S4_Hosting)\
**Post date:** [April 4, 2021, 10:35pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/6 "2021-04-04T22:35:49Z")

</div>

> [@Synchro](#):
>
> There is no field labelled bucket name, but I assume it means the path.

Yes, ‘path’ in this case is ‘bucket-name’

Just checking, you are setting the region to ‘Other’ ?

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 5, 2021, 8:04am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/7 "2021-04-05T08:04:54Z")

</div>

Have you already created a folder in your bucket to hold the backups?

That is, I don’t think MIAB will create it.

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 5, 2021, 8:16am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/8 "2021-04-05T08:16:35Z")

</div>

Yes, region is other because I’m using Scaleway’s service.

I have not created a folder in the bucket because I have no idea how to! There are no controls at the server end at all.

I have another (not MIAB) server that is doing backups to the same service using duplicity and it works fine, and I didn’t need to set up anything at the server end.

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 5, 2021, 8:38am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/9 "2021-04-05T08:38:53Z")

</div>

Puzzling.

I assume you are triggering a backup manually to test?

```
sudo ~/mailinabox/management/backup.py

```

Otherwise it waits to the 3am hour I believe.

For some reason, though set the UI does not show anything in the fields other than S3 path (at least on my 0.51 box). That I found confusing.

My apologies if my suggestions are too basic. It is hard to know what is going on here.

I might try Scaleway myself. I see they offer 75GB free object storage.

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 5, 2021, 8:53am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/10 "2021-04-05T08:53:13Z")

</div>

No, there’s no point in triggering the backup manually because I can’t even save the config, so there’s nothing to test.

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 5, 2021, 6:10pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/11 "2021-04-05T18:10:41Z")

</div>

Sorry not to have been of hel-

Is this [problem](https://github.com/mail-in-a-box/mailinabox/issues/1941#issue-831078171) relevant I wonder.

---

<div class="post-metadata">

**Author:** ![S4\_Hosting](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/s4_hosting/32/1465_2.png) [@S4\_Hosting](https://discourse.mailinabox.email/u/S4_Hosting)\
**Post date:** [April 5, 2021, 9:25pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/12 "2021-04-05T21:25:20Z")

</div>

> [@Synchro](#):
>
> I have not created a folder in the bucket because I have no idea how to! There are no controls at the server end at all.

That’s your problem. MIAB won’t create the bucket, it needs to be pre-existing.

I found instructions to create a bucket in a Scaleway S3 instance using the command line here: [Using Object Storage with s3cmd](https://www.scaleway.com/en/docs/object-storage-with-s3cmd/)

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 5, 2021, 10:04pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/13 "2021-04-05T22:04:46Z")

</div>

That’s not it. I found that there _is_ in fact a way to create folders directly on Scaleway (it was right there!).

Unfortunately it makes no difference to the MAIB config: it still just says “Enter an S3 bucket name”. I checked in the web inspector and I can see that it _is_ submitting the details via XHR, and the rejection is coming from the server, so I was wrong about it being a client-side validation. I can also see that it concatenates the endpoint and path fields to create the full URL.

Using the same base URL, bucket and path, and access credentials with s3cmd works fine.

Just to be sure it’s wasn’t a bucket-specific issue, I created a new one called “bucket”, made a folder inside it called “mail”, and entered a path of “bucket/mail” in MIAB, but it’s still unhappy, and it still works in s3cmd.

I’m suspicious of the speed of the response. When I run a command with bad credentials directly to the S3 service, the failure takes about 500ms to return. From the MIAB admin UI, I get a response in only 80ms, and that includes the additional time taken from my browser to MIAB. This makes me think either it’s miraculously fast, or it’s not actually doing an API call at all.

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 5, 2021, 10:24pm UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/14 "2021-04-05T22:24:09Z")

</div>

I found the issue!

Scaleway provides a URL for the endpoint of `https://bucketname.s3.fr-par.sc.cloud`, complete with a “Copy” button, which will vary according to your data centre and bucket name. So that’s what I used.

When I used the inspector to look at the requests to MIAB, I was interested in the _end_ of the URL, but I then noticed that the URL _started_ with `s3://https://`, which looks very wrong. So I wondered if MIAB was not expecting a URL like that but just a hostname. So I tried it without the prefix… which didn’t work either, but it showed me a different error complaining about host names. I noticed that the s3cmd config wanted a host name both with and without the bucket name, so I tried without, and that worked!

So, if your Scaleway endpoint is provided as `https://bucketname.s3.fr-par.scw.cloud`, and you’re backing up to a folder called `mail` within that bucket, your MIAB settings should be:

- S3 Region: `Other`
- S3 Host / Endpoint: `s3.fr-par.scw.cloud` (notice it does _not_ include the bucket name)
- S3 Path: `bucketname/mail`

After all that, MIAB replied with “OK”, so I’ll wait to see if the backup goes ahead later tonight.

I also checked some of the earlier things we were suspicious about, and it works fine if your bucket name includes dashes.

This could have been avoided with some better labelling on the fields, perhaps some tooltips?

---

<div class="post-metadata">

**Author:** ![latinhypercube](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@latinhypercube](https://discourse.mailinabox.email/u/latinhypercube)\
**Post date:** [April 6, 2021, 6:49am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/15 "2021-04-06T06:49:22Z")

</div>

Glad your persistence paid off. Thanks for sharing the answer.

Might give Scaleway a go myself.

---

<div class="post-metadata">

**Author:** ![Synchro](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@Synchro](https://discourse.mailinabox.email/u/Synchro)\
**Post date:** [April 6, 2021, 7:34am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/16 "2021-04-06T07:34:19Z")

</div>

The backup did indeed complete successfully.

---

<div class="post-metadata">

**Author:** ![system](https://discourse.mailinabox.email/uploads/default/original/2X/4/4d0933d13c456b7e57f296aa6cc344525b6f0c70.png) [@system](https://discourse.mailinabox.email/u/system)\
**Post date:** [April 13, 2021, 7:34am UTC](https://discourse.mailinabox.email/t/s3-bucket-name-not-accepted/7868/17 "2021-04-13T07:34:24Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
