Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For DVA-C02 candidates, the confusion often lies in how to architect asynchronous error handling in Lambdas to minimize code changes and maximize reliability. In production, this is about knowing exactly how Lambda Destinations work compared to queuing or orchestration alternatives for failed executions. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
Your team at CloudPix Studio is building an automated profile picture service. When users upload photos, these files land in an S3 bucket under the /uploads/original/ prefix. An AWS Lambda function named AvatarGenerator is triggered automatically to generate avatars from these original images. However, during testing, some images cause the AvatarGenerator function to time out due to processing complexity.
To improve service reliability without spending excessive time rewriting code, you want to implement a fallback mechanism: if the AvatarGenerator Lambda fails, a secondary Lambda function called ImageResizer should process the image instead by resizing it appropriately.
The Requirement: #
Implement a fallback process where the ImageResizer Lambda runs when AvatarGenerator fails, minimizing additional development effort.
The Options #
- A) Set the
ImageResizerLambda function as a destination of theAvatarGeneratorLambda function for events that fail processing. - B) Create an Amazon Simple Queue Service (Amazon SQS) queue. Set the SQS queue as a destination with an on-failure condition for the
AvatarGeneratorLambda function. Configure theImageResizerLambda function to poll from the SQS queue. - C) Create an AWS Step Functions state machine that invokes the
AvatarGeneratorLambda function and uses theImageResizerLambda function as a fallback. Create an Amazon EventBridge rule that matches events from the S3 bucket to invoke the state machine. - D) Create an Amazon Simple Notification Service (Amazon SNS) topic. Set the SNS topic as a destination with an on-failure condition for the
AvatarGeneratorLambda function. Subscribe theImageResizerLambda function to the SNS topic.
Google adsense #
leave a comment:
Correct Answer #
A
Quick Insight: The Developer Imperative #
When managing asynchronous Lambda invocation failures, Lambda Destinations provide a native, low-effort mechanism to route failed events directly to another Lambda, SNS topic, SQS queue, or EventBridge, without additional polling or orchestration setup. This makes Option A the least development-intensive solution that meets the fallback requirement.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option A
The Winning Logic #
Using Lambda Destinations with on-failure routing allows the AvatarGenerator Lambda to automatically send failed event records to the ImageResizer Lambda without the need for additional components or custom polling logic. This fully managed, event-driven pattern eliminates the operational overhead of building queues or orchestrations, and requires minimal configuration changes—perfect for a developer wanting the least effort fallback.
- Lambda Destinations were specifically introduced to handle async event failures efficiently by forwarding events to destination targets.
- You configure
onFailuredestinations on theAvatarGeneratorfunction’s asynchronous invocation settings. - No need to implement polling or state machines; this reduces complexity and development time.
The Trap (Distractor Analysis): #
-
Why not Option B?
SQS is a durable queue and can handle retries, but it introduces more components and requires theImageResizerLambda to poll the queue. This adds operational effort and complexity, against the “least development effort” requirement. -
Why not Option C?
Step Functions orchestrate multi-step workflows well, including fallback patterns, but require defining new workflows, permissions, state machine, and integration with EventBridge—significantly more initial setup and ongoing maintenance. -
Why not Option D?
SNS can broadcast messages easily, but SNS topics don’t guarantee delivery order or message durability in failure scenarios and require theImageResizerLambda to subscribe, adding more moving pieces compared to native Lambda Destinations.
The Technical Blueprint #
B) For Developer (Code/CLI Snippet):
# Configure the AvatarGenerator Lambda's asynchronous invocation with a failure destination to the ImageResizer Lambda ARN
aws lambda put-function-event-invoke-config \
--function-name AvatarGenerator \
--maximum-retry-attempts 0 \
--destination-config '{"OnFailure":{"Destination":"arn:aws:lambda:region:account-id:function:ImageResizer"}}'
This AWS CLI command sets the on-failure destination to the ImageResizer Lambda, ensuring all failed events are automatically forwarded.
The Comparative Analysis #
| Option | API Complexity | Performance | Use Case |
|---|---|---|---|
| A | Low | High | Ideal for simple async failure routing with minimal dev effort |
| B | Medium | High | Suitable when durable queuing and selective processing needed |
| C | High | Medium | Best when numerous fallbacks or complex workflows are required |
| D | Medium | Medium | Good for fan-out notifications but less guaranteed delivery |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick Lambda Destinations when you see asynchronous Lambda invocations needing automatic failure routing with minimal infrastructure.
Real World #
In production, teams may prefer SQS or Step Functions for complex retry logic or orchestration needs. But for straightforward fallback Lambdas, Lambda Destinations offer an elegant, low-maintenance solution.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the DVA-C02 exam.