Question 1,145 of 1,616
SecurityeasyMultiple ChoiceObjective-mapped

Quick Answer

The answer is to create an IAM role and attach it to the EC2 instance profile. This approach works because IAM roles are designed to be assumed by AWS services, and when attached to an instance profile, they automatically deliver temporary, rotating credentials to the EC2 instance via the metadata service. This eliminates the need to store any long-term access keys or secrets on the instance itself, directly addressing how to give EC2 instance access to AWS services without storing credentials. On the AWS Certified Developer Associate DVA-C02 exam, this concept tests your understanding of secure credential management versus insecure alternatives like hard-coded keys. A common trap is confusing IAM roles with Secrets Manager or Cognito, but remember: roles are for service-to-service permissions, not for user identities or secret storage. Memory tip: think of the instance profile as a secure, automated delivery truck that brings fresh temporary keys to your EC2 instance every time it needs them.

DVA-C02 Security Practice Question

This DVA-C02 practice question tests your understanding of security. 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 developer is creating an IAM policy to allow an EC2 instance to access an S3 bucket. Which AWS service should the developer use to securely provide credentials to the EC2 instance?

Question 1easymultiple choice
Full question →

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

IAM roles are designed to be assumed by AWS services like EC2. Instance profiles deliver temporary credentials to the EC2 instance automatically, avoiding hard-coded keys. Option A is wrong because access keys are long-term and not recommended for EC2. Option C is wrong because Secrets Manager is for secrets, not EC2 instance credentials. Option D is wrong because Cognito is for user identity.

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.

  • Use Amazon Cognito identity pools to generate temporary credentials for the instance.

    Why it's wrong here

    Cognito identity pools are for authenticating end users, not for EC2 instances.

  • Create an IAM user with access keys and store them on the instance.

    Why it's wrong here

    IAM access keys are long-term credentials and should not be stored on EC2 instances; they pose a security risk.

  • Create an IAM role and attach it to the EC2 instance profile.

    Why this is correct

    IAM roles provide temporary credentials via instance profiles, which is the secure best practice for EC2.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Store the AWS access key in AWS Secrets Manager and retrieve it at runtime.

    Why it's wrong here

    Secrets Manager is for secrets like database passwords, not for EC2 instance credentials; IAM roles are simpler and more appropriate.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Many certification questions include familiar terms but test a specific constraint. Read the exact wording before choosing an answer that is generally true but wrong for this case.

Detailed technical explanation

How to think about this question

This question should be treated as a scenario, not a definition check. Identify the problem, the constraint and the best action. Then compare each option against those facts.

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.
  • Use explanations to understand the rule behind the answer.

TExam Day Tips

  • Underline the problem statement mentally.
  • 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 DVA-C02 exam domain this question belongs to, then review the specific concept being tested. Practise related questions in that domain and focus on understanding why each wrong answer is tempting — not just why the correct answer is right.

Related practice questions

Related DVA-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 DVA-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 DVA-C02 question test?

Security — This question tests Security — 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 and attach it to the EC2 instance profile. — IAM roles are designed to be assumed by AWS services like EC2. Instance profiles deliver temporary credentials to the EC2 instance automatically, avoiding hard-coded keys. Option A is wrong because access keys are long-term and not recommended for EC2. Option C is wrong because Secrets Manager is for secrets, not EC2 instance credentials. Option D is wrong because Cognito is for user identity.

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

Identify which DVA-C02 exam domain this question belongs to, then review the specific concept being tested. Practise related questions in that domain and focus on understanding why each wrong answer is tempting — not just why the correct answer is right.

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

Same concept, more angles

3 more ways this is tested on DVA-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A developer needs to allow an EC2 instance to access an S3 bucket securely without storing long-term credentials on the instance. Which AWS service should be used to provide temporary credentials?

easy
  • A.Create an IAM user with S3 access and store the access key on the EC2 instance.
  • B.Configure a security group allowing outbound traffic to S3.
  • C.Attach an IAM role to the EC2 instance profile with S3 permissions.
  • D.Use an EC2 key pair to encrypt access to S3.

Why C: Option C is correct because IAM roles for EC2 allow the instance to assume a role and obtain temporary credentials from STS. Option A is wrong because IAM users have long-term credentials. Option B is wrong because EC2 key pairs are for SSH access, not API credentials. Option D is wrong because Security Groups are network firewalls.

Variation 2. A developer needs to allow an EC2 instance to access an S3 bucket without storing credentials on the instance. Which approach is the most secure?

easy
  • A.Create an IAM user with access keys and store them on the instance.
  • B.Use S3 bucket policy to allow the EC2 instance's public IP.
  • C.Store the access keys in Systems Manager Parameter Store and retrieve at runtime.
  • D.Use an IAM role for EC2 with a policy granting S3 access.

Why D: An IAM role attached to the EC2 instance provides temporary credentials via instance metadata, avoiding hardcoded keys.

Variation 3. A developer needs to allow an EC2 instance to access a DynamoDB table. Which IAM entity should be attached to the EC2 instance?

easy
  • A.IAM group
  • B.IAM role
  • C.IAM user
  • D.Resource-based policy on the DynamoDB table

Why B: An IAM role is the correct entity to attach to an EC2 instance because it provides temporary security credentials via the AWS Security Token Service (STS) that the instance can assume. This allows the EC2 instance to securely access the DynamoDB table without embedding long-term access keys in the instance. The role is attached to the instance profile, which the EC2 instance metadata service (IMDS) uses to retrieve credentials automatically.

Keep practising

More DVA-C02 practice questions

Last reviewed: Jun 20, 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 DVA-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 DVA-C02 exam.