Cost-optimizing short-lived contest workloads with DynamoDB TTL and Lambda

Answer Correct answer: D — Migrate entries to DynamoDB, rewrite the logic as Lambda, and set a DynamoDB TTL to expire entries at contest end, with no always-on cost.

A company uses a mobile app on AWS to run online contests. The company selects a winner at random at the end of each contest. The contests run for variable lengths of time. The company does not need to retain any data from a contest after the contest is finished. The company uses custom code that is hosted on Amazon EC2 instances to process the contest data and select a winner. The EC2 instances run behind an Application Load Balancer and store contest entries on Amazon RDS DB instances. The company must design a new architecture to reduce the cost of running the contests. Which solution will meet these requirements MOST cost-effectively?

  1. Migrate storage of the contest entries to Amazon DynamoDB. Create a DynamoDB Accelerator (DAX) cluster. Rewrite the code to run as Amazon Elastic Container Service (Amazon ECS) containers that use the Fargate launch type. At the end of the contest, delete the DynamoDB table.
  2. Migrate the storage of the contest entries to Amazon Redshift. Rewrite the code as AWS Lambda functions. At the end of the contest, delete the Redshift cluster.
  3. Add an Amazon ElastiCache for Redis cluster in front of the RDS DB instances to cache the contest entries. Rewrite the code to run as Amazon Elastic Container Service (Amazon ECS) containers that use the Fargate launch type. Set the ElastiCache TTL attribute on each entry to expire each entry at the end of the contest.
  4. Migrate the storage of the contest entries to Amazon DynamoDB. Rewrite the code as AWS Lambda functions. Set the DynamoDB TTL attribute on each entry to expire each entry at the end of the contest. Correct Answer

Community Votes

D
65%
A
35%

65% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

For variable-length, short-lived workloads, serverless DynamoDB plus Lambda and a TTL to auto-expire entries eliminates both compute idle cost and manual cleanup, which is cheaper than provisioned RDS/Redshift or a DAX cluster.

A contest app needs the lowest cost and no data retention after each contest. Migrating entries to DynamoDB, rewriting the selection logic as Lambda functions, and setting a DynamoDB TTL to expire entries at contest end removes always-on infrastructure and storage cost.

Adding a DAX cluster (Option A) — it is provisioned, always-on, and unnecessary for a simple low-latency read pattern, increasing cost contrary to the requirement.

Community Discussion (21 comments)

m1xa 👍 6 Selected: D
Lambda for choosing a winner (it's a short-term task) and TTL (known before the contest starts) make sense.
tonytam1991 👍 1 Selected: A
This is what I hate AWS keep using impractical examples or unclear assumptions on their exam, it just train a lot of people just know yelling: "lambda is cheap, lambda is efficiency".
SIJUTHOMASP 👍 1 Selected: D
Here cost is the only concern and not performance, option A can be ruled out because no DAX is required. Simply Dynamo DB in option D would be more than sufficient.
AzureDP900 👍 1
Option D Migrate Storage: Migrating storage from RDS DB instances (which require a significant upfront cost) to DynamoDB (a fully managed NoSQL database service with low usage-based costs) will significantly reduce the company's expenses. Lambda Functions: Rewriting code as AWS Lambda functions (serverless computing for code execution) will eliminate the need for EC2 instances, reducing costs even further. Lambda functions are also ideal for tasks that run infrequently or have short durations. DynamoDB TTL Attribute: By using DynamoDB's TTL attribute to expire each entry at the end of the contest, the company can automatically clean up unused data without requiring manual deletion.
Moghite 👍 2 Selected: D
Option D is the most cost Efficient
vip2 👍 1 Selected: A
remove entire DynamoDB and DAX is used for reduce RCU
Training 👍 2
Should be A. With Variable lengths of time, Lambda is not the right choice.
trungtd 👍 3 Selected: D
"the contests run for variable lengths of time" does not mean that those time periods are not known. We do not need a fixed value for TTL but can use Lambda to change timestamp depending on each contest.
9f02c8d 👍 2
Option D, The option A doesn't fulfill the requirement of cost effectiveness as there is no reason to use DAX
red_panda 👍 2 Selected: A
Correct option is A here. First of all, we don't know how much time the contest will last as per requirements, so fix the TTL it's a mistake. Second point, we can delete the entire table as we didn't the file after the end of the context, so no data to retain. Finally, for web contest, we don't know how much users will be online, and providing a cache layer might be a good solution.
titi_r 👍 2 Selected: D
D - correct.
tushar321 👍 2
D. There is no in memory cache requirement here for DAX. So omitting A
bjexamprep 👍 3 Selected: A
The question is looking for “MOST cost-effectively”. I assume DAX + DynamoDB is cheaper than DynamoDB only. Cause DAX should be able to reduce the RCU cost and improve performance. This is an online contest, which means the RCU could be very high. "the contests run for variable lengths of time" means you can't set a fix TTL for the record entry. And even you can have a fix time, the record being submitted 1 min before the deadline will still be kept for the TTL and keep generating cost.
pangchn 👍 4 Selected: A
Vote for A here reason as specified by zouwelaar
zouwelaar 👍 4 Selected: A
You are forgetting that the contests run for variable lengths of time. So Lambda and TTL are out.
career360guru 👍 2 Selected: D
Option D
duriselvan 👍 3
Time To Live (TTL) for DynamoDB is a cost-effective method for deleting items that are no longer relevant. TTL allows you to define a per-item expiration timestamp that indicates when an item is no longer needed. DynamoDB automatically deletes expired items within a few days of their expiration time, without consuming write throughput.
TheCloudGuruu 👍 4 Selected: D
Lambda to save cost
nharaz 👍 4 Selected: D
D is the most cost-effective solution. It leverages DynamoDB for efficient, scalable storage with automatic data expiration via TTL and AWS Lambda for flexible, event-driven processing. This setup minimizes costs by using resources only when needed and automatically scaling to match demand without the need for manual intervention or over-provisioning.
kejam 👍 2 Selected: D
Answer D: Seems to be the MOST cost-effective solution
master9 👍 2 Selected: D
he most cost-effective solution would be to use AWS Lambda for processing the contest data and selecting a winner. AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources. DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale. It’s a fully managed, multiregion, multimaster, durable database with built-in security, backup and restore, and in-memory caching for internet-scale applications

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option D migrates storage to DynamoDB (pay-per-request, no idle cost), runs the winner-selection logic as Lambda (no servers to run between contests), and uses DynamoDB TTL to expire entries automatically at contest end, meeting the no-retention rule with minimal cost.

Why the Other Options Are Wrong

Option A adds DAX, a provisioned accelerator that raises cost with no benefit here. Option B uses Redshift, which is heavy and overkill for simple contest entries. Option C keeps RDS with ElastiCache, still provisioned and more expensive than serverless DynamoDB.

Community Comment Notes

m1xa (likes 6) favors Lambda plus TTL because the contest is a short-term task. SIJUTHOMASP notes cost is the only concern and DAX is unnecessary. The vote is D (65) over A (35).

Official Reference

Related Analysis

Practice All SAP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full SAP-C02 Practice Test →

← Back to SAP-C02 Study Guide