This project implements a serverless pipeline that processes image uploads using AWS Lambda, S3, and SNS.
- Upload: A user uploads an image file to the configured S3 bucket.
- Trigger: The S3 upload event triggers the AWS Lambda function.
- Process: The Lambda function retrieves the object metadata (size, type) from S3.
- Notify: The function constructs a message and publishes it to an Amazon SNS topic.
- Log: Execution logs and errors are sent to Amazon CloudWatch.
- AWS Account
- AWS CLI configured
- Python 3.x installed
-
Create an S3 Bucket: Create a bucket to store your images.
-
Create an SNS Topic: Create a Standard SNS topic and subscribe your email/SMS to it. Note the Topic ARN.
-
Deploy Lambda Function:
- Create a new Lambda function (Python 3.x runtime).
- Copy the code from
lambda_function.pyinto the function. - Add an S3 Trigger to the Lambda function, selecting your created bucket and event type
All object create events.
-
Configure Environment Variables: In the Lambda configuration, add the following environment variable:
SNS_TOPIC_ARN: The ARN of your SNS topic.
-
IAM Permissions: Ensure the Lambda execution role has permissions to:
s3:GetObjectands3:ListBucketon your S3 bucket.sns:Publishon your SNS topic.logs:CreateLogGroup,logs:CreateLogStream,logs:PutLogEvents.
Upload an image to your S3 bucket. You should receive an SNS notification (Email/SMS) with the file details shortly after. Check CloudWatch Logs for execution details.
