Courseiva
DeploymentmediumMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is using AWS CloudFormation to deploy a stack that includes an Amazon S3 bucket and an AWS Lambda function. The Lambda function needs to be granted permission to read objects from the S3 bucket. Which resource should the developer define in the CloudFormation template to provide these permissions?

⚠ Common exam trap

Watch out — candidates often confuse resource-based policies (like S3 bucket policies or Lambda permission statements) with identity-based policies (like IAM roles), thinking a bucket policy alone can grant the Lambda function access, when in fact the Lambda function needs an IAM role with the appropriate permissions to assume and use.

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

AWS::IAM::Role

The Lambda function requires an IAM role (AWS::IAM::Role) with a policy that grants s3:GetObject permissions on the S3 bucket. This role is assumed by the Lambda service at runtime, allowing the function to read objects from the bucket. The role must include a trust policy that allows lambda.amazonaws.com to assume it.

Answer analysis

Option-by-option breakdown

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

  • AWS::IAM::Role

    Why this is correct

    An AWS::IAM::Role is the correct and standard mechanism for granting a Lambda function the necessary permissions to interact with other AWS services, such as reading from an S3 bucket. This resource defines an identity that the Lambda function assumes during execution, specified by an `AssumeRolePolicyDocument` allowing the `lambda.amazonaws.com` service principal. Attached policies within the role then explicitly define the actions (e.g., `s3:GetObject`) the function is authorized to perform on specified resources.

  • AWS::Lambda::Permission

    Why it's wrong here

    AWS::Lambda::Permission is used to grant another AWS service or account the explicit permission to invoke a specific Lambda function. This resource creates a resource-based policy directly on the Lambda function itself, allowing services like S3, API Gateway, or CloudWatch Events to trigger it. It does not, however, grant the Lambda function any outbound permissions to access other AWS resources; its sole purpose is to manage inbound invocation access.

  • AWS::S3::BucketPolicy

    Why it's wrong here

    Incorrect. A bucket policy controls access to the S3 bucket, but the Lambda function would also need an IAM role. Using a bucket policy alone would require knowing the principal ARN; typically the IAM role approach is cleaner for EC2/Lambda.

  • AWS::IAM::ManagedPolicy

    Why it's wrong here

    An AWS::IAM::ManagedPolicy defines a reusable set of permissions that can be attached to multiple IAM identities, such as users, groups, or roles. While a managed policy is crucial for specifying the actual permissions (e.g., `s3:GetObject`), it is not an identity that can be directly assumed by a Lambda function. The `AWS::IAM::Role` is the primary identity resource that holds these policies and is assumed by the Lambda function to gain the specified permissions.

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 DVA-C02 question is part of Courseiva's 724-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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.