☁️ AWS DVA-C02

Cheat sheet · Tổng ôn

AWS Developer
Associate DVA-C02

Kiến thức cô đọng theo nhóm dịch vụ cho kỳ thi AWS Certified Developer Associate — đi kèm ngân hàng 483 câu hỏi có giải thích. Dành cho người ít thời gian, không xem full video.

Development 32%Serverless, storage, DB, messaging
Security 26%IAM, Cognito, KMS, secrets
Deployment 24%IaC, CI/CD, Beanstalk, ECS
Troubleshooting 18%CloudWatch, X-Ray, CloudTrail
/

Bấm / để tìm nhanh · Nút Đã ôn lưu tiến độ · Bấm Luyện đề để làm 483 câu trắc nghiệm.

Tổng quan kỳ thi

Nắm format + 4 domain là xong bước định hướng. Trọng số là thứ nên dồn thời gian.

Format kỳ thi

Tiêu chíChi tiết
MãAWS Certified Developer — Associate (DVA-C02)
Số câu / thời gian65 câu · 130 phút (+30 phút nếu không phải tiếng mẹ đẻ)
Điểm100–1000, đỗ ≈ 720
Dạng câuMultiple choice (1 đáp án) + Multiple response (2 đáp án trở lên); ~15 câu không tính điểm (pretest)
Hiệu lực3 năm · phí 150 USD

Câu hỏi là tình huống (scenario) với yêu cầu dạng “LEAST overhead”, “MOST secure”, “MOST cost-effective”. Đọc kỹ từ khoá này trước khi chọn.

4 domain và trọng số

Domain%
Development with AWS Services32%
Security26%
Deployment24%
Troubleshooting & Optimization18%

Dồn lực vào 3 domain đầu (82%). Troubleshooting thường lồng vào các câu tình huống.

Chiến lược ôn cho người ít thời gian

  1. Đọc cheat sheet này theo nhóm, ghi nhớ các con số/giới hạn (con số hay được hỏi).
  2. Làm ngân hàng 483 câu ở trang Luyện đề — mỗi câu đều có giải thích “vì sao”.
  3. Chú ý các câu gắn nhãn gây tranh cãi (đáp án đã hiệu chỉnh) — đừng học thuộc đáp án cũ.
  4. Ôn cách quãng + làm lại các câu sai; không học thuộc lòng đáp án.

Mẹo làm bài: loại trừ đáp án sai hiển nhiên (giải pháp thủ công, hardcode, EC2 khi có serverless) trước, rồi so sánh 2 đáp án còn lại theo từ khoá yêu cầu.

Compute & Serverless

Lambda + API Gateway + Step Functions là “bộ ba serverless” chiếm nhiều điểm nhất kỳ thi.

Lambda — các con số và khái niệm bắt buộc nhớ

MụcGiá trị / ý nghĩa
TimeoutTối đa 15 phút
Memory128 MB – 10 GB; CPU + network tỷ lệ theo memory (không chỉnh CPU riêng)
ConcurrencyUnreserved (mặc định 1000/region) · Reserved (giới hạn + đảm bảo) · Provisioned (giữ warm, hết cold start)
Version / AliasVersion bất biến; Alias trỏ version, weighted routing để canary/blue-green
InvocationSync (RequestResponse) · Async (Event, retry 2×, cần DLQ/destination) · Stream/queue (polling)
Package50 MB zip / 250 MB unzip; Layers (tối đa 5); Env var ≤ 4 KB
PermissionsExecution role (IAM) cho quyền; resource-based policy cho cross-account
Cold startProvisioned concurrency, SnapStart (Java); tránh VPC nếu không cần

Lỗi AccessDenied khi ghi DynamoDB/S3 = thiếu quyền trong execution role, không phải lỗi code. Lambda bị throttle do vượt concurrency → tăng reserved/provisioned hoặc dùng retry + DLQ.

API Gateway — ba loại

LoạiDùng khi
REST APIĐầy đủ tính năng: usage plan + API key, caching, mapping template, Lambda/Cognito/IAM authorizer
HTTP APIRẻ & nhanh hơn; chỉ Lambda + HTTP proxy; JWT authorizer (Cognito/OIDC)
WebSocket APIKết nối 2 chiều (chat, realtime); route $connect/$disconnect
  • Stage + stage variable; canary deployment theo % traffic
  • Cache ở stage: TTL mặc định 300s, tối đa 3600s
  • Timeout 29s; payload 10 MB
  • CORS (OPTIONS), custom domain + CloudFront

