mountpoint-s3 icon indicating copy to clipboard operation
mountpoint-s3 copied to clipboard

Region is ignored in AWS config and credential files

Open KoenDG opened this issue 6 months ago • 3 comments

Mountpoint for Amazon S3 version

mount-s3 1.17.0

AWS Region

eu-west-3

Describe the running environment

Running on: Ubuntu 20.04

Credentials provided via: .aws directory with config and credentials file.

config:

[default]
region = eu-west-3
source_profile = default

credentials: (<REDACTED> by me)

[default]
aws_access_key_id = <REDACTED>
aws_secret_access_key = <REDACTED>

Mountpoint options

/usr/bin/mount-s3 <BUCKET> <MOUNT_DIR> --prefix <PREFIX> --allow-delete --allow-overwrite

What happened?

When executing the mount command, the provided region in the config file is ignored.

I checked for existing issues on this, but did not find any. I did, however, find other issues where this warning is present in logs used as examples for other issues.

Example:

  • https://github.com/awslabs/mountpoint-s3/issues/364
  • https://github.com/awslabs/mountpoint-s3/issues/492

While it gets automatically solved, it seems that the region setting is ignored by config... while still being necessary, shown by the fact that the executable checks for it and fixes it.

There also seems to be no mention of this in documentation:

  • https://docs.aws.amazon.com/AmazonS3/latest/userguide/mountpoint-usage.html
  • https://docs.aws.amazon.com/AmazonS3/latest/userguide/mountpoint-troubleshooting.html

It seems the log is generated here: https://github.com/awslabs/mountpoint-s3/blob/4e9fe1d0b9e51f66475620ce990860416739d237/mountpoint-s3-fs/src/s3/config.rs#L214

I've never written rust, but I can clearly see a condition if !region.user_specified => there.

So the code thinks the region wasn't specified by the user... but it was.

Relevant log output

[WARN] mountpoint_s3_fs::s3::config: bucket <REDACTED> is in region eu-west-3, not us-east-1. redirecting...

KoenDG avatar May 26 '25 12:05 KoenDG

Thanks for opening the bug report, @KoenDG. It is a known issue, although there hasn't been a GitHub issue to track it until this point. Mountpoint does not currently evaluate configuration entries in AWS config files.

I'm assuming the redirect is mitigating the issue for you at the moment, but this issue should be addressed eventually. I'll leave this issue open for tracking purposes.

dannycjones avatar May 27 '25 09:05 dannycjones

I'm assuming the redirect is mitigating the issue for you at the moment, but this issue should be addressed eventually. I'll leave this issue open for tracking purposes.

It is, yes.

Although, you say

Mountpoint does not currently evaluate configuration entries in AWS config files.

I'll have to check up on functionality of the mount I did, since I put an role_arn in the config file and it seems to be working.

KoenDG avatar May 27 '25 18:05 KoenDG

Hi, as you noticed, Mountpoint does support getting credentials from a configuration file (see our documentation), however we currently do not evaluate the config file for region inference. For specifying the region Mountpoint only supports the AWS_REGION environment variable, --region flag or EC2 instance metadata (docs). So, mounting with role_arn should work as you expect it, with (currently) one additional request to detect the region at start.

c-hagem avatar May 28 '25 07:05 c-hagem