Skip to main content

CLF-C02 practice question · Security and Compliance

An application running on an Amazon EC2 instance needs to read and write objects in an Amazon S3 bucket.

An application running on an Amazon EC2 instance needs to read and write objects in an Amazon S3 bucket. What is the AWS-recommended way to grant this access?

  • AAttach an IAM role with the required S3 permissions to the EC2 instance
  • BStore an IAM user's access key and secret key in a file on the instance
  • CMake the S3 bucket public so no credentials are needed
  • DEmbed the root user credentials in the application code
Show the answer and explanation

Correct answer: A) Attach an IAM role with the required S3 permissions to the EC2 instance

Why each option is right or wrong

  • A) Correct. An instance profile / IAM role provides the application with automatically rotated temporary credentials via the instance metadata service — no long-lived keys on the instance.
  • B) Incorrect. Long-lived access keys on an instance are a leak risk and are hard to rotate — the pattern roles are designed to replace.
  • C) Incorrect. Public buckets expose data to everyone and still don't provide authenticated write access.
  • D) Incorrect. The root user should never be used for application access, and hard-coding credentials is unsafe.
Exam domain
Security and Compliance · 30% of CLF-C02
Question type
Multiple choice (one answer)

Practise the full CLF-C02 exam

This question is one of a small free sample from the CertRidge CLF-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.

Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.