Skip to content

Add support for S3 Multi-Region Access Point (MRAP) URLs #556

@fedemengo

Description

@fedemengo

Description

S3 Multi-Region Access Points (MRAPs) use ARN-based URLs instead of a plain bucket name:

s3://arn:aws:s3::123456789012:accesspoint/my-mrap.mrap/path/to/file.txt

Currently, S3Path parses the bucket by splitting on the first / after s3://, which gives arn:aws:s3::123456789012:accesspoint — cutting off the .mrap suffix. This causes bucket and key to be computed incorrectly, breaking all boto3 calls since they receive the wrong Bucket and Key parameters.

Current behavior

p = S3Path("s3://arn:aws:s3::123456789012:accesspoint/my-mrap.mrap/folder/file.txt")
p.bucket  # "arn:aws:s3::123456789012:accesspoint"  ← wrong
p.key     # "my-mrap.mrap/folder/file.txt"          ← wrong

Expected behavior

p.bucket  # "arn:aws:s3::123456789012:accesspoint/my-mrap.mrap"  ← full ARN
p.key     # "folder/file.txt"                                     ← correct

Proposed fix

Override the bucket property on S3Path to detect MRAP ARNs via a regex and return the full ARN when matched, falling back to the existing behaviour for regular bucket names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions