The same EC2 role can GetObject from same-Region general purpose buckets amzn-s3-demo-allowed and amzn-s3-demo-other. The existing gateway endpoint has Full Access policy; subnet S3 routing, IAM and bucket permissions, DNS, and connectivity are verified.
Restrict GetObject through this endpoint to objects in the allowed bucket. Bypass paths and ListBucket are outside scope, and no other workloads depend on this endpoint.
How should the endpoint policy be replaced without retaining broad authorization?
Replace broad default Allow with an endpoint policy permitting only GetObject on the selected objects.
Detailed explanation
Routing selects the S3 path; it is not bucket-specific API authorization. Separate service reachability from policy restrictions on actions and resources.
The existing broad Allow still matches other buckets. Adding a narrower Allow does not restrict it; review and replace the full set of permissions.
GetObject uses object ARNs. Replace the broad endpoint Allow so other buckets are not permitted through this endpoint. IAM and bucket permissions remain necessary.
GetObject is an object operation; a bucket ARN alone does not authorize its objects. Distinguish bucket operations such as ListBucket and their required resources.
Check official documentation
Compare the following points with the official documentation.
In approved same-Region test buckets, use the same role and endpoint to GetObject from both buckets. Allow time for policy changes to take effect, then compare the effective policy, resource ARNs, paths, and success or denial.
Official references
What to confirm
The selected objects can be read and the other bucket is denied through the endpoint. This does not establish restrictions on bypass paths or new permissions in IAM and bucket policies.
Key points
- Gateway VPC endpoint
- Endpoint policy
- Object ARN
Notes
- Environment: Official S3 and VPC documentation and approved test buckets, role, and gateway endpoint
- Reviewed against the linked AWS documentation on 2026-10-15.
Foundation review
Remove the broad Allow
The default policy permits all actions and resources. An additional bucket-specific Allow does not cancel the existing Allow. Replace the policy with the selected GetObject permission; gateway endpoints require Principal=*.
Match action and resource scope
Use object ARN arn:aws:s3:::amzn-s3-demo-allowed/* for s3:GetObject. A bucket ARN alone is insufficient. ListBucket would require separate bucket-level authorization and is outside this scenario.
Separate path, permission, and scope
The S3 prefix-list route selects the endpoint, whose policy restricts requests using it. It does not replace IAM or bucket policies or control bypass paths. Updates can take time; test both permitted and denied requests under the same conditions after propagation.