I had the problem of getting all the EC2 instances from all regions with their CPU, RAM, Storage details. How to get all ec2s in all regions? So developed a script for this purpose.
Before this script, it was taking manual effort for me to collect the EC2s from all regions one by one. After getting the EC2s, it is also a manual effort to collect RAM, CPU, and storage details. Another challenge is to find the relevant AMI and the operating system.
The script is in this link: https://github.com/fuatu/aws-resources.
The installation steps are in the readme file of the Github repo.
You can also see the installation steps here:
- clone the repo or download it
- go inside the folder
- install required packages
- copy credentails.yaml.example to credentails.yaml
- you need an AWS user with programmatic access, relevant permissions to read ec2 instance details. The user keys
- Update credentails.yaml with your aws key and secret
- run the script
- the ec2 details from all regions will be written to file ec2s.csv in the same folder