AWS Certified Developer - Associate (DVA-C02) · AWS

Troubleshooting and Optimization

12 practice questions covering 18% of the official AWS Certified Developer - Associate (DVA-C02) blueprint. Every item includes a worked explanation of the correct answer.

View all 4 domains in AWS Certified Developer - Associate (DVA-C02)

Syllabus Coverage & Domain Overview

This domain is about finding out why an application misbehaves and then making it faster and cheaper to run. The current exam guide splits it into three tasks: helping with root cause analysis, instrumenting code so that it can be observed, and optimizing applications with AWS services and features. It is worth 18 percent of the scored content, so it is a substantial share of the exam.

On the diagnosis side, you are expected to read application metrics, logs and traces and connect them to a defect, a failed deployment or a broken integration between services. That means querying logs for the relevant events, using dashboards and insights to judge health, and reading the output logs from a deployment service to see where a release failed. On the instrumentation side, the guide expects you to tell logging, monitoring and observability apart, and to write code that produces useful signals. Examples are structured log entries for application events and user actions, custom metrics such as those emitted through the CloudWatch embedded metric format, trace annotations, health checks and readiness probes, and notifications for events like approaching quota limits or a finished deployment.

The optimization task covers concurrency, profiling, and working out the minimum memory and compute an application needs. It also covers filter policies on message subscriptions so that consumers receive only what they need, caching based on request headers, caching inside the application, and using logs to locate bottlenecks. The distinctions to hold on to are these. A metric tells you that something changed, a log tells you what happened, and a trace tells you where in a chain of services the time or the error occurred. Searchable trace data differs from extra context that is only stored with it. Edge caching keyed on headers differs from a cache that sits next to your data store. Increasing memory for a function also changes its CPU share, so the cheapest setting is not always the smallest.

Questions usually describe a symptom, such as slow responses, intermittent errors, duplicate processing, a throttled function or a database that is overwhelmed, and ask which change or tool resolves it with the least effort. The common traps are choosing a heavier service when a built-in feature would do, confusing a logging fix with a tracing fix, picking a metric when the scenario needs a trace to find the failing hop, and caching data that must always be current. Read for the exact requirement, such as whether the goal is lower latency, lower cost, fewer messages delivered, or faster diagnosis.

To prepare, work through each skill in the official outline and make sure you can do it in the console and in code. Turn on tracing for a small multi-service application, add an annotation, emit a custom metric, and run a log query against structured entries. Then change a function's memory and compare its duration and cost, add a cache, and add a filter policy to a subscription. Practicing with a real failure in front of you teaches the symptom-to-fix mapping that the questions test.

In the official AWS Certified Developer - Associate (DVA-C02) examination blueprint, Troubleshooting and Optimization carries a weightage of 18%. Out of the total examination duration of 2 hr 10 min, candidates should budget approximately 23 min for questions from this domain to maintain pace across the paper.

How to Master Troubleshooting and Optimization for AWS Certified Developer - Associate (DVA-C02)

Our 12 published questions in Troubleshooting and Optimization are written for PrepIQ Hub and checked as set out in our editorial policy. Each item is written to the medium difficulty level of the AWS exam:

  • Targeted Topic Drills: Launch Topic Practice mode to work exclusively through Troubleshooting and Optimization items and review the step-by-step derivation after each submission.
  • Negative Marking Discipline: The AWS Certified Developer - Associate (DVA-C02) applies no negative marking penalty, so practice eliminating the three distractors systematically on every Troubleshooting and Optimization item.
  • Benchmark Target: Aim for at least 72% accuracy in Troubleshooting and Optimization drills before moving to full-paper simulations.

Troubleshooting and Optimization worked examples

Troubleshooting and Optimization questions from the AWS Certified Developer - Associate (DVA-C02) syllabus, answered in full. Try each one before opening the explanation.

  1. Example 1 · Troubleshooting and Optimization · easy

    A backend application uses Amazon ElastiCache for Redis in front of an Amazon RDS PostgreSQL database. Whenever the application requests a user profile, it checks Redis first; on a cache miss, the application queries RDS, writes the returned row into Redis with a TTL (Time to Live) of 300 seconds, and returns the profile. What is this caching pattern called, and what is its main trade-off compared to Write-Through caching?

    • AWrite-Through caching; it guarantees zero cache misses on initial cold start
    • BDynamoDB Accelerator (DAX) write-sharding; it only works with NoSQL key-value stores
    • CLazy Loading (Cache-Aside); it caches requested items with a cache-miss penalty
    • DCloudFront Origin Shield; it caches TCP database connections at DNS edge locations
    Show answer and explanation

    Correct answer: C. Lazy Loading (Cache-Aside); it caches requested items with a cache-miss penalty

    Why

    Checking the cache first and populating it from the database only on a cache miss is Lazy Loading (Cache-Aside). Its advantage is that only requested data is cached (avoiding cache pollution), while its trade-offs are a cache-miss latency penalty on the first read and potential stale data until TTL expiration unless paired with write-through or invalidation.

    • A. Write-Through caching; it guarantees zero cache misses on initial cold start — The described flow populates the cache on a read miss (Lazy Loading), not on every database write (Write-Through).
    • B. DynamoDB Accelerator (DAX) write-sharding; it only works with NoSQL key-value stores — DAX is exclusively for Amazon DynamoDB, whereas this architecture uses ElastiCache for Redis in front of RDS PostgreSQL.
    • D. CloudFront Origin Shield; it caches TCP database connections at DNS edge locations — CloudFront caches HTTP/HTTPS responses at CDN edge locations, not Redis key-value rows.
  2. Example 2 · Troubleshooting and Optimization · medium

    Hundreds of short-lived AWS Lambda functions concurrently open and close new TCP database connections to an Amazon RDS for PostgreSQL instance during traffic bursts, exhausting the database's max_connections memory limit and causing Too many connections errors. Which fully managed AWS service sits between Lambda and Amazon RDS to pool and share warm database connections while speeding up Multi-AZ failover times?

    • AAmazon DynamoDB Accelerator (DAX) in-memory NoSQL cluster read cache
    • BAmazon RDS Proxy managing a shared pool of warm database connections
    • CAWS Direct Connect dedicated physical fiber link to the RDS VPC subnet
    • DAmazon S3 Transfer Acceleration global CloudFront edge network endpoints
    Show answer and explanation

    Correct answer: B. Amazon RDS Proxy managing a shared pool of warm database connections

    Why

    Amazon RDS Proxy is the fully managed service designed for this exact problem. Each Lambda execution environment normally opens its own database connection, so a burst of hundreds of concurrent invocations can exceed max_connections on the RDS for PostgreSQL instance and produce Too many connections errors. RDS Proxy sits between the function and the database, keeps a pool of established connections, and multiplexes many client connections onto a smaller number of database connections, which protects database memory and CPU. It also shortens Multi-AZ failover impact, because the proxy keeps client connections open and routes to the new primary instead of making every client re-resolve DNS and reconnect. Lambda must be configured to connect to the proxy endpoint instead of the instance endpoint, and the function typically runs in the same VPC. The common trap is picking a caching or networking product because it sounds like it improves performance, when the real issue is connection management for a relational database.

    • A. Amazon DynamoDB Accelerator (DAX) in-memory NoSQL cluster read cache — DAX is an in-memory read cache that works only with Amazon DynamoDB and its API. It does nothing for PostgreSQL on RDS and does not pool or manage TCP database connections.
    • C. AWS Direct Connect dedicated physical fiber link to the RDS VPC subnet — AWS Direct Connect is a dedicated private network link between an on-premises site and AWS. It changes how traffic reaches AWS but does not pool connections or limit how many Lambda functions open connections to the database.
    • D. Amazon S3 Transfer Acceleration global CloudFront edge network endpoints — S3 Transfer Acceleration speeds up long-distance uploads and downloads to Amazon S3 buckets using CloudFront edge locations. It has no connection with relational database connections or RDS failover.
  3. Example 3 · Troubleshooting and Optimization · easy

    A developer wants their AWS Lambda function to emit custom business metrics (OrderValue, CheckoutLatencyMs) alongside high-cardinality dimensions (PaymentProvider, Region) into Amazon CloudWatch without making synchronous cloudwatch:PutMetricData network API calls that add latency and cost to every invocation. Which native CloudWatch feature lets Lambda write a specially structured JSON log line to stdout (CloudWatch Logs) so CloudWatch automatically extracts the custom metrics asynchronously?

    • AAWS CloudTrail Management Events log file integrity validation (SHA-256)
    • BAmazon S3 Server Access Logging delivered to an S3 Glacier archive vault
    • CAWS Config conformance packs evaluating IAM password policies
    • DCloudWatch Embedded Metric Format (EMF) JSON written to CloudWatch Logs
    Show answer and explanation

    Correct answer: D. CloudWatch Embedded Metric Format (EMF) JSON written to CloudWatch Logs

    Why

    CloudWatch Embedded Metric Format (EMF) allows Lambda functions (and containers/EC2) to print structured JSON log events containing an _aws metadata header to standard output (CloudWatch Logs). CloudWatch automatically parses those log lines and extracts the custom metrics without requiring PutMetricData API calls.

    • A. AWS CloudTrail Management Events log file integrity validation (SHA-256) — CloudTrail logs AWS control-plane API calls, not custom application metrics from stdout.
    • B. Amazon S3 Server Access Logging delivered to an S3 Glacier archive vault — S3 access logs record storage HTTP requests and do not publish CloudWatch custom metrics.
    • C. AWS Config conformance packs evaluating IAM password policies — AWS Config audits resource configuration compliance, not high-frequency Lambda metrics.
  4. Example 4 · Troubleshooting and Optimization · hard

    An AWS Lambda function processes CPU-intensive image resizing and takes 4,000 ms (4.0 seconds) when configured with 512 MB of memory. When the developer increases the function's memory allocation to 2,048 MB (4x memory), the execution duration drops to 1,000 ms (1.0 second) because Lambda allocates vCPU power proportionally to memory (1,769 MB = 1 full vCPU). Since AWS Lambda duration billing is proportional to $\text{GB-seconds} = \text{Memory (GB)} \times \text{Duration (s)}$, how does the duration compute cost of 2,048 MB for 1.0 s compare to 512 MB for 4.0 s?

    • AIdentical compute cost (2.0 GB-seconds in both cases) with 4x faster latency
    • B4x higher compute cost (8.0 GB-seconds vs 2.0 GB-seconds) for 2,048 MB RAM
    • C16x higher compute cost because Lambda bills quadratically above 1,024 MB
    • D50% lower compute cost (1.0 GB-seconds vs 2.0 GB-seconds) for 512 MB
    Show answer and explanation

    Correct answer: A. Identical compute cost (2.0 GB-seconds in both cases) with 4x faster latency

    Why

    Calculate the billed GB-seconds for both configurations: - Configuration A (512 MB = 0.5 GB for 4.0 s): $0.5\text{ GB} \times 4.0\text{ s} = \mathbf{2.0\text{ GB-seconds}}$ - Configuration B (2,048 MB = 2.0 GB for 1.0 s): $2.0\text{ GB} \times 1.0\text{ s} = \mathbf{2.0\text{ GB-seconds}}$ Therefore, the duration compute cost is identical (2.0 GB-seconds, 0% cost increase) while the user experiences 4x faster response latency (1.0 s vs 4.0 s)!

    • B. 4x higher compute cost (8.0 GB-seconds vs 2.0 GB-seconds) for 2,048 MB RAM — Because duration dropped by 4x (4.0 s to 1.0 s), the 4x memory increase cancels out (2.0 GB * 1.0 s = 2.0 GB-s).
    • C. 16x higher compute cost because Lambda bills quadratically above 1,024 MB — AWS Lambda bills linearly per GB-second, not quadratically.
    • D. 50% lower compute cost (1.0 GB-seconds vs 2.0 GB-seconds) for 512 MB — At 512 MB (0.5 GB) for 4 seconds, the function consumes 0.5 * 4 = 2.0 GB-seconds, not 1.0.
  5. Example 5 · Troubleshooting and Optimization · medium

    An Amazon SQS standard queue has its default VisibilityTimeout set to 30 seconds. A worker EC2 instance polls the queue, receives a video-transcoding message, and takes 75 seconds to finish transcoding the video before calling DeleteMessage. Because 75s > 30s, every video is transcoded two or three times by other workers! Which two solutions prevent duplicate processing while handling messages that occasionally take longer than expected? (Select two.)

    • AIncrease the SQS queue's VisibilityTimeout to exceed the 75-second processing time
    • BIncrease the SQS ReceiveMessage WaitTimeSeconds (Long Polling) parameter to 20s
    • CCall the ChangeMessageVisibility API from the worker to extend the timeout
    • DSet the SQS DelaySeconds attribute to 900 seconds on the dead-letter queue
    Show answer and explanation

    Correct answers: A. Increase the SQS queue's VisibilityTimeout to exceed the 75-second processing time; C. Call the ChangeMessageVisibility API from the worker to extend the timeout

    Why

    To prevent a message from becoming visible again while a consumer is still actively processing it, you should (B) increase the queue's VisibilityTimeout above the maximum expected processing time (e.g., 120–300 seconds, up to 12 hours) (A), and/or (C) have the worker call the ChangeMessageVisibility API heartbeat dynamically to extend the timeout for individual long-running messages while still in flight (C).

    • B. Increase the SQS ReceiveMessage WaitTimeSeconds (Long Polling) parameter to 20s — WaitTimeSeconds controls how long ReceiveMessage waits for an empty queue to receive a message, not how long an in-flight message stays hidden.
    • D. Set the SQS DelaySeconds attribute to 900 seconds on the dead-letter queue — DelaySeconds delays initial visibility of newly enqueued messages; it does not stop an in-flight message's 30s visibility timer from expiring.
  6. Example 6 · Troubleshooting and Optimization · medium

    A developer instruments a microservices payment API with the AWS X-Ray SDK. They want to attach custom key-value data (customerTier = "PLATINUM" and orderId = "ORD-99281") to X-Ray segments so engineers can filter traces in the X-Ray console using filter expressions like annotation.customerTier = "PLATINUM". They also want to attach a 12 KB raw debug JSON response object that does not need to be indexed for search. How should the developer record these two pieces of data in the X-Ray SDK?

    • ARecord customerTier as X-Ray Metadata and the 12 KB JSON object as an Annotation
    • BRecord customerTier and orderId as Annotations and the 12 KB JSON as Metadata
    • CStore both inside the X-Ray Sampling Rule reservoir JSON configuration file
    • DWrite both values into the EC2 instance's /etc/hosts file for the X-Ray daemon
    Show answer and explanation

    Correct answer: B. Record customerTier and orderId as Annotations and the 12 KB JSON as Metadata

    Why

    In AWS X-Ray, Annotations (putAnnotation) are indexed by X-Ray (up to 50 per trace) so you can query them in Filter Expressions (annotation.<key> = <value>). Metadata (putMetadata) is not indexed for search and is used to store larger structured objects/arrays for inspection inside individual traces.

    • A. Record customerTier as X-Ray Metadata and the 12 KB JSON object as an Annotation — This is backwards: Metadata is not indexed for filter expressions, and Annotations only accept scalar string/number/boolean values.
    • C. Store both inside the X-Ray Sampling Rule reservoir JSON configuration file — Sampling Rules control what percentage of requests are traced, not per-request key-value trace attributes.
    • D. Write both values into the EC2 instance's /etc/hosts file for the X-Ray daemon — /etc/hosts is for local OS hostname resolution and is not read as X-Ray trace segment attributes.

Every worked example on this page passed our independent verification before publication — how that works is set out in our editorial policy. Spotted an error? Tell us through the contact page and we will correct it.

All 6 Troubleshooting and Optimization questions with answers

All Syllabus Domains in AWS Certified Developer - Associate (DVA-C02)

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.