Skip to content

New serverless pattern - EventBridge Scheduler to Lambda with Dual DLQs#2981

Open
rssasidharan2 wants to merge 1 commit intoaws-samples:mainfrom
rssasidharan2:rssasidharan2-feature-eventbridge-schedule-lambda-dlq
Open

New serverless pattern - EventBridge Scheduler to Lambda with Dual DLQs#2981
rssasidharan2 wants to merge 1 commit intoaws-samples:mainfrom
rssasidharan2:rssasidharan2-feature-eventbridge-schedule-lambda-dlq

Conversation

@rssasidharan2
Copy link
Copy Markdown

@rssasidharan2 rssasidharan2 commented Mar 5, 2026

Issue #, if available:
#2982

Description of changes:
This pattern demonstrates EventBridge Scheduler's failure handling capabilities through dual Dead Letter Queues (DLQs). One DLQ captures Lambda execution failures (code errors, timeouts), while the other captures scheduler invocation failures (permissions, throttling, resource not found).

Pattern includes:

  • EventBridge Scheduler with configurable retry policy
  • Lambda function with async invocation
  • Dual DLQ architecture for comprehensive failure handling
  • Python-based implementation using AWS SAM
  • Complete testing instructions for both failure scenarios

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


log_info('Scheduled function invoked by EventBridge Scheduler', {'event': event})

execution_time = datetime.utcnow().isoformat() + 'Z'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember right, datetime.utcnow() is deprecated in Python 3.12. You may want to use datetime.now(datetime.UTC) or alternate function

Comment on lines +28 to +31
print('\nSIMULATING FAILURE')
print('This will trigger:')
print('1. Lambda async retry (up to 2 times)')
print('2. After all retries fail - Event sent to Lambda Execution DLQ')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of logging or aws_lambda_powertools.Logger module is preferred instead of print()

QueueName: !GetAtt LambdaExecutionDLQ.QueueName

# Dead Letter Queue for Lambda execution failures
LambdaExecutionDLQ:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both SQS DLQ queues do not configure server-side encryption. DLQ messages may contain event payloads with sensitive data. SQS supports SSE-SQS (managed) or SSE-KMS encryption. It is recommended to add SqsManagedSseEnabled: true to both queue definitions to showcase security aspect in pattern

Globals:
Function:
Timeout: 30
Runtime: python3.12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS Lambda supports python3.14 as latest version at the time of writing this, I'd recommend updating Function version to latest available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants