Collects credit information across all AWS accounts from your AWS Identity Center (SSO) portal using browser automation.
- Devcontainer
- Google Chrome on the Devcontainer host
The script uses the AWSAdministratorAccess permission set by default. If your accounts use a different permission set, set the TARGET_ROLE environment variable in the devcontainer.json file to the name of the permission set you want to target (e.g. sso-admin).
Linux:
google-chrome --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 --user-data-dir=/tmp/chrome-debug-profilemacOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 --user-data-dir=/tmp/chrome-debug-profileWindows (PowerShell):
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --remote-debugging-address=0.0.0.0 --user-data-dir=$env:TEMP\chrome-debug-profileIn the Chrome window that opens, navigate to your AWS Identity Center portal (e.g. https://d-xxxxxxxxxx.awsapps.com/start) and log in.
python collect_credits.py- A formatted report is printed to the terminal
- A
credits_report.jsonfile is saved with structured results per account, including status (ok, or an error reason) and any credits found
Use convert_credits.py to convert credits_report.json into a flat CSV and/or Excel file. Accounts with multiple credits are expanded so each credit occupies its own row. Accounts with no credits are included as a single row with blank credit columns.
pip install -r requirements.txt# Export to both CSV and Excel (default)
python convert_credits.py
# Export to CSV only
python convert_credits.py --format csv
# Export to Excel only
python convert_credits.py --format excel
# Specify a custom input file and output name (no extension)
python convert_credits.py my_report.json --format both --output my_output| Column | Description |
|---|---|
account_name |
AWS account name |
account_id |
12-digit AWS account ID |
status |
Scrape status (ok, error message, etc.) |
credit_name |
Name of the AWS credit |
amount_issued |
Total amount originally issued |
expiration_date |
Credit expiration date |
amount_used |
Amount consumed so far |
amount_remaining |
Remaining balance |