This repository contains a Bash script that automates the creation of several AWS resources to set up a notification system triggered by changes (create or delete actions) in an S3 bucket. This system utilizes AWS services such as IAM, S3, Lambda, and SNS to implement an integrated solution.
- IAM Role Creation: Sets up an IAM role with appropriate permissions for Lambda to execute.
- S3 Bucket: Creates an S3 bucket that will store your files and trigger notifications on changes.
- Lambda Function: Implements a Lambda function that gets invoked on changes to the S3 bucket.
- SNS Topic: Creates an SNS topic and subscribes your email so that you can receive notifications about bucket changes.
- Bucket Notification Configuration: Configures the S3 bucket to send events to the Lambda function, thus enabling real-time alerts.
Before running the script, ensure you have the following:
- An AWS account with sufficient permissions to create and manage IAM roles, S3 buckets, Lambda functions, and SNS topics.
- AWS CLI installed on your local machine or EC2 instance.
zip
utility installed for packaging the Lambda function.
-
Clone this repository:
git clone https://github.com/alokemajumder/AWS-S3-Event-Notification-System.git``
-
Navigate to the cloned directory:
cd AWS-S3-Event-Notification-System
-
Open a terminal.
-
Run the script with:
bash setup.sh
-
Follow the on-screen prompts to enter your email and optionally name your S3 bucket and Lambda function.
-
Check your email and confirm the SNS subscription to start receiving notifications.
The trust-policy.json
( Included in the repo) is essential for the IAM role creation, allowing AWS Lambda to assume the role.
Ensure this file is in the same directory as your script before executing.
We strive to keep the script compatible with the latest AWS CLI versions and functionality. For better maintenance and feature update, any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
Always open an Issue first and then tag the PR
This project is licensed under the MIT License
- Thanks to AWS for the comprehensive documentation that assisted in the API usage.
- This script is based on community examples and personal experimentation.