This project focuses on cost optimization while also improving resource management, monitoring, and cost analysis. It’s a comprehensive approach to managing cloud resources efficiently and cost-effectively.
Incorporating these strategies can make a significant difference for small businesses, helping them thrive in a competitive landscape while maintaining financial health and operational efficiency.
Resources used for this project includes: AWS Resource Groups,
Amazon CloudWatch Dashboards, Amazon CloudWatch Alarms, AWS Budgets with email/SNS alerts, Cost and Usage Report (CUR),Aws Lambda ,S3 Bucket for CUR storage and Amazon QuickSight for visualization
*Architectural View *
***PEREQUISITES *
Basic Knowledge of AWS Services
AWS Management Console
Scripting and Automation
Understanding of Cost Management Tools
Terraform setup
Terraform was used to ensure consistency and repeatability in resource provisioning and also automating infrastructure deployment reduces errors , manual effort and Tracks infrastructure changes using version control.
Add resource groups for cost monitoring, budgets and cost and usage report: This Provides detailed billing and usage data for all AWS services
Add S3 bucket resource group: This stores Cost and Usage Reports (CUR) data in a specified folder structure. , s3 is cost effective and acts as a data source for QuickSight
Add resource groups for cloud watch dashboard alarms and Lambda archive_file: This Monitors cost-related metrics like Estimated Charges and triggers alerts for anomalies to SNS when threshold set is exceeded
Terraform archive_file was used to automate the ZIP process eliminating the need for external dependencies.
Add a python script for your Lambda function. This Automate Resource Scheduling using Lambda-based start/stop automation
Configure your Lambda function to trigger start/stop resources based on a schedules via Event Bridge (make reference to the script above)
and for best security practices, add Iam role for Lambda. This Securely grants permissions to CUR, QuickSight, Lambda, and other services.
Add Lambda Iam policy-This ensure resources only have the permissions they need and provides fine-grained control for secure infrastructure operations
run terraform init, plan and apply to deploy
Some Tips :you can use commands to output the result on console should look like this.
some of the outs via console
Always remember to clean after yourself -Run terraform destroy to clean resources
PS: S3 bucket has to be emptied before it can be deleted, best to do the console
Feel free to pull codes from my GitHub. Happy Coding
https://github.com/Louretta/Aws-cost-optimization-Automation.git
Top comments (0)