1

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();
  • Aha - try `arn:aws:s3::123456789012:accesspoint:randomstring.mrap` – Ermiya Eskandary Aug 20 '22 at 15:46
  • Unfortunately that format returns the same error. – Chris Meyer Aug 20 '22 at 16:25
  • I cannot reproduce this - I've just been able to insert an object using an MRAP endpoint using your exact code. Are you sure you don't have a random character mistakenly inserted somewhere in your ARN? But I am 100% sure that the code above works. – Ermiya Eskandary Aug 21 '22 at 08:52
  • @ErmiyaEskandary I really appreciate you looking into this. I'm confident my arn is correct. Could you please share the exact version of AWS & .NET SDKs you used? If that code is working for you, that's the only thing left I can come up with. – Chris Meyer Aug 21 '22 at 17:04
  • No worries! .NET 6.0.300, AWSSDK.S3 3.7.9.14 (latest) & AWSSDK.Extensions.CrtIntegration 3.7.1.4 – Ermiya Eskandary Aug 21 '22 at 17:45
  • The above code does NOT work for me with AWSSDK.S3 3.7.101.1 (latest) & AWSSDK.Extensions.CrtIntegration 3.7.1.4 & .NET 6.0.100..... tried many alternatives and no luck. I get a different error though: Amazon.S3.AmazonS3Exception: We encountered an internal error. Please try again. (no matter how many times I try) – r590 Oct 25 '22 at 17:23

0 Answers0