Repository navigation
New serverless pattern - eventbridge-webhook-sfn-typescript-cdk - #3563
Open
NithinChandranR-AWS wants to merge 1 commit into
Conversation
…Webhook Events to AWS Step Functions - Webhook event source (HMAC-SHA256 over timestamp.body, 300 s tolerance, content-based dedup) on an EventBridge Custom Event Bus - Subscriber with a DATA filter and batches of up to 10 starts a Standard JSONata workflow - Map over the batch: known types with a string or number id go to a conditional DynamoDB PutItem (stored or duplicate), others are ignored, write errors end in a Fail state - Scoped permissions: PutWebhookEvents on the bus, GetSecretValue on the source's own secret, StartExecution on the state machine, PutItem on the table - Role trusts carry aws:SourceAccount and aws:SourceArn conditions (live-tested: signed requests are delivered) - README with signed curl tests for 403, 200, dedup, idempotent write, filter and stale timestamp
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Amazon EventBridge Webhook Events to AWS Step Functions and Amazon DynamoDB. A third-party provider posts HMAC-signed webhooks to an HTTPS URL that EventBridge hosts; EventBridge checks the signature and timestamp, drops repeated content and puts each body on a Custom Event Bus, and a subscriber starts a Step Functions workflow that stores each known event once in DynamoDB. There is no Amazon API Gateway, Lambda function URL or verifier function. Claim issue: #3562.
Key Innovation
First pattern with an EventBridge webhook event source (
AWS::EventsV2::EventSource), and the first Custom Event Bus subscriber that targets Step Functions. The existingeventbridge-webhooksfamily runs a Lambda function URL and a verifier function; this one has no ingest compute, so it is a new family rather than a variant.Architecture
Provider (HMAC-SHA256 over timestamp.body) -> Amazon EventBridge webhook event source (signature, timestamp, content-based dedup) -> Custom Event Bus -> subscriber (filter, batches of up to 10) -> AWS Step Functions (Map, Choice) -> Amazon DynamoDB conditional PutItem
Deployed and Tested
Stack deploys in us-west-2 (~90 s) and us-east-1 (~120 s), 11 CloudFormation resources, no AWS Lambda function. README Testing run as written in zsh and bash 3.2 (us-west-2) and zsh (us-east-1), identical output:
403; a signed request 15 minutes old:403.order.created:200, one executionSUCCEEDEDwithstored, item read back from DynamoDB with that execution ARN.200and still one execution (content-based deduplication).200, second execution reportsduplicate, the item keeps the first execution ARN.ignored; a body withoutidis not delivered by the subscriber filter.Checklist
events:PutWebhookEventson the bus andsecretsmanager:GetSecretValueonsecret:events-webhook!*; subscriber role:states:StartExecutionon the one state machine; workflow role:dynamodb:PutItemon the table; trust policies withaws:SourceAccountandaws:SourceArn)addPropertyOverridebecause aws-cdk-lib 2.278.0 does not type it yet)validate.jspasses, including the admin IAM check