This project is an alert notification system that send an email to the bucket owner when an object is uploaded to an S3 bucket. It leverages Amazon S3, IAM, Lambda with Python, and SNS topics. The details of the notification include - the bucket name, file name, file size, upload date and time (UTC) and AWS account used to upload the object.
- Cloud Provider - AWS
- Services Used - S3 bucket, IAM, Lambda, SNS
- Programming Language - Python 3.11
git clone https://github.com/Lakunzo/terraform-S3-notifications.git
Make changes to the following variables
- aws-access-key - aws access key for programmatic functions
- aws-secret-key - aws secret key for programmatic functions
- aws-token-key (Optional) - aws token key for programmatic functions
- sns-endpoint - email to subecribe and receive notifications
- AWS Principal - to allow access to the account and user ID with permissions to create and administer KMS keys
- Initialize Terraform backend
terraform init
- Validate the Terraform configuration
terraform validate
- Run the Terraform plan to view the resources that will be created
terraform plan
- Run Terraform apply to create the needed resources and type 'yes' to proceed
terraform apply
- Confirm if you have the following resources created
- An S3 bucket with SSE-KMS keys, and an event notification.
- An SSE-KMS Key attached to the S3 bucket
- A Lambda function with a Python code
- An SNS topics with a subscription sent to the configured email address
- An IAM role with required permission policies
Click the link in the email to confirm the SNS subscription.
Upload an object to the S3 bucket to test the email notification
- Run Terraform destroy to remove all created resources. Type 'yes' to proceed
terraform destroy