Question 121 of 1,024
Security and CompliancemediumMultiple ChoiceObjective-mapped

Quick Answer

The answer is to create an IAM role with the required S3 read permissions and attach it to the EC2 instance profile. This is correct because the instance profile allows the EC2 instance to assume the IAM role and retrieve temporary security credentials from the instance metadata service (IMDS), eliminating the need to store any long-term access keys on the instance. On the AWS Certified Cloud Practitioner CLF-C02 exam, this scenario tests your understanding of the shared responsibility model and the principle of least privilege, specifically how IAM roles provide secure, temporary access for AWS services. A common trap is choosing an option that stores keys in a configuration file or environment variable, which violates the security requirement. Remember the memory tip: “Roles for resources, keys for people”—whenever an AWS service like EC2 needs to access another service like S3, always use an IAM role, never hard-coded keys.

CLF-C02 Security and Compliance Practice Question

This CLF-C02 practice question tests your understanding of security and compliance. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company runs a data analytics application on an Amazon EC2 instance. The application needs to read CSV files from an Amazon S3 bucket to process them. The security team requires that no long-term AWS credentials (access key ID and secret access key) be stored on the instance. The instance is already launched in a private subnet within a VPC. Which solution meets the security requirement and provides the necessary access?

Question 1mediummultiple choice
Review the full subnetting walkthrough →

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 required S3 read permissions. Attach the role to the EC2 instance profile.

Option B is correct because it uses an IAM role attached to an EC2 instance profile, which allows the application to obtain temporary AWS credentials via the instance metadata service (IMDS). This eliminates the need to store long-term access keys on the instance, satisfying the security requirement while granting the necessary S3 read permissions.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

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

  • Store the AWS access key ID and secret access key in a configuration file on the instance's local disk.

    Why it's wrong here

    This option directly violates the security requirement by storing long-term credentials permanently on the instance. If the instance is compromised, the static credentials can be stolen and used by an attacker.

  • Create an IAM role with the required S3 read permissions. Attach the role to the EC2 instance profile.

    Why this is correct

    This is the correct and most secure method. The EC2 instance assumes the IAM role, obtaining temporary, automatically-rotated credentials. No long-term secrets are stored on the instance, complying with the security policy.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Write a resource-based policy on the S3 bucket that allows access based on the private IP address of the EC2 instance.

    Why it's wrong here

    S3 bucket policies can use the aws:SourceIp condition, but that condition expects public IP addresses, not private IPs. Since the instance is in a private subnet without a public IP, this policy would not grant access. Additionally, IP-based authorization alone is not a secure replacement for IAM credentials.

  • Create a new IAM user with the required permissions. Store the IAM user's access key and secret key in AWS Systems Manager Parameter Store, and configure the application to retrieve them at runtime.

    Why it's wrong here

    Although this method separates credentials from the code, it still uses long-term IAM user access keys. These are static secrets that can be leaked if Parameter Store access is compromised. The IAM role approach is more secure because it uses temporary credentials that are automatically rotated.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may think storing credentials in a secure service like Systems Manager Parameter Store (Option D) is sufficient, but it still involves long-term IAM user keys, whereas the IAM role approach provides fully temporary credentials that are automatically rotated and never stored on the instance.

Detailed technical explanation

How to think about this question

When an IAM role is attached to an EC2 instance profile, the AWS credentials service automatically rotates temporary security credentials (access key, secret key, and session token) every six hours via the instance metadata service (IMDSv1 or IMDSv2). The application can retrieve these credentials from http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name, and the AWS SDKs handle this automatically, ensuring no long-term secrets are stored on disk. In a real-world scenario, this approach is critical for compliance with standards like SOC 2 or PCI DSS that prohibit hardcoded secrets.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related CLF-C02 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free CLF-C02 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this CLF-C02 question test?

Security and Compliance — This question tests Security and Compliance — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Create an IAM role with the required S3 read permissions. Attach the role to the EC2 instance profile. — Option B is correct because it uses an IAM role attached to an EC2 instance profile, which allows the application to obtain temporary AWS credentials via the instance metadata service (IMDS). This eliminates the need to store long-term access keys on the instance, satisfying the security requirement while granting the necessary S3 read permissions.

What should I do if I get this CLF-C02 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More CLF-C02 practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CLF-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 CLF-C02 exam.