Step Functions

  • Standard (max 1 năm, exactly-once) vs Express (5 phút, throughput cao, at-least-once)
  • States: Task, Choice, Parallel, Map, Wait, Pass, Succeed, Fail
  • Retry (backoff) + Catch để xử lý lỗi, có timeout từng bước
  • Callback: waitForTaskToken — chờ sự kiện ngoài
  • Service integration trực tiếp (DynamoDB, SQS…) bỏ bớt Lambda → rẻ + nhanh

“Chạy các bước theo thứ tự + retry khi lỗi + ít bảo trì” → Step Functions (không phải Lambda thuần hay Batch/Glue).

Storage (S3)

S3 là object storage — mọi “lưu file” trong đề đều xoay quanh S3 + pre-signed URL + encryption.

Giới hạn & cơ chế

  • Object 0 B – 5 TB; single PUT ≤ 5 GB (multipart khuyên dùng > 100 MB, bắt buộc > 5 GB)
  • Versioning (bật để bảo vệ khỏi xoá/ghi đè); strong consistency
  • Bucket name duy nhất toàn cầu
  • Lifecycle: transition storage class + expire object
Storage classDùng khi
StandardTruy cập thường xuyên
Intelligent-TieringTruy cập không đoán được
IA / One Zone-IAÍt truy cập, chịu được mất AZ (One Zone)
Glacier (Instant/Flexible/Deep)Archive, truy xuất lâu (phút → giờ)

Bảo mật & chia sẻ

  • Encryption: SSE-S3, SSE-KMS, SSE-C, client-side; bucket default encryption
  • Pre-signed URL: cấp quyền tạm thời (tối đa 7 ngày) cho upload/download
  • CloudFront signed URL/cookie khi cần kiểm soát người xem qua CDN
  • Access: IAM policy + bucket policy (+ resource-based)
  • Object Lock (WORM), MFA delete
  • CORS cho trình duyệt; S3 Object Lambda (biến đổi dữ liệu lúc GET)

Tính năng hay hỏi

  • Event Notifications → SQS/SNS/Lambda/EventBridge khi có sự kiện object
  • Replication CRR/SRR (bắt buộc bật versioning)
  • Static website hosting + CloudFront
  • Transfer Acceleration (upload nhanh qua edge location)
  • S3 Select (query một phần CSV/JSON)

Bẫy: S3 không phải file system — không mount thật được (đáp án “mount S3 như ổ đĩa” thường sai); pattern chuẩn là lưu metadata ở DynamoDB + file lớn ở S3 (giữ object key).

Database

DynamoDB (NoSQL) và RDS/Aurora/ElastiCache (quan hệ + cache). Nhiều câu là chọn đúng loại database.

DynamoDB — cần nhớ

Chủ đềĐiểm chính
Primary keyPartition key (+ optional sort key); item tối đa 400 KB
Capacity1 RCU = 1 strong read 4 KB/s (hoặc 2 eventual); 1 WCU = 1 write 1 KB/s; Provisioned hoặc On-demand
GSI vs LSIGSI: khác partition key, eventual, tạo sau được. LSI: cùng partition key + khác sort key, phải tạo lúc tạo bảng, strong consistency
Đọc/ghiQuery (theo PK, rẻ) vs Scan (đắt — tránh); pagination bằng LastEvaluatedKey
PatternConditional write (optimistic locking), transactions, TTL, Streams → Lambda
BatchBatchGet/BatchWrite ≤ 100 items hoặc 16 MB; UnprocessedKeys → retry exponential backoff
Hot partitionChọn partition key có nhiều giá trị phân biệt (tránh genre/status ít giá trị)

DAX = cache in-memory cho DynamoDB (đọc eventual, microsecond). Muốn sort/rank hoặc cache cho RDS → ElastiCache for Redis, không phải DAX.

RDS / Aurora / ElastiCache

ChọnKhi
RDS Multi-AZHA/failover (standby không nhận đọc)
Read ReplicaTăng đọc (async), trỏ query đọc vào endpoint replica
AuroraMySQL/PostgreSQL compatible, nhanh hơn, storage tự mở rộng, reader endpoint
ElastiCache RedisSorted set/ranking, encryption at rest + transit, HA
ElastiCache MemcachedCache đơn giản, multi-thread, không encryption

