AWS Developer Associate (DVA-C02) β€” Comprehensive Study Guide

Compiled from 6 practice exam sets β€” Concepts extracted from both correct and incorrect answers Goal: Understand the why behind every answer, not memorize Q&A pairs.


1. AWS Compute Services

1.1 AWS Lambda

Key Concepts

Concurrency & Scaling

  • Concurrent executions formula: concurrent executions = (invocations/sec) Γ— (avg duration in sec)
    • Example: 50 req/s Γ— 100s = 5,000 concurrent executions
  • Default account-level limit: 1,000 concurrent executions (soft limit, can be increased via AWS Support)
  • Reserved concurrency: Deducted from the unreserved pool; guarantees capacity for a specific function. AWS keeps a minimum of 100 unreserved for other functions.
    • Example: Account limit = 2,000, Function A = 400, Function B = 200 β†’ 1,400 remaining shared among other functions; max you can reserve on a single additional function = 1,300 (to keep 100 unreserved).
  • Provisioned concurrency: Pre-initializes execution environments to eliminate cold starts.
  • Throttling: Occurs when concurrency limit is exceeded β†’ returns throttling error (429). Solutions:
    1. Configure reserved concurrency
    2. Use exponential backoff in your application
    3. Configure dead-letter queues (DLQ) for async invocations
    4. Request a service quota increase

Memory & CPU

  • Memory range: 128 MB – 10 GB (proportionally scales CPU)
  • 1,769 MB β‰ˆ 1 vCPU
  • To improve performance of compute-heavy tasks β†’ increase memory allocation (this is the ONLY way to increase CPU; you cannot configure CPU directly)
  • Timeout: max 15 minutes (900 seconds)

Invocation Types

  • RequestResponse (default): Synchronous β€” blocks until response
  • Event: Asynchronous β€” returns immediately, Lambda retries on failure (2 retries)
  • DryRun: Validates parameters and permissions without executing
  • The deprecated InvokeAsync API is NOT the same as InvocationType: Event

Dead Letter Queues (DLQ)

  • For asynchronous invocations that fail after retries
  • Targets: SQS queue or SNS topic
  • Configured via DeadLetterConfig parameter

Execution Context

  • Temporary runtime environment reused across invocations
  • Database connections initialized outside the handler persist across warm invocations
  • /tmp directory: Ephemeral storage (512 MB free, up to 10,240 MB), persists in same execution context β€” use for caching files, unzipping archives

Lambda Layers

  • Extracted to /opt directory
  • Max 5 layers per function
  • Total unzipped size (function + layers) ≀ 250 MB
  • Use layers for shared dependencies to keep deployment packages small

Lambda & VPC

  • Lambda runs outside VPC by default
  • Connect to VPC only when you need to access private resources (e.g., RDS in a private subnet)
  • When connected to VPC, Lambda creates ENIs (Elastic Network Interfaces), NOT Elastic IPs
  • Don’t put Lambda in a VPC unless necessary β€” adds cold start latency

Deployment with CloudFormation

  • ZipFile parameter (under AWS::Lambda::Function β†’ Code): Inline source code for Node.js and Python only
    • CloudFormation auto-zips it into a file named index
    • Accepts source code, NOT a zip file path
  • S3 changes are NOT auto-detected on stack update β†’ change object key or version
  • CodeUri is for AWS::Serverless::Function (SAM), not AWS::Lambda::Function

Custom Runtimes

  • For unsupported languages (C++, Rust, etc.): Create a custom runtime with an executable named bootstrap
  • Package as a Lambda Layer and attach to the function

Lambda Context Object

  • Provides log_stream_name β€” gives the CloudWatch log location of the function instance
  • Provides aws_request_id β€” unique request ID
  • The log stream name is from the Context object, NOT the Event object

Execution Role

  • IAM role granting Lambda permissions to access AWS services
  • AWSLambdaBasicExecutionRole: Provides logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents
  • AWSLambdaDynamoDBExecutionRole: Provides DynamoDB Streams permissions
  • If Lambda gets AccessDeniedException calling another service β†’ fix the execution role, not the developer’s IAM role or resource-based policies

CloudWatch Metrics

  • ConcurrentExecutions: Number of simultaneous instances running β€” proxy for throughput
  • Use for monitoring SLA compliance

Common Pitfalls

  • ❌ Confusing timeout errors with throttling errors (timeout = function runs too long; throttling = too many concurrent invocations)
  • ❌ Thinking you can set concurrency to false β€” it’s a number, not a boolean (set to 0 to throttle all invocations)
  • ❌ Installing X-Ray daemon on Lambda β€” just enable the checkbox; daemon installation is for EC2/ECS/Beanstalk
  • ❌ Using InvokeAsync API instead of Invoke with InvocationType: Event
  • ❌ Thinking Lambda creates Elastic IPs when connected to VPC (it creates ENIs)
  • ❌ Deploying Lambda in VPC to fix throttling issues (irrelevant)

1.2 Amazon ECS (Elastic Container Service)

Key Concepts

Task Definitions

  • Required to run Docker containers β€” specifies Docker image, CPU/memory, port mappings, volumes, IAM roles, networking mode
  • Port mappings are configured in the task definition (not on container instances directly)
  • Can define multiple containers in a single task definition (e.g., app + sidecar)

Task Placement Strategies

StrategyBehaviorBest For
binpackPlaces tasks on fewest instances (least available CPU/memory)Cost optimization β€” minimizes instance count
spreadDistributes tasks evenly by specified attributeHigh availability β€” e.g., attribute:ecs.availability-zone
randomRandom placement, still respects constraintsLeast configuration needed; honors resource requirements
  • Default for CreateService: spread across AZs
  • Default for RunTask: random
  • spread by attribute:ecs.availability-zone: Balances across AZs (HA)
  • spread by instanceId: Distributes across instances (NOT AZs)

