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

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?

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.

    When this WOULD be correct

    If the question explicitly allowed storing long-term credentials and required a simple, direct method to provide access without setting up IAM roles or instance profiles, storing credentials in a configuration file would be a straightforward solution.

  • 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.

    When this WOULD be correct

    If the question required granting cross-account access to an S3 bucket without using IAM roles, and the EC2 instance had a static public IP (Elastic IP) in a VPC with a VPC endpoint, a bucket policy with aws:SourceIp condition could be used, but only for public IPs, not private.

  • 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.

    When this WOULD be correct

    If the question required using temporary credentials but the instance cannot use an IAM role (e.g., the instance is not in EC2 or is in an on-premises environment), then storing access keys in Parameter Store and retrieving them at runtime would be a valid solution to avoid hardcoding credentials.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The CLF-C02 exam frequently reuses these exact scenarios with slightly different constraints.

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

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.

Store the AWS access key ID and secret access key in a configuration file on the instance's local disk.Wrong answer — click to see why

Why this is wrong here

Storing long-term AWS credentials (access key ID and secret access key) on the instance violates the security requirement that no long-term credentials be stored on the instance.

★ When this WOULD be the correct answer

If the question explicitly allowed storing long-term credentials and required a simple, direct method to provide access without setting up IAM roles or instance profiles, storing credentials in a configuration file would be a straightforward solution.

Why candidates choose this

Candidates may be familiar with configuring applications using static credentials and overlook the security requirement against storing long-term credentials on the instance.

Write a resource-based policy on the S3 bucket that allows access based on the private IP address of the EC2 instance.Wrong answer — click to see why

Why this is wrong here

S3 bucket policies cannot grant access based on EC2 instance private IP addresses because private IPs are not a supported condition key for S3 actions; they are not reliably associated with the instance in a way that S3 can evaluate.

★ When this WOULD be the correct answer

If the question required granting cross-account access to an S3 bucket without using IAM roles, and the EC2 instance had a static public IP (Elastic IP) in a VPC with a VPC endpoint, a bucket policy with aws:SourceIp condition could be used, but only for public IPs, not private.

Why candidates choose this

Candidates may think that IP-based access control is a simple way to restrict access without managing credentials, and they might overlook that S3 bucket policies support IP address conditions only for public IPs, not private IPs within a VPC.

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.Wrong answer — click to see why

Why this is wrong here

The question explicitly requires that no long-term AWS credentials be stored on the instance. While Parameter Store avoids storing keys on the disk, the application still retrieves and uses long-term IAM user access keys at runtime, violating the security requirement.

★ When this WOULD be the correct answer

If the question required using temporary credentials but the instance cannot use an IAM role (e.g., the instance is not in EC2 or is in an on-premises environment), then storing access keys in Parameter Store and retrieving them at runtime would be a valid solution to avoid hardcoding credentials.

Why candidates choose this

Candidates may think that using Parameter Store eliminates the need to store credentials on the instance's local disk, but they overlook that the IAM user access keys are still long-term credentials that are retrieved and used by the application, which does not meet the 'no long-term credentials' requirement.

Analysis generated from the official CLF-C02blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

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.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

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

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.