DVA-C02 Development with AWS Services Practice Question
A developer is building a serverless application using AWS Step Functions to orchestrate multiple AWS Lambda functions. One of the Lambda functions occasionally fails due to a transient error. The developer wants the Step Functions execution to automatically retry the failed task up to three times with exponential backoff. Which configuration should the developer set in the Step Functions state machine definition?
⚠ Common exam trap
Many candidates confuse the Retry field (for retries) with the Catch field (for error handling) or mistakenly think retry logic belongs in the Lambda function code rather than in the state machine definition.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use the Amazon States Language (ASL) Retry field in the Task state definition.
The Amazon States Language (ASL) provides a native Retry field within a Task state definition that allows you to specify retry policies, including a maximum retry count and exponential backoff. This is the intended mechanism for handling transient failures in Step Functions without requiring custom code or external retry logic.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add a Retry clause in the Lambda function's configuration with a maximum retry count of 3.
Why it's wrong here
Lambda function configurations do not include a direct retry mechanism for synchronous invocations initiated by services like Step Functions. While Lambda handles retries for asynchronous invocations, Step Functions invokes Lambda synchronously, meaning any retry logic for transient failures must be managed by the caller. Attempting to configure retries within Lambda's settings for this scenario would be ineffective, as the Step Functions state machine is explicitly designed to orchestrate the retry behavior.
- ✓
Use the Amazon States Language (ASL) Retry field in the Task state definition.
Why this is correct
The Amazon States Language (ASL) Retry field is the definitive and recommended mechanism within AWS Step Functions for handling transient failures in Task states. This declarative approach allows developers to specify which error types to retry, the maximum number of attempts, the initial delay, and an exponential backoff rate. Implementing retries directly in the state machine definition ensures robust error handling without modifying the underlying Lambda function code.
- ✗
Wrap the Lambda function invocation in a custom while loop within the function code.
Why it's wrong here
Implementing a custom while loop within the Lambda function code to retry its own operations is an anti-pattern when orchestrated by Step Functions. This approach unnecessarily increases the Lambda function's execution duration and cost, complicates the function's logic, and bypasses Step Functions' native, declarative retry capabilities. It also obscures the state machine's control flow, making error handling less transparent and harder to manage at the orchestration layer.
- ✗
Use the Amazon States Language Catch field in the Task state to redirect to a retry logic.
Why it's wrong here
The Amazon States Language (ASL) Catch field is designed for handling specific errors by transitioning the state machine to a different state, rather than retrying the current one. It serves as an error recovery mechanism, allowing the workflow to gracefully handle unrecoverable failures or errors that have exhausted all defined Retry attempts. While crucial for comprehensive error management, Catch does not implement the retry logic itself; it defines an alternative path after an error occurs or retries are exhausted.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
Courseiva writes every DVA-C02 question from scratch — 724 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.