Task Placement Constraints

  • distinctInstance: Each task on a different instance
  • memberOf: Attribute-based expressions

Launch Types

  • EC2 launch type: You manage the underlying EC2 instances
  • Fargate: Serverless β€” AWS manages infrastructure
    • Use IAM Roles per task for different permissions (not container instance roles)

Task Roles vs Execution Roles

  • Task role: IAM role the task itself uses to call AWS APIs (e.g., accessing S3, DynamoDB)
  • Execution role: IAM role ECS uses to pull images, push logs

X-Ray Integration on ECS

  • Deploy X-Ray daemon as a sidecar container in the task definition
  • Map UDP port 2000 (not TCP)
  • NOT configured via container agent or user-data script

Container Instance Lifecycle

  • Terminating an instance in RUNNING state β†’ automatically deregistered from cluster
  • Terminating in STOPPED state β†’ NOT automatically deregistered; must manually deregister via ECS Console

Multi-Container Docker (Elastic Beanstalk)

  • Configure containers in Dockerrun.aws.json file (placed at the root level, not in .ebextensions)

Common Pitfalls

  • ❌ Using random when binpack is needed for cost optimization
  • ❌ Confusing spread by instanceId (per instance) vs spread by attribute:ecs.availability-zone (per AZ)
  • ❌ Using TCP port 2000 for X-Ray daemon (must be UDP)
  • ❌ Mixing up task roles and execution roles

1.3 AWS Step Functions

Key Concepts

  • Coordinates multiple AWS services into serverless state machine workflows
  • Uses Amazon States Language (JSON-based) to define states
  • State types: Task, Choice, Wait, Succeed, Fail, Parallel, Map

Input/Output Processing

FieldPurpose
InputPathFilters raw input to select what goes into the state
ParametersManipulates input further, adds static values
ResultPathControls how state result combines with input for output β€” the only one that can combine input + result
OutputPathFilters the state output for the next state

Error Handling

  • Retry field: Built-in retry with configurable MaxAttempts, IntervalSeconds, BackoffRate, and target error types
    • Use to handle Lambda timeouts: specify timeout error type as retry trigger
  • Catch field: Routes failed executions to a fallback state
    • Contains ErrorEquals, Next, and ResultPath

Use Case: When Lambda functions invoke each other creating complex chains β†’ refactor into Step Functions with individual Task states

Common Pitfalls

  • ❌ Confusing TimeoutSeconds (max execution time for a state) with retry configuration
  • ❌ Using a Fail state for retries (Fail is terminal β€” no retries)
  • ❌ Choosing OutputPath when the question asks for combining input + result (use ResultPath)

2. AWS Storage Services

2.1 Amazon S3

Key Concepts

Server-Side Encryption

TypeHeaderKey Management
SSE-S3x-amz-server-side-encryption: AES256AWS manages keys
SSE-KMSx-amz-server-side-encryption: aws:kmsAWS KMS manages keys
SSE-KMS (specific key)+ x-amz-server-side-encryption-aws-kms-key-idOptional; if omitted, uses default KMS key
SSE-Cx-amz-server-side-encryption-customer-algorithm: AES256 + customer-key + customer-key-MD5Customer provides keys
  • To enforce SSE-KMS: Deny s3:PutObject unless x-amz-server-side-encryption-aws-kms-key-id header is present
  • To enforce any SSE: Deny s3:PutObject unless x-amz-server-side-encryption header is present
  • Note: The action is s3:PutObject, NOT s3:PostObject

KMS Throttling with S3

  • SSE-KMS calls GenerateDataKey (upload) or Decrypt (download) per object
  • High-volume uploads (100k+ objects/sec) can exceed KMS API quota (5,500–30,000/sec per region)
  • This is the most likely cause of performance degradation after enabling SSE-KMS

