Hello, this bash one-liner needs bash, a correctly configured AWS CLI, wget, jq and that’s it.
The script will:
- Download the master file
- Parse the json file with jq extracting, for each product, the url of the current version
- Create a folder hierarchy with the name of the product (done by the settings of wget)
- Save the pricing, in that directory
For example the pricing of AmazonQLDB will be in the folder AmazonQLDB/current/
JSON
wget -q -O - https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json | jq -r '.offers[].currentVersionUrl' | wget -x --base="https://pricing.us-east-1.amazonaws.com" --no-host-directories --cut-dirs=3 -i -
CSV
wget -q -O - https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json | jq -r '.offers[].currentVersionUrl' | sed 's/\.json$/.csv/' | wget -x --base="https://pricing.us-east-1.amazonaws.com" --no-host-directories --cut-dirs=3 -i -