DVA-C02 Security Practice Question
A mobile application must let authenticated users upload only to their own S3 prefix. Which approach best follows least privilege?
⚠ Common exam trap
The trap here is that candidates might choose Option B (hardcoded key) thinking it's simpler, missing that it exposes a static credential that can be compromised, or Option C (public bucket) assuming client-side validation is sufficient, when in fact AWS requires server-side enforcement for security.
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
✓
Use Cognito identity credentials with an IAM policy scoped to the user's prefix using policy variables
It uses Amazon Cognito identity pools to issue temporary AWS credentials scoped to a specific S3 prefix via IAM policy variables (e.g., `${cognito-identity.amazonaws.com:sub}`). This ensures each authenticated user can only upload to their own prefix (e.g., `uploads/${user_id}/`), adhering to the principle of least privilege by granting no more access than necessary.
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 Cognito identity credentials with an IAM policy scoped to the user's prefix using policy variables
Why this is correct
This is the correct approach because AWS Cognito Identity Pools can issue temporary, fine-grained AWS credentials to authenticated users. An associated IAM policy can then leverage policy variables, such as ${cognito-identity.amazonaws.com:sub}, to dynamically scope S3 upload permissions to a specific user's unique prefix within a bucket. This ensures each user can only write to their designated folder, fulfilling the requirement for authenticated users to upload only to their own specific location.
- ✗
Use a single hardcoded access key in the app
Why it's wrong here
Using a single hardcoded access key in the application is a severe security vulnerability and does not meet the requirement for per-user prefixing. All users would share the same static credentials, granting them identical permissions, which violates the principle of least privilege. If compromised, this key would provide unauthorized access to all resources it is permitted to interact with, not just a single user's designated upload area.
- ✗
Make the bucket public and validate names in the client
Why it's wrong here
Making the S3 bucket public and relying on client-side validation for object names is fundamentally insecure and fails to meet the requirement. A public bucket allows anyone, authenticated or not, to potentially upload objects, bypassing any client-side checks which are easily circumvented by malicious actors. This approach provides no server-side enforcement of user authentication or specific upload prefixes, leaving the bucket vulnerable to unauthorized writes and data integrity issues.
- ✗
Give every user AmazonS3FullAccess
Why it's wrong here
Granting every user `AmazonS3FullAccess` is an overly permissive approach that violates the principle of least privilege and does not meet the requirement to restrict uploads to a user's specific prefix. This policy provides unrestricted read, write, and delete access to all S3 buckets and objects within the AWS account. Consequently, any user could access or modify any object, not just those within their designated upload location, making it impossible to enforce per-user isolation.
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 |
Go deeper
Related to this question
About these practice questions
One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.