DVA-C02 Exam Domain Deep Dive: Security (26% of the Test)

TL;DR
- Security is 26% of DVA-C02 — roughly 17 of the 65 questions, and the domain that most often separates a 700 from a 720 scaled score.
- Almost every question in this domain collapses into one of three decisions: which credential source, which encryption mode, which authorizer.
- You learn it by breaking it on purpose: an expired presigned URL, a denied
kms:Decrypt, IMDSv2 timing out inside a container. Three hours of that beats ten hours of video.
The failure pattern is consistent. People with real production hours still lose this domain because they recognize the services but not the decision boundaries — when a presigned URL actually dies, why an IAM policy on a role is not enough for a KMS key, why a Lambda authorizer returns 401 with a valid token. The exam tests boundaries, not vocabulary.
What 26% Actually Covers, and Where the Points Hide
The official guide splits DVA-C02 into four domains. Only one of them asks you to reason about identity and cryptography as a first-class skill.
| Domain | Weight | What it punishes in practice |
|---|---|---|
| Development with AWS Services | 32% | SDK calls, DynamoDB modeling, API Gateway integration types |
| Security | 26% | Credential resolution order, key policy vs IAM policy, token flows |
| Deployment | 24% | SAM/CDK packaging, CodeDeploy hooks, blue/green rollback |
| Troubleshooting and Optimization | 18% | X-Ray, CloudWatch metrics, cold starts, throttling |
The security domain carries three tasks: make authenticated calls to AWS services, implement encryption, and implement application authentication and authorization. Mapped to real code, that's the credentials your SDK picks up at runtime, the SSE mode on your bucket and the key policy behind it, and whatever sits in front of your API Gateway route.
- 代购 SSL 证书 · DigiCert / GeoTrust / RapidSSL 单域名与通配符
- SSL证书申请 · SSL证书购买 · SSL证书安装配置
- SSL域名证书申请 · 小程序证书 · 国外SSL证书
That third task is where extra reading helps most. Cognito user pools issue OIDC tokens; identity pools exchange them for temporary AWS credentials. API Gateway can authorize with IAM, a Cognito authorizer, a Lambda authorizer (TOKEN or REQUEST), or a JWT authorizer on HTTP APIs. Knowing which layer returns which HTTP status is worth several questions by itself.
The Credential Chain: One Mental Model, Many Questions
Every question about "how does the app get credentials" is the same question in a different costume. The SDK resolves in a fixed order: explicit constructor arguments, then environment variables (AWS_ACCESS_KEY_ID), then the shared config/credentials file (~/.aws/credentials, AWS_PROFILE), then container credentials (AWS_CONTAINER_CREDENTIALS_RELATIVE_URI), then EC2 instance metadata. Confirm what the process actually picked up before theorizing.
aws sts get-caller-identity --output json
# {
# "UserId": "AROA...:app-task",
# "Account": "111122223333",
# "Arn": "arn:aws:sts::111122223333:assumed-role/app-task/abc123"
# }
If that ARN starts with `arn:aws:iam::` and ends in a user name, you are running on long-lived keys — a classic wrong answer. Production code should assume a role and carry temporary credentials.
```bash
read -r AK SK TOKEN <<<"$(aws sts assume-role
--role-arn arn:aws:iam::111122223333:role/AppReadRole
--role-session-name dva-study
--duration-seconds 900
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]'
--output text)"
export AWS_ACCESS_KEY_ID="$AK" AWS_SECRET_ACCESS_KEY="$SK" AWS_SESSION_TOKEN="$TOKEN"
aws sts get-caller-identity --query Arn --output text
On EC2, IMDSv2 requires a token first, and containers need `HttpPutResponseHopLimit` set to 2 — otherwise the call to `169.254.169.254:80` times out and the SDK raises a credential-unavailable error instead of anything useful. Verify from inside the instance or task:
```bash
TOKEN=$(curl -sX PUT "http://169.254.169.254/latest/api/token"
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -s -H "X-aws-ec2-metadata-token: $TOKEN"
http://169.254.169.254/latest/meta-data/iam/security-credentials/
## Encryption: Pick the Mode by Who Holds the Key
Exam encryption questions are usually "which option meets the requirement with the least operational overhead". Decide by who owns the key material and who must be audited.
| Mode | Key custody | Who decrypts | Typical exam trigger |
|---|---|---|---|
| SSE-S3 (AES-256) | AWS-managed | S3 on your behalf | "no key management", cheap, no audit trail per object |
| SSE-KMS | You, via KMS CMK | KMS, needs `kms:Decrypt` | "audit who accessed data", bucket keys to cut KMS calls |
| SSE-C | Client sends key per request | You supply key each call | "customer must retain keys", HTTPS required |
| Client-side | Your app encrypts before upload | Your app | "data must be encrypted before it leaves the client" |
The trap that costs people points: an IAM policy granting `kms:Decrypt` is not sufficient on its own. KMS key policies are resource policies, and the key policy must delegate to IAM (usually through the account root) for IAM to be able to allow anything. The error text is unmistakable:
```text
An error occurred (AccessDeniedException) when calling the Decrypt operation:
User: arn:aws:sts::111122223333:assumed-role/app-task/abc123 is not authorized
to perform: kms:Decrypt on resource: arn:aws:kms:us-east-1:111122223333:key/8f2a...
because no identity-based policy allows the kms:Decrypt action
Read the key policy before touching IAM:
```bash
aws kms get-key-policy
--key-id 8f2a1111-2222-3333-4444-555566667777
--policy-name default
--query Policy --output text | jq '.Statement[] | {Sid, Effect, Principal, Action}'
Two more details worth memorizing: S3 Bucket Keys cut KMS request volume by up to 99% for high-request workloads, and CloudFront viewer certificates must live in `us-east-1` regardless of where your origin runs. That region rule shows up in deployment questions too.
## Troubleshooting: The Presigned URL That Died at 02:40 UTC
A file-download flow worked perfectly in testing and failed for every user the next morning. The S3 response was plain and unforgiving:
```xml
<Error><Code>AccessDenied</Code><Message>Request has expired</Message>
<X-Amz-Expires>43200</X-Amz-Expires><Expires>2026-01-12T15:15:00Z</Expires></Error>
The code called `generate_presigned_url` with `ExpiresIn=43200` from a Lambda using its execution role. Nothing in that code was "wrong" — but the URL was signed with temporary credentials from a session that expires in one hour. A presigned URL can never outlive the credentials that signed it, so the 12-hour expiry was fiction. Step one was parsing the query string to see the actual timeline instead of trusting the argument:
```bash
python3 - <<'PY'
from urllib.parse import urlparse, parse_qs
from datetime import datetime, timezone
u = "https://app-reports.s3.us-east-1.amazonaws.com/q1.pdf?X-Amz-Date=20260112T031500Z&X-Amz-Expires=43200"
q = parse_qs(urlparse(u).query)
signed = datetime.strptime(q["X-Amz-Date"][0], "%Y%m%dT%H%M%SZ").replace(tzinfo=timezone.utc)
print("signed:", signed, "declared expiry (s):", q["X-Amz-Expires"][0])
PY
Then confirm the ceiling on the role itself:
```bash
aws sts get-role --role-name app-task-role
--query 'Role.MaxSessionDuration' --output text
# 3600
The fix was architectural, not a header tweak: the download endpoint now assumes a dedicated role with `MaxSessionDuration` of 43200 and a trust policy scoped to that single Lambda function, and the URL lifetime sits at 3600 seconds. Everything downstream re-requests a URL on 403 instead of caching it. `X-Amz-Expires` above 604800 is rejected outright, so seven days is the hard ceiling for SigV4 — and only when the signing credentials last that long, which they almost never do.
## Registering: Cost, Format, and Which Exam Comes First
DVA-C02 runs 65 questions in 130 minutes — about two minutes each — and scores on a 100–1000 scale with 720 to pass. The multiple-choice format includes multi-select items where partial credit does not exist. Registration goes through Pearson VUE (test center or online proctored) and the result is valid for three years. In the US the fee is USD 150; regional pricing differs, and a retake costs full price with a 14-day wait between attempts.
| Exam | Minutes | Questions | Passing | USD (US) |
|---|---|---|---|---|
| CLF-C02 Cloud Practitioner | 90 | 65 | 700 | 100 |
| SAA-C03 Solutions Architect Associate | 130 | 65 | 720 | 150 |
| DVA-C02 Developer Associate | 130 | 65 | 720 | 150 |
| SOA-C02 SysOps Associate | 180 | 75 + labs | 750 | 150 |
If you are choosing an order: SAA-C03 first builds the architecture vocabulary that DVA assumes, and CLF-C02 is only worth it if you need a credential fast with minimal hands-on time. DVA is the better first associate exam when your day job is code — you already think in SDK calls and API responses, and the deployment domain reads naturally.
## When Not to Take DVA-C02 Yet
Skip it for now if you have never wired a Lambda function to an API Gateway route, never queried DynamoDB from application code, and cannot explain the difference between a 401 and a 403 in your own stack. Also skip it if your next 12 months are infrastructure and on-call: SOA-C02 maps closer to that work. The exam rewards people who have shipped and then broken something on AWS — the scenarios are written from that vantage point.
## Study Order: Three Weeks, Roughly 30 Hours
| Week | Focus | Hands-on artifact |
|---|---|---|
| 1 | Credential chain, IAM policy evaluation, STS | Assume a cross-account role from CLI and log the ARN |
| 2 | KMS, SSE modes, presigned URLs, TLS | Rotate a CMK, break the key policy, read the error |
| 3 | Cognito, API Gateway authorizers, timing | Lambda authorizer returning 401 vs 403 on purpose |
Use the free 20-question official practice set on AWS Skill Builder to calibrate, then keep a running list of every question you got right by guessing — that list is your real syllabus. Skip memorizing service limits you have not hit. Do memorize the credential resolution order, the four encryption modes, and the four authorizer types; those three lists cover most of the 17 questions.
## Exam Technique: Keyword Spotting Beats Recall
The exam's distractor style is directional. "Least operational overhead" points at managed features (bucket keys, Cognito hosted UI, JWT authorizer). "Most secure" points at scoped IAM policies or temporary credentials, never wildcard actions. "No code changes" or "no credentials in the application" points at IAM roles and instance profiles. When an answer contains `"Action": "*"` or a long-lived access key, it is usually the wrong one even when it works.
Work in two passes. First pass, 80 minutes, answer what is obvious and flag anything requiring arithmetic or policy reading. Second pass, 35 minutes, on flagged items. Keep 15 minutes as buffer — multi-select questions eat time because every option needs evaluating. If two answers both look valid, re-read the requirement sentence for the tiebreaker word; it is almost always there.
We do a lot of credential and key-policy cleanup for small teams, and the same three mistakes show up: session tokens out
Leave a Reply