- SQS queue – Sequin pushes to SQS; Lambda pulls via an event‑source mapping.
- SNS topic – Sequin publishes to SNS; SNS pushes straight into Lambda.
- Trigger downstream workflows (for example, send a Slack message or transactional email the moment a row is inserted).
- Keep an external cache or search index (Redis, OpenSearch, Algolia) in‑sync with Postgres updates. (When Sequin’s native sinks don’t meet your needs.)
- Fan‑out enriched CDC events to micro‑services that don’t have direct database access.
- Feed real‑time analytics pipelines (Kinesis, Firehose, Redshift) without complex ETL jobs.
- Detect anomalies in critical tables and raise alerts within seconds.
Architecture overview
- Sequin captures logical replication changes from Postgres.
- Changes are delivered to SQS or SNS (your chosen sink).
- AWS Lambda consumes the events—either by polling a queue (SQS) or by receiving pushes (SNS).
- Your Lambda code processes the payload (e.g., triggers workflows, updates downstream systems).
SQS vs SNS at a glance
- Ordering: You can use Sequin with an SQS FIFO queue to receive messages in order. For example, if a row is inserted than updated, an SQS FIFO queue will ensure your Lambdas process the insert before the update.
- Batching: SQS allows your Lambda to receive batches of messages. You might prefer batching if your Lambda is sending messages to another system, as batching can improve throughput.
Prerequisites
If you’re self‑hosting Sequin: Additionally:- Permissions in AWS to manage SQS/SNS and Lambda resources.
Option A – SQS queue
1. Create or pick a queue
Open SQS in AWS Console
Choose queue type
Name & settings
postgres-events.fifo). Leave defaults unless you need custom retention or DLQ.Copy Queue URL
2. Grant Sequin permission
Create IAM user
Configure user details
sequin-sqs-publisher) and click “Next”.Add permissions
Create access key
Save credentials
3. Create an SQS sink in Sequin
Open "Sinks" in Sequin
Enter queue details
Configure other settings
Save
4. Verify messages are being sent to SQS (optional)
Before proceeding to set up the Lambda consumer, it’s a good idea to verify that messages are being delivered to your SQS queue:- Make some changes in your Postgres database (e.g.,
insert into users(name) values ('test_user');). (If you had Sequin perform an initial backfill, you can skip this step.) - In the Sequin console, navigate to your SQS sink and check the “Messages” tab. You should see the changes listed with “Delivered” status.
- In the AWS Console, navigate to SQS → Your queue. In the graphs, you should see a spike in messages received.
- If messages aren’t appearing, check the sink’s status in Sequin (any error messages?)
5. Connect Lambda to the queue
Create the function
cdc‑processor, and choose your runtime (Node 18 in examples below).Click “Create function”.Add SQS trigger

6. Handle events in your function
If you didn’t specify a transform, refer to the messages reference for details on the default payload you’ll receive:7. Test the pipeline
- Insert a row in Postgres (
INSERT INTO users(name) VALUES ('alice');). - In Sequin, you should see “Processed messages” increase. The message should also be shown as “Delivered” in the “Messages” tab.
- In CloudWatch → Logs → “Log groups” locate
/aws/lambda/postgres-processorand confirm the event appears.
sqs:ReceiveMessage permission, and that any batch‑size or reserved‑concurrency limits aren’t blocking the invocation.
Option B – SNS topic
1. Create or pick a topic
Open SNS in AWS Console
Choose topic type
Name & settings
postgres-events). Leave defaults unless you need custom message retention.Note the Topic ARN
2. Create Lambda function
Create the function
cdc-processor, and choose your runtime (Node 18 in examples below).Click “Create function”.Set up function code
event.Records[*].Sns.Message as a string, so you’ll need to parse it as shown above.Add permissions
sns:Receive and sns:Subscribe permissions for your topic.3. Subscribe Lambda to the topic
Add SNS trigger
- Click “Add trigger”
- Select “SNS” from the trigger dropdown
- Select your topic
- Click “Add”

4. Grant Sequin permission
Create IAM user
Configure user details
sequin-sns-publisher) and click “Next”.Add permissions
Create access key
Save credentials
5. Create an SNS sink in Sequin
Open Sinks in Sequin
Enter topic details
Configure other settings
Save
6. Test the pipeline
- Insert a row in Postgres (
insert into users(name) values ('alice');). - In Sequin, you should see “Processed messages” increase. The message should also be shown as “Delivered” in the “Messages” tab.
- In CloudWatch → Logs → “log groups” locate
/aws/lambda/cdc-processorand confirm the event appears.
- The subscription between SNS and Lambda is properly configured and active
- The Lambda execution role has permissions to receive messages from SNS
- SNS delivery status notifications aren’t reporting failures (check SNS → Topics → your topic → “Subscriptions”)
Verify & monitor
- Sink dashboard – In Sequin, open the sink and watch the “Messages” tab for latest deliveries.
- SNS delivery status – In the SNS console, you can enable delivery status logging to CloudWatch to track message delivery.
- CloudWatch metrics – Monitor Lambda duration, error count, and SNS delivery metrics.
- CloudWatch Alarms – Set up alarms for delivery failures and Lambda errors to catch issues early.
Maintenance & troubleshooting
- Schema changes – When your database schema changes, your Lambda code may need updates to handle new or removed fields.
- Message filtering – Use SNS message filtering or Sequin’s filters to reduce noise.
- Backfills – Use Sequin’s “Backfill” feature to send existing rows to your topic when adding new consumers or recreating a Lambda.