Bẫy: Multi-AZ để HA, không để đọc scale. Read-heavy → Read Replica (hoặc ElastiCache) chứ không phải Multi-AZ.

Chọn đúng database

  • Schema linh hoạt, truy cập theo key, scale lớn → DynamoDB
  • Quan hệ, JOIN, transaction SQL → RDS/Aurora
  • Cache thường dùng + sort/rank → ElastiCache Redis
  • Cache key-value đơn giản → ElastiCache Memcached
  • Đọc DynamoDB nhanh hơn nữa → DAX

Messaging & Streaming

SQS/SNS/EventBridge để giải ghép, Kinesis để streaming. Phân biệt chính xác ba loại messaging là một nhóm câu chắc ăn.

SQS

  • Standard: at-least-once, throughput gần như vô hạn
  • FIFO: exactly-once, giữ thứ tự, ~300 msg/s
  • Visibility timeout, retention 1 phút – 14 ngày (mặc định 4 ngày), tối đa 256 KB
  • Long polling (20s) giảm số request + chi phí
  • DLQ: maxReceiveCount để chuyển message lỗi sang queue chết

SNS & EventBridge

  • SNS: pub/sub, fan-out tới nhiều subscriber (SQS, Lambda, HTTP, email/SMS)
  • SNS message filtering (subscription filter policy) — một topic, lọc theo attribute
  • EventBridge: event bus + rule (pattern) + target; route event từ AWS services
  • Cross-account EventBridge: resource policy trên event bus

Chọn nhanh: SQS = hàng đợi worker; SNS = fan-out 1→nhiều; EventBridge = định tuyến event theo pattern từ AWS services.

Kinesis

  • Data Streams: 1 shard = 1 MB/s hoặc 1000 records/s ghi, 2 MB/s đọc; retention 24h – 365 ngày
  • Firehose: giao gần realtime tới S3/Redshift/ES/Splunk, không quản shard, transform bằng Lambda
  • Analytics: SQL/Flink xử lý stream
  • Partition key → shard (hash); hot shard khi key phân bổ lệch
  • Consumer: KCL hoặc Lambda (có on-failure destination/DLQ); enhanced fan-out

Bẫy: ProvisionedThroughputExceededException → retry + exponential backoff + giảm tần suất/kích thước (hoặc thêm shard); đổi PutRecords → PutRecord không giải quyết.

Security & IAM

Domain Security (26%) xoay quanh 3 thứ: IAM quyền hạn, Cognito định danh, KMS mã hoá.

IAM & STS

  • Policy: Effect / Action / Resource / Condition
  • Đánh giá quyền: explicit Deny thắng tất cả; không Allow → implicit Deny
  • Role cho service: Lambda execution role, EC2 instance profile
  • STS AssumeRole → temporary credentials (cross-account, federation)
  • Credential provider chain (EC2): env → credentials file → instance profile
  • PassRole: quyền trao role cho service

Bẫy: access key trong credentials file được ưu tiên hơn instance profile trong provider chain → dễ gây nhầm lẫn “ai đang gọi”.

Cognito — user pool vs identity pool

User poolIdentity pool
Đăng ký/đăng nhập, MFA, JWTCấp credentials AWS tạm thời
API Gateway Cognito authorizerIAM role theo ${cognito-identity.amazonaws.com:sub}
  • Lambda triggers: pre/post sign-up, post authentication (gửi mail thông báo login), custom message
  • Ứng dụng mobile đăng ký/đăng nhập → User pool; truy cập S3/DynamoDB theo user → Identity pool

KMS — mã hoá

  • CMK (customer managed) vs AWS managed key (aws/xxx) vs AWS owned key
  • CMK: tự động rotation hàng năm, bắt buộc key policy cấp quyền
  • Envelope encryption (data key mã hoá dữ liệu, KMS mã hoá data key)
  • SSE-KMS: audit bằng CloudTrail + kiểm soát ai giải mã; SSE-S3 đơn giản, key AWS quản lý
  • Cross-account: CMK chia sẻ được qua key policy; key AWS managed (aws/xxx) không
  • KMS vs CloudHSM (HSM chuyên dụng)

Bẫy: AMI/snapshot đã tồn tại không bật encryption trực tiếp được — phải copy AMI với tuỳ chọn encrypt. Key do AWS quản lý không share cross-account.

Cấu hình & Secrets

