1 Answer
- Newest
- Most votes
- Most comments
-2
Hello,
Yes, that's possible using S3 access points.
- Create a S3 bucket and dedicated prefixes for each consumer application in the bucket, e.g., s3://your-bucket/prefix1/, s3://your-bucket/prefix2/.
- Create an S3 Access Point(AccessPointA and AccessPointB) for each consumer application and specify the bucket name along with Prefix the application must have access.
- Each access point can have its own policy to further ensure that uploads are restricted to the correct prefix. Here’s how you can set this up for Access PointA
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPutObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:region:account-id:accesspoint/AccessPointA/object/prefix1/*""
}
]
}
- Add the access point policy to the other AccessPointB restricted to dedicated prefix2.
- Test that the files are uploaded to dedicated prefixes inside the S3 bucket using the respective Access Point alias.
Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html
Relevant content
- asked 2 years ago

Thanks for the response.
I tried with the exact configuration as suggested and following is the outcome:
Trying to upload file only with access point alias without prefix $ aws s3 cp log.txt s3://AccessPointA-alias/ upload failed: ./log.txt to s3://AccessPointA-alias/log.txt An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
Trying to upload file with access point alias along with prefix $ aws s3 cp log.txt s3://AccessPointA-alias/prefix1/ upload: ./log.txt to s3://AccessPointA-alias/prefix1/log.txt
The consumer must specify the prefix when using the access point alias. I want to hide the prefix information from the consumer, and provide them only the AP-alias. Is it possible?
Your answer simply directs "2. Create an S3 Access Point for each consumer application and specify the bucket name along with Prefix" but doesn't say how to do that -- specifically, the part about how we specify the prefix, which is the whole point of the question. The AWS web Console doesn't allow prefixes to be given when creating the access point, as far as I can tell, and I'm in the same situation as the original poster.