A company hosts its application on Amazon EC2 instances inside a VPC and creates a dedicated Amazon S3 bucket for each customer. The application must be able to securely access only the S3 buckets that belong to the company’s AWS account. Which solution provides this with the LEAST operational overhead?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a gateway endpoint for Amazon S3 that is attached to the VPC. Update the IAM instance profile policy with a Deny action and the following condition key:.
Why this is the answer
The correct solution uses an S3 Gateway Endpoint to allow EC2 instances to access S3 privately without traversing the internet, which is more secure and cost-effective than using a NAT Gateway for S3 traffic. The key to restricting access to only the company's buckets lies in the IAM instance profile policy. By adding a Deny action with the aws:SourceAccount condition key, you explicitly prevent access to S3 buckets not owned by the specified account, even if other permissions might implicitly allow it. This provides a strong, explicit security boundary with minimal operational overhead as it's managed directly within the IAM policy attached to the EC2 instances. Incorrect options: Updating the IAM instance profile policy with only Allow actions might not be sufficient to explicitly prevent access to other accounts' buckets, as a broader Allow could inadvertently grant access. Using a NAT Gateway for S3 access is less secure and incurs higher costs than a Gateway Endpoint, and it doesn't inherently restrict access to specific accounts without additional, more complex configurations. Assigning bucket policies for all buckets is operationally intensive, especially if there are many buckets or new ones are frequently created, and it doesn't prevent instances from attempting to access other accounts' buckets.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed