.NET AWS SDK - Region missing in ARN for multi region access point

573 Views Asked by At

I am trying to write a simple .NET console app that puts an object into an AWS S3 bucket via a multi region access point. I get the following error: Amazon.Runtime.AmazonClientException: AWS region is missing in access point ARN

My arn format for multi region access points came from the documentation Making requests using a Multi-Region Access Point.

I also set the ENV variable AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS=false. Even though this is the default, I did explicitly set it to be sure the SDK should not be excluding mrap Amazon S3 Multi-Region Access Points.

I'm using the v3.x AWS .NET SDK, and reasonably confident that IAM and S3 policies are correct because I can put objects via the CLI no problem. I'm sure I'm missing something totally obvious, but any help is appreciated.

using Amazon;
using Amazon.S3;
using Amazon.S3.Model;

string bucketName = "arn:aws:s3::123456789012:accesspoint/randomstring.mrap";
string keyName = "some/path/test.txt";

AmazonS3Client client;
AmazonS3Config config = new AmazonS3Config();

config.UseArnRegion = false;
config.RegionEndpoint = RegionEndpoint.USWest2;

client = new AmazonS3Client(config);

PutObjectRequest request = new PutObjectRequest()
{
    ContentBody = "this is a test",
    BucketName = bucketName,
    Key = keyName
};

client.PutObjectAsync(request).Wait();
0

There are 0 best solutions below