AWS Certified Solutions Architect – Professional — Question 170

You have an application running on an EC2 Instance which will allow users to download flies from a private S3 bucket using a pre-signed URL. Before generating the URL the application should verify the existence of the file in S3.
How should the application use AWS credentials to access the S3 bucket securely?

Answer options

Correct answer: C

Explanation

The correct answer is C because using an IAM role for EC2 allows the instance to assume the role and access the S3 bucket securely without hardcoding credentials. Options A and D are less secure as they involve retrieving credentials from the source code or a temporary directory, which can lead to exposure. Option B is also less ideal since it requires launching the instance as an IAM user, which is not as flexible or secure as using a role.