S3 Notify Lambda
An AWS Lambda function that posts messages to Slack when a new object is added to a bucket.
You will need
- An AWS Account with S3, Lambda and SNS permissions
- A Slack team
Setup
- Create your S3 bucket
- Set up the bucket to post events to an SNS topic (Via Properties/Events)
- Create a new "Incoming Webhooks integration" for your Slack team. You can select the channel etc. here. Take a note of the Webhook URL.
- Create a new Lambda function
- Copy/paste the code from index.js into the Lambda
- Set the environment variable
SLACK_WEBHOOK_URL
to the webhook address you noted down earlier, without the host part - In the "Triggers" tab for your Lambda, add the SNS topic you created earlier
- Repeat for as many buckets as you like
Now you should see a message posted to your Slack channel for each new object added to the bucket. The message includes the object ID (filename), bucket name, and file size.