AWS Developer Associate (DVA-C02) · 10% practice allocation

AWS DVA-C02: Refactoring Practice Questions

5 free sample questions from the Refactoring domain, with answers and explanations. The full DVA-C02 bank has 275 questions across 5 domains. Questions are scenario-based and written from the official AWS exam guide.

1.

A company runs a self-managed Apache Kafka cluster on EC2 and a self-managed Elasticsearch cluster for log search. The operations team spends most of its time patching brokers and rebalancing shards. The team wants to eliminate this undifferentiated work while keeping the same Kafka client code. Which combination of migrations should they perform?

  • A. Migrate to Amazon MSK and Amazon OpenSearch Service✓ Correct
  • B. Migrate to Amazon SQS FIFO queues and Amazon Athena
  • C. Migrate to Amazon Kinesis Data Streams and Amazon CloudWatch Logs Insights
  • D. Migrate to Amazon MQ and Amazon Redshift
Explanation

Amazon MSK runs Apache Kafka as a managed service, so existing Kafka producer/consumer code works unchanged, and Amazon OpenSearch Service is the managed successor to self-managed Elasticsearch. Kinesis Data Streams requires rewriting all Kafka client code, and CloudWatch Logs Insights is not a drop-in replacement for an Elasticsearch search cluster. SQS FIFO has different semantics (no replayable log, no consumer groups) and Athena queries S3, not a live search index. Amazon MQ supports ActiveMQ/RabbitMQ protocols, not Kafka, and Redshift is a data warehouse, not a log search engine.

2.

A read-heavy reporting API queries an Amazon RDS for MySQL database. Identical queries repeat thousands of times per minute and each takes 300 ms. The data may be up to 5 minutes stale. Which TWO refactors reduce database load and latency? (Select THREE.)

  • A. Add Amazon ElastiCache for Redis as a lazy-loading (cache-aside) cache with a 300-second TTL✓ Correct
  • B. Enable API Gateway response caching for the reporting endpoints with a 300-second TTL✓ Correct
  • C. Convert the RDS instance to a Multi-AZ deployment to serve reads from the standby
  • D. Add RDS read replicas and route read-only queries to the replica endpoint✓ Correct
  • E. Increase the RDS instance's allocated storage to add IOPS for the query workload
Explanation

A cache-aside Redis cache with a 5-minute TTL serves repeated identical queries from memory, read replicas horizontally scale read traffic away from the writer, and API Gateway response caching returns full responses without touching the backend at all — all three fit the 5-minute staleness tolerance. A Multi-AZ standby in RDS (non-cluster) does not serve read traffic; it is only for failover. Adding storage increases capacity and baseline IOPS for gp2 but does nothing about thousands of identical repeated queries and is the least targeted option.

3.

A microservice publishes 20 different event types. Downstream teams each want only certain event types, and they must not receive the others. The producer must not know who the consumers are, and routing rules should be changeable without redeploying the producer. Which AWS service best meets this requirement?

  • A. Amazon Kinesis Data Streams with one shard per event type
  • B. Amazon EventBridge with an event bus and content-based rules per target✓ Correct
  • C. Amazon SQS with one queue per event type and a producer-side switch statement
  • D. Amazon SNS standard topic with all consumers subscribed and client-side filtering in each consumer
Explanation

EventBridge rules match on event content (detail-type, detail fields) and route only matching events to each target; rules are managed independently of the producer, which simply puts events on the bus. Per-type SQS queues push routing logic into the producer, violating the decoupling requirement. Kinesis shards are a scaling construct, not a routing construct — the partition key does not guarantee type isolation and every consumer reads the whole stream. An SNS topic with client-side filtering means every consumer receives every message (SNS message filtering policies would help, but plain client-side filtering does not and wastes delivery).

4.

A microservice on Amazon ECS calls a downstream service that sometimes becomes unresponsive, causing worker threads to block and the whole service to degrade. The team wants to fail fast and stop sending traffic to the unhealthy dependency without writing custom circuit-breaker code. Which options address this? (Select TWO.)

  • A. Enable ECS service auto scaling based on CPU utilization
  • B. Remove all timeouts so calls eventually complete when the dependency recovers
  • C. Place the downstream dependency behind an Application Load Balancer with health checks so unhealthy targets are removed from rotation✓ Correct
  • D. Set aggressive connection and socket timeouts plus a bounded retry policy in the AWS SDK / HTTP client configuration✓ Correct
  • E. Increase the ECS task CPU and memory reservation so more threads are available
Explanation

Bounded timeouts with a limited retry policy make calls fail fast instead of blocking threads indefinitely, and an ALB with health checks automatically stops routing to unhealthy targets, which is the managed equivalent of tripping a circuit. More CPU and memory only lets the service block on more threads before failing. Removing timeouts is the opposite of failing fast and causes cascading exhaustion. CPU-based auto scaling scales out a service whose threads are idle-blocked on I/O, which neither detects nor isolates the failing dependency.

5.

A Lambda function written in Python connects to an Amazon RDS for PostgreSQL database. Under load the function fails with "too many connections" errors. Which TWO changes should the developer make? (Select TWO.)

  • A. Use Amazon RDS Proxy and have the function connect to the proxy endpoint✓ Correct
  • B. Increase the Lambda function timeout so connections have more time to be released
  • C. Set the Lambda reserved concurrency to a value the database can support✓ Correct
  • D. Move the Lambda function out of the VPC so it uses a public database endpoint
  • E. Create the database connection inside the handler on every invocation and close it at the end
Explanation

RDS Proxy pools and multiplexes database connections, so thousands of concurrent Lambda environments share a small pool. Reserved concurrency caps how many concurrent executions can exist, bounding the number of connections. Opening and closing a connection per invocation increases connection churn and still scales linearly with concurrency (it also wastes the container reuse optimization). Raising the timeout keeps connections open longer, worsening the problem. Removing the function from the VPC does not reduce connection count and exposes the database publicly.

Test yourself across every DVA-C02 domain

The free DVA-C02 practice test mixes about 20 questions weighted like the exam. The full 275-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

Refactoring study guide (DVA-C02) →

Other DVA-C02 domains

← All AWS Developer Associate study resources