A quick way to count cloud resources using bash Source: https://github.com/hpcprofessional/count
- Log into the AWS Console
- Navigate to the Tag Editor
- Depending on circumstances set the regions and/or resource types as appropriate. (Tip: 'All regions' and 'All supported resource types' if it captures your estate )
- Note the relative position of the Type column. (Script assumes it's the fourth position)
- Click "Export the CSV"
- Move the downloaded file ("resources.csv") to this folder
- TIP: You can join (concatenate) multiple AWS resource CSV's into a single file
- If necessary, edit count_aws.sh to adjust the FIELD variable (line 6?) to account for column placement
- Run the count_aws.sh. It will print output wi th the count of each resource type found
Potential enhancement(s):
- resources.csv can have varied header ordering. Adding code to account for this (via the FIELD variable) might be good to do someday.
- Log in to Azure Portal
- Select "All Resources"
- Click "Export to CSV"
- Move the downloaded file ("Azureresources.csv") to this folder
- TIP: You can join (concatenate) multiple Azure resource CSV's into a single file
- Run the count_azure.sh script. It will print output with the count of each resource type found
Potential enhancement(s):
- So far, no examples of Azureresources.csv has varied its separator. Adding code to account for this (via a new SEP variable) might be good to do someday.
- So far, no examples of Azureresources.csv has varied in its headers. Adding code to account for this (via the FIELD variable) might be good to do someday.
- install glcoud utility
- Authenticate as appropriate ('gcloud auth login' perhaps?)
- Run the script
Potential enhancements(s): None expected at this time