Ordered processing with a synchronous AWS Lambda target on Amazon EventBridge

Amazon EventBridge → AWS Lambda → Amazon CloudWatch → Amazon SQS DLQ

Processes events in order by invoking an AWS Lambda function synchronously from a FIFO subscriber on an Amazon EventBridge custom event bus.

This pattern shows how an Amazon EventBridge custom event bus (the eventsv2 API) processes events in order by invoking an AWS Lambda function synchronously (InvocationType REQUEST_RESPONSE) from a FIFO subscriber.
The publisher sends a sequence of OrderPlaced events that share one EventGroupId, each carrying a monotonically increasing sequence number. The FIFO subscriber invokes the consumer AWS Lambda function synchronously, waiting for each event to be confirmed before delivering the next in the group. The consumer logs each sequence number as it processes, and the Amazon CloudWatch log shows the sequence handled in order, one at a time. Synchronous confirmation gives the reliability and back-pressure that teams used to get by adding an Amazon SQS queue between the bus and AWS Lambda, so no Amazon SQS buffer sits in the path.
This deploys one Amazon EventBridge custom event bus, one FIFO subscriber configured for synchronous invocation, one Node.js 24 (TypeScript) AWS Lambda function, an Amazon SQS dead-letter queue (safety net), and the AWS Identity and Access Management (IAM) delivery role.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-custom-lambda-sync/typescript/sam

Deploy

sam build --template infra/template.yamlsam deploy --guided --capabilities CAPABILITY_NAMED_IAM


Testing

Run the offline unit tests: npm test
After deploying, publish an ordered sequence: scripts/run_publish.sh [stack-name] [region] [count]
Watch the consumer process the group in order: aws logs tail /aws/lambda/sync-orders-consumer --since 5m --format short
The 'Processing order ... seq=' lines appear in order (seq=1, then seq=2, then seq=3, ...), confirming ordered, synchronous delivery.

Cleanup

Delete the stack: sam delete

Created by:

Kurt Tometich

Kurt Tometich

Kurt is a Sr. Solutions Architect based in Colorado who enjoys building lean, mean serverless solutions.

Follow on LinkedIn