Use the S3 bucket's region vs the client's #763
-
Hi, I am trying to fetch ACLs for all buckets that a user has access to which are spread across several regions. However, it looks like when doing this naively, the endpoint resolver uses the client's region in order to do the GetBucketAcl call and not the actual bucket's. I can't predict the bucket region and there are always going to be several regions. I have tried different ways of changing the config to use
I suspect that it could work if I were to recreate the configs for each bucket, however with boto3 this doesn't seem to be an issue? Any input is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @celaus, thank you for reporting this! Could you share with us a self-contained example so we can run it on our end (possibly with tailoring) to reproduce what you are seeing? Also, could you let us know what version of the Edit: #[tokio::main]
async fn main() -> Result<(), Error> {
let shared_config = aws_config::from_env().load().await; // default region is set to us-west-2
let s3_client = aws_sdk_s3::Client::new(&shared_config);
s3_client
.get_bucket_acl()
.bucket("name-of-bucket-in-us-east-1")
.send()
.await
.unwrap();
Ok(())
} The execution fails with a import boto3
s3 = boto3.client('s3')
result = s3.get_bucket_acl(Bucket='name-of-bucket-in-us-east-1')
print(result) It prints the result correctly. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @celaus, thank you for reporting this! Could you share with us a self-contained example so we can run it on our end (possibly with tailoring) to reproduce what you are seeing? Also, could you let us know what version of the
aws-sdk-s3
crate you're on?Edit:
In the meantime, I believe I have reproduced what you reported. If I have a bucket in the
us-east-1
region and run the following code