DVA-C02 practice question · Security
A Lambda function's execution role has the AWS managed AmazonS3FullAccess policy attached.
A Lambda function's execution role has the AWS managed AmazonS3FullAccess policy attached. The function only ever downloads objects from one bucket, named reports-bucket. Which replacement policy best follows the principle of least privilege?
- AA customer managed policy allowing s3:GetObject on arn:aws:s3:::reports-bucket/*
- BThe AWS managed AmazonS3ReadOnlyAccess policy in place of AmazonS3FullAccess
- CA customer managed policy allowing s3:* on arn:aws:s3:::reports-bucket and its objects
- DA customer managed policy allowing s3:GetObject with the Resource element set to "*"
Show the answer and explanation
Correct answer: A) A customer managed policy allowing s3:GetObject on arn:aws:s3:::reports-bucket/*
Least privilege means limiting both the actions and the resources. Here that is s3:GetObject on arn:aws:s3:::reports-bucket/* only.
Why each option is right or wrong
- A) Correct. It grants only the one action the function uses, and only on the objects in that bucket. Object-level actions such as GetObject apply to object ARNs (bucket-name/*).
- B) Incorrect. This removes write access, but it still allows reads on every bucket in the account. AWS managed policies are generic, and IAM recommends customer managed policies scoped to your own use case.
- C) Incorrect. The resource is scoped correctly, but s3:* allows writes, deletes and configuration changes that the function never needs.
- D) Incorrect. The action is scoped correctly, but a wildcard resource lets the function read objects from every bucket instead of only reports-bucket.
- Exam domain
- Security · 26% of DVA-C02
- Question type
- Multiple choice (one answer)
Related DVA-C02 questions
- A developer is deploying an application to Amazon EC2 and plans to put an IAM user's access key in the application's…Security
- A developer is comparing AWS managed KMS keys (such as aws/s3) with customer managed KMS keys (symmetric, with key…Security
- An IAM policy needs to restrict access so that a set of API calls can only succeed when made over an encrypted (HTTPS)…Security
- A developer configures an Amazon ECR private registry to use basic scanning with scan on push.Security
All 67 free DVA-C02 questions by domain · 15 sample questions on one page
Practise the full DVA-C02 exam
This question is one of a small free sample from the CertRidge DVA-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.
Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.
Worth reading: DVA-C02 cheat sheet, Lambda, DynamoDB, API Gateway, IAM and Cognito, messaging, CI/CD and X-Ray in tables, plus what DVA-C03 changes.