Skip to content
Cover image for Deploy "The EventBridge Circuit Breaker" pattern today (AWS API Gateway, Lambda, EventBridge, DynamoDB)

Deploy "The EventBridge Circuit Breaker" pattern today (AWS API Gateway, Lambda, EventBridge, DynamoDB)

nideveloper profile image Matt Coulter twitter logo github logo Updated on ・1 min read

cdkpatterns (16 Part Series)

1) What is 2) Deploy "The EventBridge Circuit Breaker" pattern today (AWS API Gateway, Lambda, EventBridge, DynamoDB) 3 ... 14 3) Deploy “The Big Fan” Serverless Pattern Today (AWS API Gateway, SNS, SQS and Lambda) 4) Deploy "The Simple GraphQL Service" Serverless Pattern Today (AWS Appsync, DynamoDB, Lambda, GraphQL) 5) Deploy Any Serverless Pattern to AWS in 3 Commands 6) Learn GraphQL and AWS AppSync By Running One Command 7) S3 CSV File to DynamoDB using EventBridge, AWS Lambda, Fargate and SQS 8) Learn Lambda Destinations combined with Amazon EventBridge using AWS CDK for truly decoupled Event Driven Architecture 9) Watch Deconstructing The Destined Lambda on Youtube today! AWS Lambda, API Gateway, Destinations and EventBridge 10) Learn the 3 AWS Lambda states today (the single purpose function, the fat lambda and the lambda-lith). 11) Watch me deploy a React and an Angular website to AWS using AWS CDK with one command 12) Watch me deconstruct "The EventBridge ETL" Serverless Architecture Pattern 13) Learn "the saga stepfunction" pattern today - Single Table DynamoDB, Lambdas, Step Function and API Gateway 14) Watch me deconstruct "The Scalable Webhook" AWS Serverless Pattern - Lambda, API GW, SQS 15) Learn Serverless Tracability with "The X-Ray Tracer" CDK Pattern - Lambda, SNS, SQS, DynamoDB 16) Tune your AWS Lambdas for best cost vs performance with "The Lambda Power Tuner" serverless pattern

Alt Text

This is a pattern adapted from "The Circuit Breaker" by Jeremy Daly. I used EventBridge to route service call failures to a lambda that inserts them into DynamoDB with a 60 second Lifespan. Then when consumers call the API Gateway to call our external service we check if the number of errors in the last 60 seconds is above our threshold. If it is, we instantly error saving lambda execution costs and user time.

The pattern is here:

This pattern is available in Python/TypeScript AWS CDK versions but also each version has the native CloudFormation checked in as template.yaml.

twitter logo DISCUSS (3)
markdown guide

Interesting idea. I've seen implementations using only Lambda + Dynamo and others using Step Functions. EventBridge is also interesting. I'm thinking Kineses might also fit.

Just a heads up, the pattern was suggested by Martin Fowler long before. AWS also refers to him. I don't know if anyone else before him did, though. 😉


Thanks for the heads up. I can absolutely add him in with links to his content. That’s why I am trying to pull this all into one central place so these things don’t get lost!


Updated with link to Martin Fowler and his article from 2014 on the circuit breaker pattern.

Classic DEV Post from Jul 30 '19

PublishTo.Dev: Scheduling article publishing on

Matt Coulter profile image
Software Architect working for @Liberty_IT in Belfast. Passionate about #Serverless, #AWS, @cdkpatterns, #TCO, and CI/CD