This is a Terraform project that creates an AWS Lambda function that cleans up an S3 bucket every Sunday at 12:00 AM EST.
It also contains a Python script that detects if there are any files left in the S3 bucket after being cleaned out and sends an alert to the DevOps team.
Before executing the project
Create an AWS Account
Install AWS CLI and Configured it
Install Terraform CLI
Configure AWS Credentials in Your Environment.
export AWS_ACCESS_KEY_ID="your-aws-access-key-id"
export AWS_SECRET_ACCESS_KEY='your-aws-secret-access-key-id"
Clone the project first
git Clone https://github.com/Haji001/reporting-files.git
Change to the 'reporting-files' directory
cd reporting-files
Initialize Terraform
terraform init
See Preview of Actions Terraform Would Take Before 'terraform apply'
terraform plan
After you ensure that it creates the resources that you expect. Apply to create the resources.
terraform apply
After verifying in the AWS console that Lambda function was created. Wait until Sunday at 12:00AM EST to get a notification if any files are found in the bucket. Then delete the resources.
terraform destroy