How to use the Multi Region Access Point in AWS S3 using the hostname?

1

According to the documentation here we should be able to use the Multi Region Access Point using the format <mrap-alias>.accesspoint.s3-global.amazonaws.com hostname but this doesn't seem to work for me.

I can access the access point using the ARN, but the hostname method gives me the error

"An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist".

Is there some additional configuration that is required to enable this access using hostname? I have kept the "Block all public access" as Off for both the access point and the bucket as well.

2 Answers
3
Accepted Answer

Hi,

I believe that you made a request using AWS CLI with hostname. But using hostname is for REST API so if you want to use CLI, you should use ARN and if you want to use hostname, you should use REST API.

Please refer to below.

When you use the REST APIs for Amazon S3 data operations (for example, GetObject) through a Multi-Region Access Point, the hostname for the request is <MRAP_alias>.accesspoint.s3-global.amazonaws.com. For example, to make a GetObject request through the Multi-Region Access Point with alias mfzwi23gnjvgw.mrap, make a request to the hostname mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com. Note the s3-global portion of the hostname that indicates this hostname is not for a specific Region.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPointRequests.html

Thanks

profile pictureAWS
answered 2 years ago
  • The AWS docs mention that to use the APIs the CLI or the SDKs should be used (https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html). I have tried both the methods but both give me the same issue with the mrap hostname although both work with the ARN.

    I tried the following ways:

    1. Using the aws s3api CLI command $ aws s3api list-objects-v2 --bucket <mrap_alias>.mrap.accesspoint.s3-global.amazonaws.com An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist

    2. Using the AWS Python SDK for S3 $ python3 -c "import boto3; boto3.client('s3').list_objects_v2(Bucket='<mrap_alias>.mrap.accesspoint.s3-global.amazonaws.com');" botocore.errorfactory.NoSuchBucket: An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist

    Is there anything special that needs to be configured that I am missing here while using these methods?

  • Finally got it working. Tried the REST API directly via Postman/cURL and it worked. Looks like the s3api CLI and Python SDK S3 client doesn't support this today.

    curl --location --request GET 'https://<mrap_alias>.mrap.accesspoint.s3-global.amazonaws.com'
    --header 'X-Amz-Content-Sha256: <sha256-token>'
    --header 'X-Amz-Date: 20220114T181915Z'
    --header 'Authorization: AWS4-HMAC-SHA256 Credential=<credentials>/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=<signature>'

    Thanks Eunsu_Shin!

0

Hi Gaurav, I have same use case where I created a MRAP and want to access it using cURL/Postman. Could you please provide steps to do it?

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions