Skip to content
GitHub Discord

Bucket queue notifications

Create an S3 bucket and subscribe to its events with an SQS queue.

sst.config.ts
const queue = new sst.aws.Queue("MyQueue");
queue.subscribe("subscriber.handler");
const bucket = new sst.aws.Bucket("MyBucket");
bucket.notify({
notifications: [
{
name: "MySubscriber",
queue,
events: ["s3:ObjectCreated:*"],
},
],
});
subscriber.ts
import type { SQSEvent } from "aws-lambda";
export const handler = async (event: SQSEvent) => {
console.log(event);
return "ok";
};

View the full example.