Bucket Policies & Least Privilege

  • Separate statements per role for granular control
  • Use specific actions (s3:GetObject) instead of wildcards (s3:*)
  • Restrict resources to specific prefixes (e.g., arn:aws:s3:::bucket/qa/*)

Cross-Region Replication (CRR)

  • Requirements: Versioning enabled on both source and destination buckets, different regions, proper IAM permissions
  • If CRR fails β†’ most likely versioning is not enabled

S3 Transfer Acceleration

  • Uses CloudFront edge locations for faster long-distance uploads
  • Useful for global users uploading to a centralized bucket

CORS (Cross-Origin Resource Sharing)

  • Required when JavaScript from one domain accesses S3 via website endpoint
  • Configured on the S3 bucket with AllowedOrigin, AllowedMethod, AllowedHeader
  • MaxAgeSeconds: Cache duration for preflight OPTIONS request
  • ExposeHeader: Headers accessible from client applications (not constraints on requests)
  • NOT the same as authorization β€” CORS doesn’t grant permissions

S3 Event Notifications

  • Trigger Lambda, SQS, SNS, or EventBridge on events like ObjectCreated:Put
  • Use for automatic processing (e.g., watermarking images on upload)

S3 Object Lambda

  • Transform objects on retrieval (e.g., redact PII) β€” each role gets its own Object Lambda Access Point
  • Uses GetObject API to retrieve transformed data
  • Maintains a single copy of data

Storage Classes

  • S3 Glacier Deep Archive: Lowest cost (~$0.00099/GB-month), for long-term archival accessed 1-2 times/year

CloudFront + S3

  • Viewer Protocol Policy: HTTPS Only or Redirect HTTP to HTTPS for secure communication
  • Update cached objects: Use versioned file names (cost-free) instead of invalidation (paid)
  • Signed URLs/Cookies for restricting unauthorized access
  • CloudFront Functions: Lightweight edge functions for geo-redirection using CloudFront-Viewer-Country header
  • CloudFront does NOT have a default SSL certificate on ALB

Common Pitfalls

  • ❌ Confusing SSE-S3 headers with SSE-C headers
  • ❌ Using s3:PostObject instead of s3:PutObject
  • ❌ Forgetting the optional x-amz-server-side-encryption-aws-kms-key-id header when using default KMS key
  • ❌ Using self-signed certificates with CloudFront origins
  • ❌ Thinking S3 Transfer Acceleration and CORS affect CRR

2.2 Amazon DynamoDB

Key Concepts

Capacity Units

UnitDefinition
1 RCU1 strongly consistent read/sec for items ≀ 4 KB OR 2 eventually consistent reads/sec
1 WCU1 write/sec for items ≀ 1 KB
Transactional2Γ— the cost (2 RCU for transactional read, 2 WCU for transactional write)

RCU Calculation Example:

  • Item size: 3.5 KB β†’ rounds up to 4 KB
  • 150 eventually consistent reads/sec
  • RCU = 150 Γ— (4 KB / 8 KB) = 75 RCU
    • Divide by 8 for eventually consistent; by 4 for strongly consistent; by 2 for transactional

Partition Key Design

  • Choose high-cardinality unique attributes (GUID, email, customer_id)
  • Avoid low-cardinality keys (department_id, status) β€” causes hot partitions
  • Hot partitions β†’ throttling even if overall capacity isn’t exceeded

Query vs Scan

  • Query: Efficient β€” uses partition key; returns items matching key condition
  • Scan: Reads entire table β€” expensive, slow; avoid on large tables
  • Always prefer Query when you know the partition key
  • Reduce page size (Limit parameter) to minimize impact of scans

Secondary Indexes

FeatureLSI (Local)GSI (Global)
KeysSame partition key, different sort keyDifferent partition AND sort key
CreationAt table creation onlyAnytime
CapacityShares table’s capacityHas own provisioned capacity
ConsistencyEventual or strongEventual only
Max per table520 (default)
Size limit10 GB per partition key valueNone
  • GSI writes consume additional WCU β€” set GSI WCU β‰₯ base table WCU to avoid throttling
  • ProvisionedThroughputExceededException on GSI β†’ GSI write capacity < base table write capacity

DynamoDB Streams

  • Captures item-level changes with 24-hour retention
  • StreamViewType: NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
  • Lambda polls streams synchronously β†’ use AWSLambdaDynamoDBExecutionRole
  • Create event source mapping in Lambda to process stream records
  • If Lambda consumer runs less frequently than 24 hours β†’ data loss (stream data expires)

TTL (Time To Live)

  • Automatically deletes expired items β€” no extra cost, no throughput consumed
  • Perfect for session data, temporary records
  • Set a timestamp attribute on items

Conditional Writes

  • Succeed only if item attributes meet conditions
  • Use for concurrent modifications to prevent overwrites
  • Example: --condition-expression "Price = :currval"

Optimistic Locking

  • Add version attribute (@DynamoDBVersionAttribute)
  • SDK auto-checks version on write β†’ prevents stale data overwrites

Transactions

  • TransactWriteItems: Up to 25 write actions in single all-or-nothing operation (Put, Update, Delete, ConditionCheck)
  • TransactGetItems: Up to 25 read actions atomically
  • BatchWriteItem is NOT atomic β€” some can succeed while others fail; does NOT support UpdateItem

Error Handling

  • ProvisionedThroughputExceededException β†’ use error retries with exponential backoff
  • BatchGetItem with UnprocessedKeys β†’ retry with exponential backoff (or use AWS SDK which handles this automatically)

DynamoDB Accelerator (DAX)

  • Fully managed in-memory cache for DynamoDB
  • Sub-millisecond reads for eventually consistent data
  • Adds cost β€” only use when caching benefits outweigh costs

ReturnConsumedCapacity

  • TOTAL: Total capacity consumed
  • INDEXES: Total + subtotals per index
  • NONE: Default

Fine-Grained Access Control

  • dynamodb:LeadingKeys: Restrict access to items by partition key value (e.g., user can only access their own data)
  • dynamodb:Attributes: Restrict access to specific attributes

Common Pitfalls

  • ❌ Using Scan instead of Query for known partition keys
  • ❌ Forgetting that GSI writes consume additional WCU β†’ causes throttling
  • ❌ Creating LSI on existing table (only at creation time)
  • ❌ Processing DynamoDB Streams less frequently than 24 hours (data loss)
  • ❌ Using DAX when exponential backoff + better key design solves the problem (unnecessary cost)
  • ❌ Using BatchWriteItem when atomic transactions are needed (use TransactWriteItems)

3. AWS API & Integration Services

3.1 Amazon API Gateway

Key Concepts

Integration Types

TypeBehaviorUse Case
Lambda ProxyPasses raw request to Lambda; expects specific JSON response formatSimple setup, most common
Lambda CustomFull control over request/response mappingsWhen you need data transformations
HTTP ProxyPasses request directly to HTTP backendSimple passthrough
HTTP CustomConfigurable request/response mappings to HTTP backendComplex backend integrations

Lambda Proxy Integration Requirements

  • Lambda must return this JSON format:
{
  "isBase64Encoded": true|false,
  "statusCode": httpStatusCode,
  "headers": { "headerName": "headerValue" },
  "body": "..."
}
  • Returning XML/other formats β†’ 502 Bad Gateway
  • Timeout β†’ 504 Gateway Timeout

Authentication Methods

MethodUse Case
AWS_IAMIAM users/roles (cross-account via resource policy)
Lambda Authorizer (TOKEN)Bearer tokens (OAuth, JWT, SAML)
Lambda Authorizer (REQUEST)Headers + query strings + stage variables
Cognito User PoolsCognito-managed user authentication
  • For cross-account IAM access: Set AWS_IAM auth + attach resource policy with execute-api:Invoke
  • API Keys are for identification, NOT authorization

Caching

  • Default TTL: 300 seconds, max 3600, TTL=0 disables caching
  • Cache invalidation: Send Cache-Control: max-age=0 header (requires execute-api:InvalidateCache permission)
  • CacheHitCount/CacheMissCount metrics only appear when caching is enabled

Stages & Stage Variables

  • Use different stages (Prod, Beta) to test new Lambda versions
  • Stage variables reference different Lambda aliases/versions
  • Create a Beta stage + stage variable β†’ internal testing without impacting Prod

Endpoints

  • All API Gateway endpoints are HTTPS only (no HTTP support)
  • Format: https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/
  • Integration timeout: 29 seconds

CORS

  • Enable CORS in API Gateway console for Lambda custom (non-proxy) integrations
  • For Lambda proxy integrations, CORS headers must be returned from the Lambda function itself

Import/Export

  • Import Swagger/OpenAPI v2.0 or v3.0 definitions directly via Console, CLI, or SDK
  • Easiest migration path for existing REST APIs

Method Request

  • Enforce required query parameters (e.g., courseType) in Method Request, not Integration Request

Common Pitfalls

  • ❌ Confusing 502 (bad response format) with 504 (timeout)
  • ❌ Using Lambda authorizer when IAM auth suffices (unnecessary complexity)
  • ❌ Forgetting that API Keys don’t grant permissions to IAM roles
  • ❌ Using Cache-Control: no-cache instead of max-age=0 for API Gateway cache invalidation
  • ❌ Trying to use HTTP (not HTTPS) β€” Connection refused error

3.2 Amazon SQS

Key Concepts

Standard vs FIFO

FeatureStandardFIFO
ThroughputNearly unlimited300 TPS (3,000 with batching)
OrderingBest-effortGuaranteed FIFO
DeliveryAt-least-once (possible duplicates)Exactly-once
DeduplicationNot supportedContent-based or Message Deduplication ID

Visibility Timeout

  • After a message is received, it becomes invisible for the timeout duration (default 30s, max 12h)
  • If consumer doesn’t delete before timeout β†’ message reappears β†’ duplicate processing
  • Set visibility timeout β‰₯ max processing time to prevent duplicates

Dead-Letter Queues (DLQ)

  • Collects messages that fail processing after configured number of retries
  • Prevents infinite retry loops
  • Use for failure analysis and reprocessing

Deduplication (FIFO)

  • Content-based deduplication: SHA-256 hash of message body
  • Message Deduplication ID: Explicit token; 5-minute deduplication interval
  • Standard queues don’t support deduplication β€” switch to FIFO for exactly-once

Delay Queues

  • Postpone delivery of NEW messages (hidden when first added)
  • Different from visibility timeout (hidden after consumed)

Long Polling vs Short Polling

  • Long polling: ReceiveMessageWaitTime > 0 β†’ reduces empty responses, saves costs
  • Short polling: WaitTimeSeconds = 0 β†’ queries subset of servers

SQS + Lambda Integration

  • Lambda polls SQS via event source mapping
  • Configure batch size, batch window
  • Failed messages β†’ DLQ on the SQS queue
  • For partial batch failures: use partial batch responses

Common Pitfalls

  • ❌ Using Standard queue when exactly-once processing is needed (use FIFO)
  • ❌ Confusing delay queues with visibility timeout
  • ❌ Setting Message Deduplication ID on Standard queues (only works on FIFO)
  • ❌ FIFO queues have lower throughput β€” not suitable for all high-volume scenarios

3.3 Amazon SNS

  • Pub/sub messaging: publishers β†’ topics β†’ subscribers
  • Protocols: HTTP/S, Email, SQS, Lambda, SMS
  • Fan-out pattern: SNS β†’ multiple SQS queues for parallel processing
  • Use SNS + SQS for decoupling microservices

3.4 Amazon Kinesis Data Streams

Key Concepts

Resharding

ActionEffectWhen to Use
Split shardIncreases capacity (and cost)Hot shards (high data rate)
Merge shardsDecreases capacity (and cost)Cold shards (underutilized)
  • Data is re-routed to child shards (not lost)
  • Default retention: 24 hours (max 365 days)
  • If consumer runs less frequently than retention β†’ data loss

Writing Records

  • PutRecord: Single record, supports SequenceNumberForOrdering for strict ordering
  • PutRecords: Batch (does NOT guarantee order)
  • For deduplication: Embed primary key within the record

Kinesis vs DynamoDB Streams

  • DynamoDB Streams: Item-level changes with 24h retention; best consumed via Lambda
  • Kinesis: General-purpose high-throughput streaming; use for IoT, real-time analytics

Common Pitfalls

  • ❌ Merging hot shards (should split them)
  • ❌ Splitting cold shards (should merge them)
  • ❌ Using PutRecords when strict ordering is needed (use PutRecord)
  • ❌ Not increasing retention when consumers process data infrequently

3.5 Amazon EventBridge

  • Serverless event bus for event-driven architectures
  • Receives events from AWS services, SaaS apps, custom applications
  • Rules route events to targets (Lambda, SQS, SNS, Step Functions)
  • CodePipeline integration: Monitor pipeline state changes via EventBridge rules
  • CodeArtifact integration: Detect new package versions β†’ trigger CodePipeline builds
  • SSM Parameter Store: NoChangeNotification and ExpirationNotification policies emit EventBridge events

4. AWS Security & Identity

4.1 IAM (Identity and Access Management)

Key Concepts

Roles vs Policies vs Users vs Groups

  • IAM User: Long-term credentials (access keys)
  • IAM Role: Temporary credentials, assumed by services/users
  • IAM Policy: JSON document defining permissions (allow/deny)
  • IAM Group: Collection of users sharing policies

EC2 Instance Access

  • Best practice: IAM Role (instance profile) β†’ temporary, auto-rotating credentials
  • NEVER store access keys on instances or in code
  • Instance profile = container for IAM role attached to EC2

CLI Profiles

  • Create a named profile in ~/.aws/config for different roles
  • Switch with --profile profile-name
  • Instance profiles β‰  CLI profiles

Policy Evaluation Logic

  • Explicit Deny always wins > Allow > Implicit Deny
  • Principle of least privilege: Grant only required permissions

Cross-Account Access

  • Use AssumeRole (most efficient)
  • API Gateway: AWS_IAM auth + resource policy for cross-account

STS APIs

APIUse Case
AssumeRoleCross-account access, role switching
AssumeRoleWithWebIdentityFederated users via OIDC (Facebook, Google)
AssumeRoleWithSAMLFederated users via SAML 2.0
GetSessionTokenMFA-protected programmatic calls
GetFederationTokenProxy apps getting temp credentials for distributed apps
DecodeAuthorizationMessageDecode UnauthorizedOperation error messages

Custom Identity Broker

  • Required when identity store is not SAML-compatible
  • Broker authenticates users β†’ calls STS (AssumeRole or GetFederationToken) β†’ provides temp credentials

CLI Dry-Run

  • --dry-run parameter: Checks permissions without making the actual request
  • Returns DryRunOperation if authorized, UnauthorizedOperation if not

IAM Identity Center (AWS SSO)

  • Temporary credentials expire β†’ re-authenticate to get new ones
  • Access Denied after weeks β†’ most likely expired temporary credentials

IAM Policy Simulator

  • Test policies before applying them β€” safest way to validate permissions

Common Pitfalls

  • ❌ Confusing service-linked roles with custom service roles
  • ❌ Storing access keys on EC2 instead of using instance profiles
  • ❌ Using root user for daily tasks (delete root access keys)
  • ❌ Confusing instance profiles (IAM) with CLI profiles (AWS CLI config)
  • ❌ Not refreshing SSO temporary credentials β†’ Access Denied errors

4.2 Amazon Cognito

Key Concepts

User Pools vs Identity Pools

FeatureUser PoolsIdentity Pools (Federated Identities)
PurposeUser directory (sign-up/sign-in)Temporary AWS credentials
AuthenticationUsername/password, social IdPsFederated (Amazon, Facebook, Google, SAML, OIDC)
Guest AccessβŒβœ… Unauthenticated identities
AWS Service Access❌ (tokens only)βœ… (temporary credentials)
  • For social login + guest access + S3 uploads β†’ Identity Pool with unauthenticated identities enabled
  • Cognito ID: Returned after authentication, used to get temporary AWS credentials
  • Cognito Sync: Cross-device syncing of user data (key-value pairs, max 1MB per dataset, 20 datasets per identity)
    • Push sync: Silent push notifications when data changes
    • Local cache for offline access
  • AWS AppSync: Similar to Cognito Sync but supports multi-user real-time collaboration on shared data
  • Adaptive Authentication: Enable MFA only on risky/suspicious logins
  • Hosted UI: Customizable with logos via Cognito app settings

Common Pitfalls

  • ❌ Using Identity Pools for user directory management (that’s User Pools)
  • ❌ Using User Pools when you need AWS service credentials (that’s Identity Pools)
  • ❌ Confusing Cognito Sync (single-user cross-device) with AppSync (multi-user real-time)

4.3 AWS KMS & Encryption

Key Concepts

Envelope Encryption

  1. Call GenerateDataKey β†’ returns plaintext + encrypted data key
  2. Encrypt data with plaintext data key
  3. Erase plaintext data key from memory
  4. Store encrypted data key alongside encrypted data

Decryption

  1. Call Decrypt β†’ decrypts the encrypted data key β†’ returns plaintext data key
  2. Use plaintext data key to decrypt data
  3. Erase plaintext data key from memory
  • KMS keys can only encrypt data up to 4 KB directly β†’ use envelope encryption for larger data
  • Cannot encrypt with ciphertext data key (must decrypt it first)
  • Cannot mix symmetric and asymmetric encryption

CloudHSM

  • Dedicated HSMs under your exclusive control
  • Use when FIPS 140-2 Level 3 compliance is needed
  • Supports RSA asymmetric encryption
  • Use instead of KMS when you need keys in dedicated, third-party validated HSMs

CloudWatch Logs Encryption

  • Associate existing KMS key with log group: aws logs associate-kms-key --kms-key-id <ARN>
  • Encrypts all NEW log data automatically

Common Pitfalls

  • ❌ Encrypting with the ciphertext version of data key (must use plaintext)
  • ❌ Erasing encrypted data key instead of plaintext data key from memory
  • ❌ Using KMS directly for large data (limited to 4 KB)
  • ❌ Using AWS Encryption SDK when CloudHSM is needed for compliance

5. AWS Deployment & CI/CD

5.1 AWS CodeDeploy

Key Concepts

Deployment Types by Compute Platform

PlatformIn-PlaceBlue/Green
EC2/On-Premisesβœ…βœ… (EC2 only, not on-prem)
LambdaβŒβœ… (all Lambda deployments)
ECSβŒβœ… (all ECS deployments)

Traffic Shifting (Lambda/ECS)

  • Canary: Two increments (e.g., 10% immediately, 90% after 5 minutes)
  • Linear: Equal increments at regular intervals (e.g., 10% every 10 minutes)
  • All-at-once: All traffic shifted immediately

AppSpec File

  • ECS required properties: TaskDefinition, ContainerName, ContainerPort
  • Lambda: alias, targetversion
  • EC2: Lifecycle hooks (BeforeInstall, AfterInstall, etc.)
  • DownloadBundle errors β†’ EC2 IAM profile lacks S3 permissions

CodeDeploy Agent

  • Required only for EC2/On-Premises (HTTPS port 443)
  • NOT required for Lambda or ECS deployments

Lifecycle Hooks

  • Lambda: BeforeAllowTraffic hook for validation
  • EC2: ApplicationStop, DownloadBundle, BeforeInstall, Install, AfterInstall, ApplicationStart, ValidateService

Common Pitfalls

  • ❌ Using in-place deployment for Lambda (only blue/green)
  • ❌ Blue/green deployments to on-premises servers (EC2 only)
  • ❌ Confusing Canary with Linear deployment
  • ❌ Rolling with additional batch is Elastic Beanstalk, NOT CodeDeploy

5.2 AWS CloudFormation & SAM

Key Concepts

CloudFormation

  • Transform: AWS::Serverless-2016-10-31 β€” required for SAM templates
  • StackSets: Create/update/delete stacks across multiple accounts and regions
  • Change Sets: Preview changes before applying (don’t deploy)
  • Cross-stack references: Export in Outputs + Fn::ImportValue in other templates
  • Fn::ImportValue retrieves exported values; Ref cannot cross templates
  • Dynamic references: {{resolve:ssm-secure:paramName:version}} for secure SSM parameters

Helper Scripts

ScriptPurpose
cfn-initInstall packages, create files, start services
cfn-signalSignal WaitCondition/CreationPolicy
cfn-get-metadataRetrieve metadata
cfn-hupDetect metadata changes, execute hooks

SAM (Serverless Application Model)

  • Extension of CloudFormation for serverless apps
  • SAM CLI: Build, test, debug locally
    • sam init: Initialize project
    • sam build: Install dependencies, create artifacts
    • sam deploy: Package (zip + upload to S3) AND deploy via CloudFormation
    • sam package: Package only (uploads to S3, generates template)
  • aws cloudformation package + aws cloudformation deploy: For CloudFormation CLI workflow
  • Local Lambda-like execution environment for debugging

SAM Resource Types

  • AWS::Serverless::Function: Lambda function
  • AWS::Serverless::Api: API Gateway
  • AWS::Serverless::Application: Nested applications
  • AWS::Serverless::LayerVersion: Lambda layers

CloudFormation Deploy from Local Code

  • Local artifacts β†’ aws cloudformation package (uploads to S3) β†’ aws cloudformation deploy
  • deploy alone won’t work if artifacts are local

Common Pitfalls

  • ❌ Forgetting Transform: AWS::Serverless-2016-10-31 in SAM templates
  • ❌ Using aws cloudformation deploy alone with local artifacts (must package first)
  • ❌ Confusing Ref with Fn::ImportValue for cross-stack references
  • ❌ Using StackSets terminology: Stack Instances are references, not standalone

5.3 AWS Elastic Beanstalk

Key Concepts

Deployment Policies

PolicyDowntimeSpeedRollback
All-at-onceβœ… Brief downtimeFastestManual
RollingReduced capacityModerateManual
Rolling with additional batchFull capacityModerateManual
ImmutableFull capacitySlowerQuick (terminate new)
Blue/GreenFull capacityVariableCNAME swap

Blue/Green Deployment Use Cases

  • Major platform changes (e.g., Java 7 β†’ 8)
  • Decoupling RDS from Beanstalk (snapshot + deletion protection + new env)

Configuration Files

  • .ebextensions/*.config: Custom options (YAML/JSON)
  • env.yaml: Environment name, solution stack, links
  • Dockerrun.aws.json: Multi-container Docker definitions
  • cron.yaml: Periodic worker tasks

X-Ray on Elastic Beanstalk

  • Enable via xray-daemon.config in .ebextensions directory
  • OR toggle in Beanstalk console
  • Uses AWSXRayDaemonWriteAccess managed policy (included in default instance profile)
  • NOT via user data scripts (that’s for standalone EC2)

Deployment via CLI

  • Package as ZIP + eb deploy

Application Version Lifecycle

  • Set limits by count or age to avoid hitting version quota
  • Retention setting: Configure to retain source bundle in S3 (prevent deletion)

Resources Configurable in Beanstalk

  • EC2 instances, CloudWatch, ALB, Auto Scaling
  • NOT: Lambda, CloudFront, Athena

Common Pitfalls

  • ❌ Using Rolling with additional batch in CodeDeploy (it’s a Beanstalk feature)
  • ❌ Confusing .ebextensions config files with Dockerrun.aws.json
  • ❌ Using user data script for X-Ray on Beanstalk (use .ebextensions config)

5.4 AWS CodePipeline, CodeBuild, CodeArtifact

CodePipeline

  • Automates build β†’ test β†’ deploy pipeline
  • Monitor via EventBridge rules (state changes)
  • Integrates with CodeCommit, CodeBuild, CodeDeploy, S3, GitHub

CodeBuild

  • buildspec.yml: Build specification file
    • proxy element: Configure proxy server settings
    • artifacts element: Build output configuration
    • phases element: Build phases (install, pre_build, build, post_build)
  • AppSpec.yml is for CodeDeploy, NOT CodeBuild

CodeArtifact

  • Artifact management for npm, Maven, PyPI, etc.
  • EventBridge integration: Detect new package versions β†’ trigger pipelines

6. AWS Monitoring & Observability

6.1 Amazon CloudWatch

Key Concepts

  • Custom namespaces: Separate metrics from multiple applications
  • CloudWatch Agent: For custom metrics (memory, disk, TCP connections)
    • Attach CloudWatchAgentServerPolicy to IAM role
    • Memory utilization is NOT available by default β€” requires CloudWatch Agent
  • CloudWatch Logs Insights: Query and analyze log data
  • Encrypt log groups with KMS: aws logs associate-kms-key

6.2 AWS X-Ray

Key Concepts

  • Segments: Represent a service/resource processing a request
  • Subsegments: Granular timing for downstream calls (AWS SDK, HTTP, SQL)
    • Define arbitrary subsegments to instrument specific functions
    • Namespace: aws for SDK calls, remote for external calls
  • Annotations: Key-value pairs indexed for search/filter
  • Metadata: Additional custom data (NOT indexed)
  • Service Maps: Visual representation of request flow and latency

X-Ray Daemon

  • Buffers segments and uploads to X-Ray API in batches
  • Alternative to direct PutTraceSegments API calls

Trace Analysis

  • GetTraceSummaries API: Retrieve trace IDs and annotations with filter expressions
  • BatchGetTraces API: Retrieve full traces by ID (no filtering)
  • Filter expressions: Search for specific annotations in X-Ray console

Sampling Rules

  • Control how many requests to record
  • Don’t disable sampling β€” it saves money

IAM Policies

PolicyPurpose
AWSXrayReadOnlyAccessView service maps and segments
AWSXRayDaemonWriteAccessUpload traces (used by EB, ECS)
AWSXrayFullAccessFull access including sampling rules, encryption

X-Ray vs CloudWatch vs CloudTrail

  • X-Ray: Distributed tracing, performance bottlenecks, service maps
  • CloudWatch: Metrics, logs, alarms
  • CloudTrail: API activity auditing

AWS Distro for OpenTelemetry

  • Use when you need to send traces to multiple backends without re-instrumenting
  • X-Ray SDK: Single-vendor, tightly integrated

Client IP Behind ALB

  • X-Ray reads from X-Forwarded-For header (not packet source IP)

Common Pitfalls

  • ❌ Installing X-Ray daemon on Lambda (just enable the checkbox)
  • ❌ Using BatchGetTraces to filter traces (use GetTraceSummaries + filter expressions)
  • ❌ Disabling sampling (increases costs without proportional benefit)
  • ❌ Using CloudWatch for distributed tracing (use X-Ray)

7. High-Frequency Topic Deep Dives

7.1 SQS + Lambda Integration

  • Lambda event source mapping polls SQS
  • Batch size: Number of messages per invocation (up to 10 for standard, 10,000 for FIFO)
  • Batch window: Max time to gather messages before invoking
  • Partial batch responses: Report which messages failed; only failed messages return to queue
  • DLQ configuration: Set on the SQS queue (not Lambda) for event source mappings
  • Visibility timeout should be β‰₯ 6Γ— Lambda timeout

7.2 DynamoDB Capacity Planning

RCU Formula:

RCU = (reads/sec) Γ— ceil(item_size / 4 KB) / consistency_factor
  - Strongly consistent: factor = 1
  - Eventually consistent: factor = 2
  - Transactional: factor = 0.5 (double cost)

WCU Formula:

WCU = (writes/sec) Γ— ceil(item_size / 1 KB)
  - Transactional: factor = 0.5 (double cost)

When to use On-Demand vs Provisioned:

  • On-Demand: Unpredictable traffic, new tables, pay-per-request
  • Provisioned: Predictable traffic, cost optimization with auto-scaling
  • Burst capacity: Short-term spikes accommodated, but not guaranteed

7.3 ECS Task Placement Deep Dive

// Cost optimization (binpack by memory)
"placementStrategy": [{"field": "memory", "type": "binpack"}]

// High availability (spread across AZs)
"placementStrategy": [{"field": "attribute:ecs.availability-zone", "type": "spread"}]

// Minimal config (random, honors constraints)
"placementStrategy": [{"type": "random"}]

7.4 Caching Strategies (ElastiCache)

StrategyData FreshnessWasted SpaceUse Case
Lazy LoadingCan be staleOnly requested data cachedRead-heavy, cache miss acceptable
Write-ThroughAlways currentCaches all writes (even unread data)Data must always be current
Write-Through + TTLAlways currentAuto-expires unread dataBest combo β€” fresh data + minimal waste

Redis vs Memcached:

  • Redis: Supports replication (Multi-AZ), persistence, complex data types
  • Memcached: Simple key-value, multi-threaded, NO replication

7.5 Envelope Encryption Flow

ENCRYPT:
  GenerateDataKey β†’ [plaintext key, encrypted key]
  Use plaintext key β†’ encrypt data
  Erase plaintext key from memory
  Store encrypted key + encrypted data

DECRYPT:
  Decrypt API β†’ encrypted key β†’ plaintext key
  Use plaintext key β†’ decrypt data
  Erase plaintext key from memory

7.6 API Gateway Authentication Decision Tree

Need IAM-based auth (same/cross account)?
  β†’ AWS_IAM + Resource Policy

Need custom auth with bearer tokens?
  β†’ Lambda Authorizer (TOKEN type)

Need custom auth with headers/query params?
  β†’ Lambda Authorizer (REQUEST type)

Need Cognito user directory?
  β†’ Cognito User Pool Authorizer

Just need to identify callers?
  β†’ API Keys (identification, NOT authorization)

8. Quick Reference: Service Limits & Defaults

ServiceKey Limit/DefaultExam Relevance
Lambda15 min timeout, 10 GB memory, 1,000 concurrent (soft), 250 MB unzipped deployment, 512 MB–10 GB /tmpConcurrency, timeout, memory questions
Lambda Layers5 per function, 250 MB total unzippedPackage size optimization
SQS StandardNearly unlimited TPS, at-least-once, best-effort orderingOrdering/deduplication scenarios
SQS FIFO300 TPS (3,000 with batching), exactly-once, guaranteed orderThroughput limitation questions
SQS Visibility TimeoutDefault 30s, max 12hDuplicate processing scenarios
API Gateway29s integration timeout, 10,000 req/s (account-level)Timeout and throttling questions
API Gateway CacheDefault TTL 300s, max 3600sCache configuration questions
DynamoDB400 KB max item sizeLarge item scenarios
DynamoDB RCU1 RCU = 4 KB strongly consistent, 8 KB eventually consistentCapacity calculation questions
DynamoDB WCU1 WCU = 1 KB/s writeCapacity calculation questions
DynamoDB Streams24-hour retentionStream processing frequency
DynamoDB GSI20 per table (default), eventual consistency onlyIndex design questions
DynamoDB LSI5 per table, created at table creation only, 10 GB per partition keyIndex limitation questions
KinesisDefault 24h retention (max 365 days)Data loss scenarios
KMS4 KB direct encryption limit; 5,500–30,000 API ops/sec per regionEnvelope encryption, throttling
S35 TB max object, 100 bucket-level rules for CORSStorage and access scenarios
CloudFormation StackSetsSingle operation across multiple accounts/regionsMulti-account management
Cognito Sync1 MB per dataset, 20 datasets per identityCross-device sync limits
Step Functions25,000 execution history eventsLong-running workflow limits

9. Additional Services Quick Reference

AWS AppConfig

  • Feature flags: Gradually roll out features without code deployment
  • Configuration profiles: Enable/disable features based on development progress
  • Preferred over Lambda + Parameter Store for feature flags (less overhead)

AWS Systems Manager Parameter Store

  • Standard tier: Free, no policies, 4 KB max
  • Advanced tier: Paid, supports policies (Expiration, ExpirationNotification, NoChangeNotification), 8 KB max
  • NoChangeNotification: Alert when parameter hasn’t been modified in X days (rotation monitoring)
  • Secure String: Encrypted with KMS
  • Use ssm-secure dynamic reference in CloudFormation templates

AWS Secrets Manager

  • Automatic rotation of secrets (Lambda-based)
  • Best for database credentials that need periodic rotation
  • More expensive than Parameter Store

Secrets Manager vs Parameter Store:

FeatureSecrets ManagerParameter Store
Auto-rotationβœ…βŒ
CostPer secret/monthFree (Standard)
Max size64 KB4 KB (Standard) / 8 KB (Advanced)
Best forDB credentials needing rotationConfig values, encrypted strings

AWS WAF

  • Web application firewall for API Gateway, CloudFront, ALB
  • Protects against SQL injection, XSS
  • Rules: Allow, Block, Count
  • NOT: GuardDuty (threat detection), Firewall Manager (multi-account WAF management), NACLs (subnet-level)

Amazon Athena

  • Serverless SQL queries on S3 data
  • Supports JSON, CSV, ORC, Parquet
  • Pay-per-query β€” ideal for ad-hoc analysis without loading data into a database

AWS CDK (Cloud Development Kit)

  • Define cloud infrastructure using programming languages (Python, TypeScript, Java, C#)
  • Compiles to CloudFormation templates
  • Different from CloudFormation (JSON/YAML only)

AWS Amplify

  • Frontend web/mobile app development platform
  • Amplify Hosting: Git-based deployment with CI/CD
  • E2E testing: Configure Cypress in amplify.yml
  • NOT aws-exports.js or amplifyconfiguration.json for Cypress config

ALB (Application Load Balancer)

  • Layer 7, supports OIDC authentication natively on HTTPS port 443
  • X-Forwarded-For header: Contains client’s original IP address
  • NLB operates at Layer 4 and does NOT support OIDC

EC2 Instance Metadata

  • URL: http://169.254.169.254/latest/meta-data/
  • User data: http://169.254.169.254/latest/user-data/
  • IP: 169.254.169.254 (link-local, valid only from instance)
  • User data: Run scripts on launch, NOT for querying instance details

10. Exam Strategy: How to Eliminate Wrong Answers

Pattern Recognition

β€œLeast effort” / β€œLeast configuration”:

  • Look for managed services over custom solutions
  • Prefer built-in features (e.g., DynamoDB TTL over scheduled scans)
  • Choose random placement when question says β€œleast configuration”

β€œMost secure”:

  • IAM roles > access keys (always)
  • Principle of least privilege (specific actions, not wildcards)
  • Encryption at rest + in transit
  • Temporary credentials > long-term credentials

β€œCost-effective” / β€œMinimal cost”:

  • Query over Scan (DynamoDB)
  • Reduce page size before adding DAX
  • Binpack for ECS cost optimization
  • On-demand for unpredictable, provisioned for predictable workloads

β€œWithout modifying code”:

  • ALB OIDC authentication (no code changes needed)
  • CloudFront Functions (edge processing)
  • API Gateway caching

Service Boundary Traps

If the question mentions…Don’t confuse with…
Decoupling servicesKinesis (use SQS unless ordering/streaming is required)
Serverless deploymentCloudFormation alone (use SAM for serverless)
Multiple Lambda coordinationDirect invocation (use Step Functions)
Feature flagsLambda + Parameter Store (use AppConfig)
Cross-device sync (single user)AppSync (use Cognito Sync)
Multi-user real-time collaborationCognito Sync (use AppSync)
Distributed tracingCloudWatch Logs (use X-Ray)
API auditingX-Ray (use CloudTrail)
npm package managementECR (use CodeArtifact)

Error Code Quick Reference

ErrorLikely Cause
502 Bad Gateway (API GW)Lambda returned wrong format (not JSON proxy format)
504 Gateway Timeout (API GW)Integration exceeded 29s timeout
429 Too Many Requests (Lambda)Throttling β€” concurrency limit exceeded
ProvisionedThroughputExceededException (DynamoDB)Request rate too high β†’ exponential backoff
AccessDeniedException (Lambda β†’ other service)Execution role missing permissions
UnauthorizedOperation (EC2)IAM policy missing; decode with sts:DecodeAuthorizationMessage
RequestError timeout (CodeBuild)Missing proxy config in buildspec.yml
UnknownError: not opened for reading (CodeDeploy)EC2 IAM profile lacks S3 access

Security-First Thinking

  • Explicit deny ALWAYS wins
  • Least privilege: s3:GetObject not s3:*
  • Use roles, not access keys
  • Encrypt at rest (KMS, SSE) + in transit (HTTPS, TLS)
  • Rotate credentials (Secrets Manager for auto-rotation)
  • Delete root user access keys

Final Tip: When in doubt between two similar-sounding options, ask yourself:

  1. Does this follow the principle of least privilege?
  2. Does this use a managed/native AWS service over a custom solution?
  3. Does this address the root cause or just a symptom?
  4. Is this the simplest path that meets ALL requirements?

Study guide generated from DVA-C02 practice exams (Sets 1–6) β€” March 2026