Bucket notifications
Create an S3 bucket and subscribe to its events with a function.
const bucket = new sst.aws.Bucket("MyBucket");bucket.notify({ notifications: [ { name: "MySubscriber", function: "subscriber.handler", events: ["s3:ObjectCreated:*"], }, ],});import { Handler, S3Event } from 'aws-lambda';
export const handler: Handler<S3Event> = async (event) => { console.log(event); return "ok";};View the full example.