AWS Developer Associate Domain 1: Development with AWS Services
64 free practice questions for Development with AWS Services in the AWS Certified Developer – Associate (DVA-C02) exam. Try each question first, then open "Show answer" for the correct option and explanation.
Development with AWS Services practice questions
-
Question 1. A Lambda function written in Python must reuse a database connection across invocations. Where should the connection be created?
Show answer
Answer: C. Outside the handler function, in the initialization code
Code outside the handler runs once per execution environment, so warm invocations reuse the connection.
-
Question 2. A Lambda function needs a 3 GB temporary scratch file during processing. Where should it write the file?
Show answer
Answer: B. The /tmp directory, with ephemeral storage raised as needed
/tmp is writable ephemeral storage, configurable from 512 MB up to 10 GB. /opt and the code directory are read-only.
-
Question 3. Several Lambda functions share the same third-party libraries. How can the libraries be packaged once and reused?
Show answer
Answer: A. Publish them as a Lambda layer and attach it to each function
Layers package shared code or dependencies. Their contents are extracted to /opt in the execution environment.
-
Question 4. A team wants production traffic to point at a stable Lambda identifier while new code is tested. What should production use?
Show answer
Answer: C. An alias pointing to a published version
Published versions are immutable. An alias such as prod points to a version and can be moved when a release is approved.
-
Question 5. How can 10% of a Lambda alias's traffic be sent to a new version?
Show answer
Answer: C. Configure weighted routing on the alias between two versions
Alias routing configuration sends a chosen percentage of invocations to an additional version.
-
Question 6. A Lambda function is invoked asynchronously and must send failed events to an SQS queue after retries. What should be configured?
Show answer
Answer: B. An on-failure destination or a dead-letter queue
Asynchronous invocations are retried twice by default. Destinations and DLQs capture events that still fail.
-
Question 7. Which Lambda setting guarantees that a function can always scale to a certain number of concurrent executions?
Show answer
Answer: C. Reserved concurrency
Reserved concurrency sets aside capacity from the account pool and also caps the function at that value.
-
Question 8. A latency-sensitive API backed by Lambda suffers from slow first requests after idle periods. What reduces this?
Show answer
Answer: D. Provisioned concurrency on the alias
Provisioned concurrency keeps initialized execution environments ready, removing cold-start initialization time.
-
Question 9. A Lambda function reads from an SQS queue. How does Lambda receive the messages?
Show answer
Answer: D. An event source mapping polls the queue and invokes the function with batches
Event source mappings poll SQS, Kinesis, DynamoDB Streams, and similar sources, then invoke the function synchronously.
-
Question 10. In an SQS batch, one message fails while the others succeed. How can Lambda avoid reprocessing the whole batch?
Show answer
Answer: D. Enable ReportBatchItemFailures and return the failed message IDs
Partial batch responses let Lambda delete successful messages and only return failed ones to the queue.
-
Question 11. Which environment variable approach keeps a database password out of a Lambda function's code and configuration in plain text?
Show answer
Answer: B. Store it in Secrets Manager and fetch it at runtime
Secrets Manager stores the secret encrypted and supports rotation. Cache the value outside the handler to reduce calls.
-
Question 12. What is the maximum timeout for a single Lambda invocation?
Show answer
Answer: D. 15 minutes
Work that takes longer should be split into steps, for example with Step Functions, or moved to containers.
-
Question 13. A Lambda function must access a private RDS database in a VPC. What must be configured?
Show answer
Answer: C. VPC subnets and security groups on the function
A VPC-attached function gets elastic network interfaces in the chosen subnets and can reach private resources.
-
Question 14. A VPC-attached Lambda function in private subnets must call a public third-party API. What does it need?
Show answer
Answer: A. A route to a NAT gateway
Lambda network interfaces don't get public IPs, so outbound internet access goes through a NAT gateway.
-
Question 15. Which deployment package option lets a Lambda function use an image up to 10 GB?
Show answer
Answer: D. A container image stored in Amazon ECR
Container images can be up to 10 GB. .zip packages are limited to 250 MB unzipped.
-
Question 16. In API Gateway, which integration type passes the whole request to Lambda and expects Lambda to return the full response?
Show answer
Answer: A. Lambda proxy integration
With proxy integration, the function receives headers, path, and body and must return statusCode, headers, and body.
-
Question 17. A browser app on one domain calls an API Gateway REST API on another domain and gets a CORS error. What must be done?
Show answer
Answer: A. Enable CORS so the API returns Access-Control headers
With proxy integrations, the Lambda function must also return Access-Control-Allow-Origin in its response.
-
Question 18. Different API Gateway stages must call different Lambda aliases without changing the API definition. What should be used?
Show answer
Answer: C. Stage variables referenced in the integration
A stage variable such as ${stageVariables.alias} can select the Lambda alias for each stage.
-
Question 19. A partner must be limited to 1,000 API requests per day. What should be configured in API Gateway?
Show answer
Answer: A. A usage plan with a quota and an API key
Usage plans define throttling and quotas and are associated with API keys given to clients.
-
Question 20. Which API Gateway feature converts a request body format before sending it to a non-proxy backend?
Show answer
Answer: C. Mapping templates written in VTL
Mapping templates transform requests and responses for custom (non-proxy) integrations.
-
Question 21. Which API type should be chosen for a low-cost, low-latency API that forwards requests to Lambda with JWT authorization?
Show answer
Answer: B. API Gateway HTTP API
HTTP APIs are simpler and cheaper than REST APIs and include native JWT authorizers.
-
Question 22. A chat application needs a persistent two-way connection between clients and the backend. Which API Gateway type fits?
Show answer
Answer: A. WebSocket API
WebSocket APIs keep connections open and route messages by route key, such as $connect and sendmessage.
-
Question 23. A DynamoDB table uses OrderId as partition key. The app must fetch all orders for a customer quickly. What should be added?
Show answer
Answer: D. A global secondary index with CustomerId as partition key
GSIs can use any attribute as a partition key. LSIs must share the table's partition key.
-
Question 24. Which DynamoDB operation is MOST efficient for fetching all items with the same partition key?
Show answer
Answer: D. Query
Query reads only the items in one partition key. Scan reads the whole table before filtering.
-
Question 25. A DynamoDB Query returns LastEvaluatedKey in the response. What does this mean?
Show answer
Answer: D. More results exist; pass it as ExclusiveStartKey next time
Query and Scan return up to 1 MB per call, so applications paginate using the returned key.
-
Question 26. Two users may update the same DynamoDB item at the same time. How can one update be prevented from silently overwriting the other?
Show answer
Answer: B. Use a version attribute with a conditional write
Optimistic locking checks the expected version in a ConditionExpression and fails if it changed.
-
Question 27. An order and its inventory update in two DynamoDB tables must succeed or fail together. What should be used?
Show answer
Answer: C. TransactWriteItems
Transactions provide all-or-nothing writes across items and tables. BatchWriteItem isn't atomic.
-
Question 28. A table uses provisioned capacity. How many RCUs are needed for 10 strongly consistent reads per second of 6 KB items?
Show answer
Answer: D. 20
One RCU is one strongly consistent read per second of up to 4 KB. A 6 KB item rounds up to 8 KB, which is 2 RCUs, so 10 × 2 = 20.
-
Question 29. How many WCUs are needed to write 5 items per second, each 2.5 KB?
Show answer
Answer: A. 15
One WCU is one write per second of up to 1 KB. 2.5 KB rounds up to 3 KB, so each write needs 3 WCUs, and 5 × 3 = 15.
-
Question 30. Session items in DynamoDB should be deleted automatically after 24 hours at no extra cost. What should be used?
Show answer
Answer: D. Time to Live (TTL) on an expiry timestamp attribute
TTL deletes expired items in the background without consuming write capacity.
-
Question 31. A Lambda function must react to every change made to a DynamoDB table. What should trigger it?
Show answer
Answer: A. DynamoDB Streams with an event source mapping
Streams record item-level changes in order, and Lambda processes them in batches.
-
Question 32. A DynamoDB query returns large items, but the app only needs two attributes. How can the response size be reduced?
Show answer
Answer: A. Use a ProjectionExpression
ProjectionExpression limits the returned attributes. FilterExpression removes items after they are read.
-
Question 33. An SQS consumer sometimes needs longer than the visibility timeout for one message. What should it do?
Show answer
Answer: B. Call ChangeMessageVisibility to extend that message's timeout
Extending visibility for a message in progress stops another consumer from receiving it.
-
Question 34. Messages sent to an SQS queue must not be visible to consumers for 60 seconds after sending. What should be set?
Show answer
Answer: D. A delivery delay (DelaySeconds) of 60
Delivery delay hides new messages for up to 15 minutes. Visibility timeout applies after a message is received.
-
Question 35. An SQS FIFO queue must process each customer's messages in order, while different customers are processed in parallel. What should be set?
Show answer
Answer: D. MessageGroupId to the customer ID
Order is kept within a message group. Different groups can be processed concurrently.
-
Question 36. A producer may send the same message to a FIFO queue twice after a network retry. How are duplicates prevented?
Show answer
Answer: A. Content-based deduplication or a MessageDeduplicationId
FIFO queues drop messages with the same deduplication ID sent within the 5-minute deduplication interval.
-
Question 37. An application must send 2 MB payloads through SQS. What is the recommended approach?
Show answer
Answer: C. Store it in S3 and send a reference, e.g. with the Extended Client
SQS messages are limited to 256 KB, so large payloads are stored in S3 with a pointer in the message.
-
Question 38. Which API call reduces SQS costs when an application sends many small messages?
Show answer
Answer: D. SendMessageBatch with up to 10 messages
Batching sends up to 10 messages in one request, cutting the number of billed API calls.
-
Question 39. One event must be delivered to three SQS queues owned by different services. Which pattern fits?
Show answer
Answer: B. Publish to an SNS topic that the three queues subscribe to
SNS-to-SQS fan-out delivers a copy of each message to every subscribed queue.
-
Question 40. An SNS subscriber should only receive messages where the attribute eventType equals "refund". What should be used?
Show answer
Answer: A. A subscription filter policy
Filter policies are evaluated by SNS, so non-matching messages are never delivered to that subscriber.
-
Question 41. A Lambda function must run only when an EC2 instance enters the "stopped" state. What should be configured?
Show answer
Answer: A. An EventBridge rule whose event pattern matches that state change
EventBridge receives EC2 state-change events, and a rule's JSON event pattern can match detail.state = "stopped" and target the function.
-
Question 42. A Lambda function should run every day at 02:00 UTC. What is the simplest way to schedule it?
Show answer
Answer: A. An EventBridge Scheduler schedule or scheduled rule
EventBridge supports cron and rate expressions and invokes the function directly.
-
Question 43. An order workflow has several steps, retries, error handling, and a manual approval that may take days. Which service fits?
Show answer
Answer: B. AWS Step Functions Standard Workflows
Standard Workflows run up to a year with exactly-once execution. Express Workflows are limited to 5 minutes.
-
Question 44. A high-volume event processing workflow runs thousands of times per second and finishes in seconds. Which Step Functions type is cheaper?
Show answer
Answer: C. Express Workflows
Express Workflows are billed by executions and duration and suit short, high-rate workloads.
-
Question 45. In Step Functions, which state runs the same steps for each item in an array?
Show answer
Answer: D. Map
Map iterates over items, optionally in parallel. Parallel runs different branches at the same time.
-
Question 46. Records in a Kinesis data stream must be processed in order for each device. What should the producer set?
Show answer
Answer: B. The partition key to the device ID
Records with the same partition key go to the same shard, where order is preserved.
-
Question 47. A Kinesis stream consumer falls behind, and the stream has enough shards. How can Lambda processing be sped up?
Show answer
Answer: A. Raise the event source mapping's parallelization factor
A parallelization factor up to 10 lets Lambda process multiple batches per shard while keeping order per partition key.
-
Question 48. A browser must upload a file directly to a private S3 bucket without AWS credentials. What should the backend return?
Show answer
Answer: B. A presigned URL for a PutObject request
Presigned URLs grant temporary permission for one operation, signed with the backend's credentials.
-
Question 49. A Lambda function should run whenever a new object is added to an S3 bucket under the uploads/ prefix. What should be configured?
Show answer
Answer: B. An S3 event notification with a prefix filter
Event notifications can send ObjectCreated events to Lambda, SQS, SNS, or EventBridge.
-
Question 50. An application writes to DynamoDB and should cache reads in ElastiCache so the cache is always current. Which strategy fits?
Show answer
Answer: B. Write-through: update the cache whenever the database is written
Write-through keeps data current but may cache items that are never read. Adding a TTL helps.
-
Question 51. What is a drawback of the lazy-loading caching strategy?
Show answer
Answer: B. A cache miss adds latency, and cached data can become stale
Lazy loading only caches requested data. TTLs limit how stale the data can become.
-
Question 52. A DynamoDB-backed app needs microsecond read latency without changing its data access code much. What should be used?
Show answer
Answer: C. DynamoDB Accelerator (DAX)
DAX is a write-through cache for DynamoDB that uses a compatible API.
-
Question 53. A call to a DynamoDB API fails with ProvisionedThroughputExceededException. What should the client do?
Show answer
Answer: B. Retry with exponential backoff and jitter
The AWS SDKs retry throttling errors automatically with backoff. Persistent throttling needs more capacity or better keys.
-
Question 54. Which statement about the default credential provider chain in the AWS SDKs is correct?
Show answer
Answer: D. It checks environment variables, shared files, then instance or task roles
On AWS compute, the SDK picks up temporary role credentials automatically, so no keys are needed in code.
-
Question 55. A developer needs to call AWS APIs from a laptop without long-term access keys. What is recommended?
Show answer
Answer: A. IAM Identity Center with aws sso login for temporary credentials
Short-lived credentials from IAM Identity Center avoid storing long-term keys.
-
Question 56. A mobile app needs a managed GraphQL API that combines data from DynamoDB and Lambda with real-time subscriptions. Which service fits?
Show answer
Answer: A. AWS AppSync
AppSync hosts GraphQL APIs with resolvers for several data sources and built-in subscriptions.
-
Question 57. Why should Lambda functions triggered by SQS, SNS, or EventBridge be idempotent?
Show answer
Answer: D. Events can be delivered more than once
At-least-once delivery means duplicates can occur, so processing the same event twice must be safe.
-
Question 58. A function writes a payment record and must not charge twice when the event is redelivered. What is a common approach?
Show answer
Answer: A. Store an idempotency key with a conditional write and skip duplicates
A conditional put on the idempotency key fails for a repeated event, so the charge isn't repeated.
-
Question 59. Which DynamoDB read type returns the most recent committed data, at double the read cost?
Show answer
Answer: A. A strongly consistent read
Strongly consistent reads cost 1 RCU per 4 KB. Eventually consistent reads cost half. GSIs only support eventual consistency.
-
Question 60. Many items must be written to DynamoDB with fewer network calls. Which API helps, and what must the caller handle?
Show answer
Answer: D. BatchWriteItem, and retry any UnprocessedItems
BatchWriteItem writes up to 25 items per call but may return unprocessed items that need a retry.
-
Question 61. A table's access pattern is "get the latest 10 events for a device". Which key design fits BEST?
Show answer
Answer: C. Partition key deviceId, sort key timestamp, queried newest first
Query with ScanIndexForward=false and Limit=10 returns the newest items for one device.
-
Question 62. Which Lambda feature filters events from an SQS queue or Kinesis stream so the function is only invoked for matching records?
Show answer
Answer: C. Event filtering on the event source mapping
Filter criteria use event patterns, which reduces invocations and cost.
-
Question 63. A Lambda function is invoked by API Gateway. Which invocation type is used?
Show answer
Answer: A. Synchronous, so errors return to the caller
API Gateway waits for the response. Retrying synchronous invocations is the caller's job.
-
Question 64. An S3 event notification for a new object should reach several consumers with rule-based filtering. What should be enabled?
Show answer
Answer: B. Amazon EventBridge notifications on the bucket
EventBridge integration sends all bucket events to EventBridge, where many rules can match and route them.
AWS, Amazon Web Services, and AWS Certified are trademarks of Amazon.com, Inc. or its affiliates. These questions are original study material, not questions from the real exam.