Skip to content

New serverless pattern - dsql-cdc-eventbridge-pipes-typescript-cdk - #3565

Open
NithinChandranR-AWS wants to merge 3 commits into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-dsql-cdc-eventbridge-pipes-cdk
Open

NithinChandranR-AWS wants to merge 3 commits into
aws-samples:mainfrom
NithinChandranR-AWS:NithinChandranR-AWS-feature-dsql-cdc-eventbridge-pipes-cdk

Conversation

@NithinChandranR-AWS

@NithinChandranR-AWS NithinChandranR-AWS commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Amazon Aurora DSQL CDC to Amazon EventBridge with Amazon EventBridge Pipes. Aurora DSQL writes each committed row change to Amazon Kinesis Data Streams; an EventBridge pipe keeps complete records, sets the event type from the record's operation code (c, u, d), reshapes the change into the event detail and puts it on a custom event bus, where rules send every change to an audit queue, inserts to a validation queue and deletes to an alerts queue in Amazon SQS. There is no function in the data path. Claim issue: #3564.

Key Innovation

First Aurora DSQL CDC pattern without a function in the data path. The existing dsql-cdc-eventbridge pattern publishes the records from an AWS Lambda function and names the events INSERT, UPDATE and DELETE; here the pipe's filter, DetailType and input template do that work, and the raw operation codes are the event types.

Architecture

Amazon Aurora DSQL CDC stream -> Amazon Kinesis Data Streams (on-demand, 10 MiB records) -> Amazon EventBridge pipe (filter {"data":{"type":["full"]}}, DetailType $.data.op, input template, bisect, dead-letter queue) -> custom event bus -> audit, inserts and deletes rules -> Amazon SQS queues, with a shared rule-target dead-letter queue

Deployed and Tested

Stack deploys in us-west-2 (~103 s) and us-east-1 (~106 s), 24 CloudFormation resources. The README code blocks ran from a clean clone of this branch in zsh (us-west-2) and bash 3.2 (us-east-1), non-interactively (cdk --require-approval never / --force, SQL through psql stdin, repeated queue reads), with the same results in both:

  • Insert, update and delete in one table: c, u and d in the audit queue, c in the validation queue, d in the alerts queue (a read about 30 s after the SQL was empty, the next at about 85 s had all of them).
  • A row whose event is above the 1 MB limit: one pipe dead-letter message (RetryAttemptsExhausted, KinesisBatchInfo) about 10 s later, TargetInvocationFailed log lines with the size error, and the ordinary row behind it still reached the audit queue.
  • Alerts queue policy removed: the delete event in the rule-target dead-letter queue with ERROR_CODE NO_PERMISSIONS, RULE_ARN and TARGET_ARN; policy restored afterwards.
  • Cleanup: cdk destroy (~145 s) removed the stack and the custom resource deleted the CDC stream; the custom resource's log group came back without retention, as Cleanup step 4 says, and step 4 removed it; the cluster was deleted. No stack, stream, pipe, log group or cluster left.
  • Not tested: a row above 9 MiB (chunked and fragment records), which the filter drops.

Checklist

  • IAM least-privilege (pipe, CDC and custom-resource roles scoped to the one stream, bus, dead-letter queue, log group and cluster; trust with aws:SourceAccount and aws:SourceArn; plus the CDK-managed basic execution role of the custom-resource function)
  • CDK synth passes (24 resources)
  • Deployed and tested end-to-end in us-west-2 and us-east-1
  • validate.js passes, including the admin IAM check
  • No duplicate patterns in repo

…QL CDC to Amazon EventBridge with Amazon EventBridge Pipes

- Amazon EventBridge pipe from Amazon Kinesis Data Streams to a custom event bus: filter, event type from the operation code, reshaped detail
- Three rules route every change, inserts and deletes to Amazon SQS queues
- Dead-letter queues for the pipe and for the rule targets
- AWS CDK TypeScript, no function in the data path

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants