This project sets up an AWS S3 upload notification system using AWS Lambda, SNS, and S3. When an object is uploaded to an S3 bucket, a Lambda function is triggered, which publishes a notification to an SNS topic. Subscribers to the SNS topic receive notifications, enabling real-time awareness of S3 bucket activity.
-
Create AWS Resources:
- Create an S3 bucket to monitor for object uploads.
- Set up an SNS topic to receive notifications.
- Create a Lambda function to trigger on S3 upload events and publish to the SNS topic.
-
Lambda Function Configuration:
- Write the Lambda function code to handle S3 upload events and publish notifications to the SNS topic.
- Configure the Lambda function with appropriate permissions to access S3 and SNS.
-
Subscribe to SNS Topic:
- Subscribe to the SNS topic using your desired endpoint (e.g., email) to receive notifications.
-
Testing:
- Upload an object to the S3 bucket to trigger the Lambda function.
- Verify that notifications are successfully delivered via the subscribed endpoint.
To programmatically trigger the Lambda function, you can use the provided Python script notify.py
. This script utilizes the AWS SDK for Python (Boto3) to invoke the Lambda function.
- Install the Boto3 library:
pip install boto3