Courseiva

SCS-C02 Identity and Access Management Practice Question

A developer needs to allow an EC2 instance to access an S3 bucket. Which is the best practice for granting permissions?

⚠ Common exam trap

SCS-C02 often tests the misconception that security groups or bucket policies can grant S3 access to EC2 instances — candidates must remember that IAM roles are the correct mechanism.

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 S3 access and attach it to the EC2 instance profile.

The best practice for granting an EC2 instance access to S3 is to create an IAM role with the necessary S3 permissions and attach it to the EC2 instance via an instance profile. This provides temporary credentials that are automatically rotated, eliminating the need to store long-term access keys on the instance. It follows the principle of least privilege and is the most secure method.

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 IAM user access keys in a configuration file on the EC2 instance.

    Why it's wrong here

    Storing IAM user access keys in a configuration file is insecure because long-term credentials remain valid indefinitely and are difficult to rotate. If the file is exposed through a misconfigured user-data script, a snapshot, or a compromised dependency, an attacker can use those keys to access S3 from anywhere. This approach also requires manual credential management on every instance, whereas IAM roles provide automatic, temporary credentials through the instance metadata service.

  • ✗

    Use a security group to allow the EC2 instance to access S3.

    Why it's wrong here

    Security groups are stateful virtual firewalls that filter traffic at the elastic network interface level, and they operate within a VPC; they do not govern API-level authorization for AWS services. S3 bucket access is granted via IAM policies or bucket policies, not by network rules. Even if you wanted to use a VPC gateway endpoint for S3, that requires a route-table entry and an endpoint policy, not a security group. The security group cannot allow an EC2 instance to call S3 APIs because S3 is a global AWS service with HTTP(S) endpoints, not a resource inside the VPC.

  • ✗

    Attach an S3 bucket policy that grants access to the EC2 instance ID.

    Why it's wrong here

    An S3 bucket policy can only grant permissions to IAM principals, such as an IAM user, role, or federated identity; an EC2 instance ID is not a valid principal. The Principal field in a bucket policy must reference an IAM entity, and any attempt to put an instance ID there will be rejected as invalid. Moreover, a bucket policy cannot be used to authenticate a request; authentication must be done with IAM credentials, which an instance can only obtain by assuming an IAM role.

  • ✓

    Create an IAM role with S3 access and attach it to the EC2 instance profile.

    Why this is correct

    Create an IAM role with an S3 access policy, then place that role in an instance profile and attach the profile to the EC2 instance at launch or via the console/API. When the instance starts, it uses the role's trust policy to assume the role and receives temporary credentials from the instance metadata service (IMDSv1 or IMDSv2) that are automatically rotated. The SDK then uses these credentials to sign requests to S3 for the duration of the role session, enforcing the exact permissions granted by the role while avoiding the need to embed static keys.

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

This SCS-C02 question is part of Courseiva's 1,205-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

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