Amazon S3 Bucket Region

I’m getting this error when trying to init an s3 bucket:

Fatal: create repository at s3:s3.amazonaws.com/my-bucket-name failed: client.BucketExists: Head https://my-bucket-name.s3.dualstack.us-east-1.amazonaws.com/: 301 response missing Location header

Debugging yields this:

------------ HTTP RESPONSE ----------
HTTP/1.1 301 Moved Permanently
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Mon, 04 Nov 2019 13:41:34 GMT
Server: AmazonS3
X-Amz-Bucket-Region: us-east-2
X-Amz-Id-2: RoRbgXX677jDP6pthowm5DzDRQrC+dkibI9o1GJpoVHFuBuYJckRazgEAuPMghv1TI+3FdqHSWM=
X-Amz-Request-Id: E7269AF5F1AE6E75

Didn’t see anywhere to explicitly set the bucket region and it seems to be going with us-east-1 rather than us-east-2. Where is it getting us-east-1 from?

Thanks in advance.

Hi @sloar and welcome to the restic community :slight_smile:

It seems that the bucket name you meant to use, is already in use by someone else.
Could you try to use a different name? Also for troubleshooting purposes, you could try to create the S3 bucket manually on the AWS website and see if you get a similar error - this would conclude that it’s not a problem with restic or your configuration.

The 301 is a normal HTTP permanent redirect and not an error in that sense.

What was the restic output exactly?

Created a new bucket through AWS website, “test-bucket-is-test-bucket”, set the permissions thusly:

{
“Version”: “2012-10-17”,
“Statement”: [
{
“Effect”: “Allow”,
“Principal”: {
“AWS”: “arn:aws:iam::463981671805:user/web1b”
},
“Action”: [
“s3:GetObject”,
“s3:PutObject”,
“s3:ListBucket”,
“s3:DeleteObject”,
“s3:GetBucketLocation”,
“s3:ListBucket”
],
“Resource”: [
“arn:aws:s3:::test-bucket-is-test-bucket”,
“arn:aws:s3:::test-bucket-is-test-bucket/*”
]
}
]
}

Here’s the output:

https://pastebin.com/4qeeuAdY

Thanks

I believe that this is a default fallback.

Here are the restic options you can set. I believe that you can even set Minio options but I am not 100% sure about that.

restic options
All Extended Options:
  azure.connections   set a limit for the number of concurrent connections (default: 20)
  b2.connections    set a limit for the number of concurrent connections (default: 5)
  gs.connections    set a limit for the number of concurrent connections (default: 20)
  local.layout      use this backend directory layout (default: auto-detect)
  rclone.args       arguments for running rclone (default: serve restic --stdio --b2-hard-delete --drive-use-trash=false)
  rclone.connections   set a limit for the number of concurrent connections (default: 5)
  rclone.program    path to rclone (default: rclone)
  rest.connections   set a limit for the number of concurrent connections (default: 5)
  s3.connections    set a limit for the number of concurrent connections (default: 5)
  s3.layout         use this backend layout (default: auto-detect)
  s3.retries        set the number of retries attempted
  s3.storage-class   set S3 storage class (STANDARD, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING or REDUCED_REDUNDANCY)
  sftp.command      specify command to create sftp connection
  sftp.layout       use this backend directory layout (default: auto-detect)
  swift.connections   set a limit for the number of concurrent connections (default: 5)

Did you follow the documentation here?
https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#amazon-s3

Additionally, there is this guide: https://restic.readthedocs.io/en/latest/080_examples.html
It might be a bit outdated but maybe it’s still helpful.
I don’t have a S3 repo myself so I can’t give you more info than I found myself.

Another idea is to search the forum a bit for anything related to S3 and regions.