An application running on an EC2 instance lists objects in an S3 bucket but displays no objects during testing. What is the most secure way to fix this so the application can list the bucket contents?
Choose an answer
Tap an option to check your answer.
Correct answer: Add the S3:ListBucket permission for the bucket to the IAM instance profile attached to the EC2 instance..
Why this is the answer
The correct answer is to add the S3:ListBucket permission to the IAM instance profile. This is the most secure and granular way to grant the EC2 instance the specific permission it needs to list objects in an S3 bucket. An IAM instance profile provides credentials to applications running on an EC2 instance, allowing them to make AWS API calls. Adding S3: permission is overly permissive, granting more access than required and violating the principle of least privilege. Granting the developer's IAM user permission is irrelevant to the application running on the EC2 instance. Modifying the S3 bucket policy with the EC2 instance's account number as the principal is less secure and less manageable than using an IAM instance profile, as it grants access at the bucket level rather than controlling the specific permissions of the instance.
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