I've got a multi-region access point (MRAP) set up with 2 buckets attached (with cross-region-replication enabled). The idea is that uploading to the MRAP will cause the file to (eventually) appear in each regional bucket. However, I'm failing to make this work or even to find examples about how this is supposed to be done.
What I am trying to accomplish is having a solution that will be resilient to any one region going down. So a workaround is to just upload the file to one of the regional buckets and it will replicate. But if that region goes down or is degraded, then things fall apart, so it doesn't tick the boxes. There a notes about how the syntax about uploading to an MRAP is different, but I can't seem to make anything work as expected. Maybe my expectations are the problem? 🤔
Here's what I've tried:
❯ aws s3api put-object \
--bucket "arn:aws:s3::12345678:accesspoint/my-mrap" \
--key "foo/example.txt" \
--body "example.txt" \
--region us-east-1
Could not connect to the endpoint URL: "https://my-mrap.accesspoint.s3-global.amazonaws.com/foo/example.txt"
❯ aws s3 cp "example.txt" \
"s3://arn:aws:s3::12345678:accesspoint/my-mrap/dsp/test.txt"
upload failed: example.txt to s3://arn:aws:s3::12345678:accesspoint/my-mrap/foo/example.txt Could not connect to the endpoint URL: "https://my-mrap.accesspoint.s3-global.amazonaws.com/foo/example.txt"
❯ aws s3api put-object \
--bucket "xyz123.mrap" \
--key "foo/example.txt" \
--body "example.txt" \
--region us-west-2
An error occurred (NoSuchBucket) when calling the PutObject operation: The specified bucket does not exist
# Uploading to the regional bucket works, but this defeats the
# entire purpose of using an MRAP
❯ aws s3 cp "example.txt" \
"s3://my-regional-bucket-us-east-1/foo/example.txt"
upload: example.txt to s3://my-regional-bucket-us-east-1/foo/example.txt
I'm using version 2.27.50 of the AWS CLI:
❯ aws --version
aws-cli/2.27.50 Python/3.13.4 Darwin/24.6.0 exe/x86_64
I finally found a solution that works. The syntax for the AWS CLI should be something like this:
aws s3api put-object \
--bucket "foo" \
--key "bar.txt" \
--body "path-to-local-file.txt" \
--endpoint-url "https://xyz123.mrap.accesspoint.s3-global.amazonaws.com"
The bucket
argument ends up being the prefix to the key. So the above operation ends up creating an object named foo/bar.txt
in the buckets attached to the given MRAP.
In other words, the above is the equivalent to something like:
aws s3 cp path-to-local-file.txt s3://some-bucket/foo/bar.txt
but all attached buckets get the file instead of just the single one that you'd use in a straight-forward aws s3 cp
operation.