Question 1,532 of 724
DVA-C02 Security Practice Question
Exhibit
Refer to the exhibit.
```yaml
# CloudFormation template snippet
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Code: ...
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
Runtime: python3.9
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: LambdaPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: logs:*
Resource: '*'
```Refer to the exhibit. A developer deploys this CloudFormation template. The Lambda function needs to write objects to an S3 bucket named 'my-app-bucket'. What must the developer add to the template?
⚠ Common exam trap
Watch out — candidates often confuse bucket-level ARNs with object-level ARNs, selecting overly permissive options like `s3:*` on the bucket ARN instead of scoping the exact action and resource, or incorrectly assuming an S3 bucket policy is needed for same-account Lambda 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
✓
Add a new policy statement to LambdaExecutionRole allowing 's3:PutObject' on 'arn:aws:s3:::my-app-bucket/*'.
The Lambda function requires an IAM policy attached to its execution role to grant permissions for specific S3 actions. The `s3:PutObject` action on the `arn:aws:s3:::my-app-bucket/*` resource ARN precisely allows writing objects to the bucket, following the principle of least privilege. Without this policy statement, the Lambda function will receive an access denied error when trying to write to S3.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add an S3 bucket policy allowing the Lambda function's ARN to write objects.
Why it's wrong here
An S3 bucket policy grants cross-account access or applies to anonymous principals, but here the Lambda function and bucket reside in the same AWS account, so resource-based policies are unnecessary; the correct mechanism is an IAM execution-role policy attached to the Lambda function. This option is tempting because bucket policies are the standard way to authorise writes from external accounts or unauthenticated callers, and would be correct if the function belonged to a different AWS account.
- ✗
Add a policy statement to LambdaExecutionRole allowing 's3:*' on 'arn:aws:s3:::my-app-bucket'.
Why it's wrong here
This option is incorrect because it violates the principle of least privilege and uses an imprecise resource ARN. Granting 's3:*' provides permissions for all S3 actions, far exceeding the requirement to simply write objects, which is poor security practice. Furthermore, specifying 'arn:aws:s3:::my-app-bucket' as the resource only grants permissions on the bucket itself, not on the objects *within* it, meaning 'PutObject' operations would still fail.
- ✗
Add a KMS key policy to allow the Lambda function to use a customer managed key.
Why it's wrong here
This option is irrelevant to the problem statement unless the S3 bucket is specifically configured for Server-Side Encryption with AWS KMS (SSE-KMS). By default, S3 buckets use S3-managed encryption (SSE-S3) or no encryption, neither of which requires the uploader to have explicit permissions on a KMS key. A KMS key policy would only be necessary if the Lambda function needed to encrypt or decrypt objects using a Customer Managed Key.
- ✓
Add a new policy statement to LambdaExecutionRole allowing 's3:PutObject' on 'arn:aws:s3:::my-app-bucket/*'.
Why this is correct
This is the correct solution as it precisely grants the necessary permissions while adhering to the principle of least privilege. Attaching a policy statement to the 'LambdaExecutionRole' is the standard method for providing a Lambda function with permissions to interact with other AWS services. The 's3:PutObject' action is the specific permission required to write objects, and 'arn:aws:s3:::my-app-bucket/*' correctly scopes this permission to all objects within the specified S3 bucket.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
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 →
Last reviewed: Jun 24, 2026
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.
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.
Sign in to join the discussion.