We want reduce costs in our AWS account. Normally in DEVs accounts we have a lot of AMIs, Snapshots, Volumes that users forget to delete and it doesn't remove automatically when you destroy an EC2 Instance.
This small script help you to identify them to take some action.
Your boss Finance will appreciate it ;-)
- AWS API (EC2)
- Python3.9
https://linuxhostsupport.com/blog/how-to-install-python-3-9-on-ubuntu-20-04/ (Google)
pip3 install boto3
pip3 install xlsxwriter
AWS_PROFILE=XXX python3 infoEC2SnapshotsReportUsage.py
If everything is working well, we will see a new Excel in your same location:
AWS_PROFILE=sso-nvoperations-pu python3 py
Excel File going to be created --> Status-EC2-ENVIRONMENT-14-Mar.xlsx
Workbook closed
Apache
More info -->
https://gist.github.com/nicbor/14987b2a382a384fd6299f6a76def099
https://www.tutorialspoint.com/How-do-we-use-re-finditer-method-in-Python-regular-expression
https://interactivechaos.com/en/python/function/remultiline
https://www.programiz.com/python-programming/methods/built-in/enumerate
David Álvarez Quiroga