Lưu credentials/config ở đâu — Secrets Manager, Parameter Store hay AppConfig. Một nhóm câu “ít quản lý nhất”.

Secrets Manager

  • Lưu secret (mật khẩu, API key) + rotation tự động bằng Lambda
  • Encrypt bằng KMS; tích hợp RDS/Aurora
  • Cross-account qua resource-based policy
  • Lấy lúc runtime bằng AWS SDK — không hardcode

“API key cần quản lý + rotation + ít vận hành” → Secrets Manager. Cross-account + mã hoá → Secrets Manager + CMK (key AWS managed không share được).

SSM Parameter Store

  • Standard: miễn phí; Advanced: trả phí, cross-account, có TTL/policy, throughput cao hơn
  • Loại: String / StringList / SecureString (mã hoá KMS)
  • Phân cấp path: /app/dev/url, /app/prod/url
  • Lấy SecureString với --with-decryption (CLI) / decrypt flag (SDK)

Bẫy: chia sẻ Parameter Store cross-account chỉ được với Advanced tier (thường qua AWS RAM). AWS managed key không share được cross-account.

AppConfig

  • Feature flag + cấu hình động mà không cần deploy lại
  • Deploy cấu hình an toàn: validator + canary rollout
  • Revert nhanh khi cấu hình lỗi

Chọn: secret + rotation → Secrets Manager; config đơn giản → Parameter Store; flag/cấu hình động → AppConfig.

IaC & CI/CD

CloudFormation/SAM/CDK để dựng hạ tầng bằng code; Code* để build/deploy tự động. Domain Deployment 24%.

CloudFormation

  • Template YAML/JSON: Resources, Parameters, Outputs, Mappings, Conditions
  • Change set (xem trước thay đổi), drift detection, rollback
  • DeletionPolicy: Retain / Snapshot / Delete
  • Intrinsic: Ref, Fn::GetAtt, Fn::Sub, Fn::FindInMap, Fn::ImportValue
  • Nested stack, StackSet (nhiều account/region), cfn-init/cfn-signal

SAM & CDK

  • SAM: mở rộng CloudFormation cho serverless (Lambda, API GW, DynamoDB); SAM CLI chạy/thử local
  • CDK: viết bằng code (TypeScript/Python…) rồi synth thành CloudFormation
  • “List approved instance type” → CloudFormation Parameter + AllowedValues

Phân biệt: CloudFormation = template khai báo; SAM = tầng serverless trên CF; CDK = lập trình hạ tầng. Cả ba đều ra stack CloudFormation.

CodeCommit / CodeBuild / CodeDeploy / CodePipeline

ServiceVai tròFile cấu hình
CodeCommitGit repository—
CodeBuildBuild + test, artifact lên S3buildspec.yml
CodeDeployDeploy tới EC2 / Lambda / ECSappspec.yml (EC2/Lambda), ECS task
CodePipelineOrchestrate: source → build → deploy + manual approval—
  • CodeDeploy in-place hook order: ApplicationStop → DownloadBundle → BeforeInstall → Install → AfterInstall → ApplicationStart → ValidateService
  • CodeDeploy Lambda: Canary / Linear / AllAtOnce traffic shifting
  • EC2 deployment config: AllAtOnce, HalfAtATime, OneAtATime, Blue/Green
  • Amplify Hosting = CI/CD cho web + backend serverless (ít vận hành)

“Triển khai theo branch, nhiều môi trường, static web, không chạy server liên tục” → AWS Amplify Hosting (kết nối branch ↔ environment).

Deploy & Runtime

Elastic Beanstalk (PaaS) và ECS/EKS (container). Trọng tâm: chiến lược deploy không downtime.

Elastic Beanstalk

  • PaaS: bạn đưa code, EB quản lý EC2 + ASG + ELB + monitoring
  • Deployment policies: All at once (nhanh, có downtime) · Rolling · Rolling with additional batch · Immutable · Traffic splitting (canary)
  • Blue/green: clone environment rồi swap CNAME
  • .ebextensions cho cấu hình; RDS nên để ngoài environment (không bị xoá theo env)

Bẫy: All at once gây downtime; cần zero-downtime → Immutable hoặc Traffic splitting. Upgrade platform → Immutable hoặc blue/green.

ECS / EKS / ECR

  • ECR: container registry
  • ECS: task (container) + service (desired count, ALB, rolling update)
  • Fargate (serverless, không quản host) vs EC2 launch type
  • EKS: Kubernetes managed (node group, Fargate)
  • Task definition: image, CPU/mem, port, env, logging, IAM roles

