Skip to content
25K
Console

Bucket notifications

Create an S3 bucket and subscribe to its events with a function.

sst.config.ts
const bucket = new sst.aws.Bucket("MyBucket");
bucket.notify({
notifications: [
{
name: "MySubscriber",
function: "subscriber.handler",
events: ["s3:ObjectCreated:*"],
},
],
});
subscriber.ts
import { Handler, S3Event } from 'aws-lambda';
export const handler: Handler<S3Event> = async (event) => {
console.log(event);
return "ok";
};

View the full example.