Courseiva
Design for New SolutionseasyMultiple ChoiceObjective-mapped

SAP-C02 Design for New Solutions Practice Question

A company wants to provide temporary, limited-privilege credentials to its application running on an EC2 instance so that the application can access an S3 bucket. What is the BEST practice for achieving this?

⚠ Common exam trap

Watch out — candidates often think storing credentials in user data or code is acceptable for automation, but AWS explicitly prohibits this in favor of IAM roles for EC2 to avoid long-term credential exposure.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create an IAM role with the necessary permissions and attach it to the EC2 instance

The best practice is to use an IAM role, which provides temporary security credentials via the EC2 instance metadata service (IMDS). The application automatically retrieves these credentials without hardcoding secrets, and the credentials are rotated automatically by AWS. This approach follows the principle of least privilege and eliminates the security risks of long-term access keys.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use an S3 bucket policy to allow access from the EC2 instance's public IP

    Why it's wrong here

    Bucket policies control access from IPs, but do not provide credentials; also, IPs can change.

  • Create an IAM user and store the credentials in the EC2 instance user data

    Why it's wrong here

    IAM user credentials are long-term and should not be stored on instances; they are not temporary.

  • Store AWS access keys in the application code

    Why it's wrong here

    Storing access keys in code is insecure and not a best practice; they can be exposed.

  • Create an IAM role with the necessary permissions and attach it to the EC2 instance

    Why this is correct

    An IAM role provides temporary credentials that are automatically rotated, which is secure and best practice.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every SAP-C02 question from scratch — 1,660 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.