Bẫy: task role (quyền của ứng dụng) ≠ task execution role (quyền kéo image + ghi log). Fargate + X-Ray → chạy daemon như sidecar container.

Network & Edge

EC2, ELB, CloudFront, VPC — nền tảng hạ tầng xuất hiện trong nhiều câu tình huống.

EC2 & VPC

  • Instance store (ephemeral, mất khi stop) vs EBS (persistent)
  • Security Group (stateful) vs NACL (stateless)
  • Public subnet (IGW) / private subnet (NAT gateway ra internet)
  • VPC endpoint: Gateway cho S3 + DynamoDB; Interface cho các service khác
  • Lambda trong VPC → tạo ENI; ra internet cần NAT; tới S3/DynamoDB nên dùng VPC endpoint
  • User Data (bootstrap lúc khởi tạo) vs Instance Metadata (lấy thông tin instance)

ELB & CloudFront

LoạiĐặc điểm
ALBLayer 7 (HTTP/HTTPS), route theo path/host, target group, sticky session
NLBLayer 4 (TCP/UDP), IP tĩnh, độ trễ thấp
CloudFrontCDN: origin S3/ALB/custom, OAC truy cập S3, signed URL/cookie, cache + invalidation

Bẫy: nhiều web app (origin khác nhau) gọi tới S3 bị chặn → CORS (AllowedOrigins), không phải bucket policy. Kiểm soát nội dung qua CloudFront → signed URL/cookie.

Monitoring & Debug

CloudWatch (metric/log/alarm), X-Ray (tracing), CloudTrail (audit API). Nhớ “lỗi nào dùng công cụ nào”.

CloudWatch

  • Metrics: chuẩn 1 phút; custom PutMetricData, high-resolution 1 giây
  • Alarm → SNS; ví dụ “lỗi > 5%/giờ” = custom metric + alarm
  • Logs: Log Groups/Streams, Logs Insights query, metric filter, subscription filter
  • Dashboards, CloudWatch Synthetics (canary)

X-Ray & CloudTrail

  • X-Ray: tracing + service map; cần SDK (tạo segment) + daemon (relay); on-prem cài daemon, Fargate chạy sidecar
  • Đo độ trễ Lambda→S3 → X-Ray (chọn node/edge trong trace map)
  • CloudTrail: audit API (ai gọi gì khi nào); management + data events (S3/DynamoDB/Lambda)
  • CloudTrail (audit) ≠ CloudWatch (vận hành) ≠ Config (compliance cấu hình)

Troubleshooting nhanh

Triệu chứngCông cụ
Function lỗi / log lỗiCloudWatch Logs
Độ trễ giữa các serviceX-Ray
Ai xoá/chỉnh tài nguyênCloudTrail
Cảnh báo khi vượt ngưỡngCloudWatch Alarm → SNS

Còn lại

Các mảnh lẻ còn lại và thực hành SDK/CLI.

Amplify & AI services

  • Amplify: web/mobile + hosting + CI/CD + backend (auth, API, storage)
  • AI/ML: Polly (text→speech), Rekognition (ảnh/video), Comprehend (NLP), Translate (dịch)
  • Các service này thường xuất hiện như “đáp án” của câu hỏi ứng dụng đơn giản

SDK / CLI — best practice

  • Luôn retry với exponential backoff + jitter khi gặp lỗi throttle (429, ProvisionedThroughputExceeded…)
  • Dùng paginators và waiters thay vì tự lặp/polling
  • Credentials: theo provider chain, ưu tiên role/instance profile thay vì access key hardcode
  • Idempotency: lưu request id (DynamoDB conditional write) để chống xử lý trùng khi retry

Lỗi AccessDenied → nghĩ ngay thiếu IAM permission, không phải bug code. Lỗi Throttling → retry backoff + xem lại capacity/concurrency.

Chọn dịch vụ nhanh (bảng gợi nhớ)

Nhu cầuChọn
Chạy code ngắn, không quản serverLambda
Orchestrate nhiều bước + retryStep Functions
Lưu file / objectS3
NoSQL theo key, scale lớnDynamoDB
Hàng đợi workerSQS
Fan-out 1→nhiềuSNS
Route event từ AWS servicesEventBridge
Streaming realtimeKinesis