Sunday, 14 April 2019

AWS & Azure pricing data

Here is a simple hack to produce spreadsheet of AWS costs. such as EC2 pricing spreadsheet:
$ for i in `wget -q -O- https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json |  jq -r '.offers[] ' | egrep 'EC2|RDS|ElastiCache|S3|DynamoDB' | grep current | cut -d'"' -f4 | sed '1,$s/json/csv/g'`
do
     echo wget https://pricing.us-east-1.amazonaws.com$i
done

wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/region_index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/region_index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonElastiCache/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonElastiCache/current/region_index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonDynamoDB/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonDynamoDB/current/region_index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonS3GlacierDeepArchive/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonS3GlacierDeepArchive/current/region_index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonS3/current/index.csv
wget https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonS3/current/region_index.csv

$ cat ec2.csv | grep -i "on demand" |  grep -vi dedicated | cut -d',' -f10,19,17,20,38,22,25 | sed '1,$s/ GiB//' | sed '1,$s/"//g' > ec2

$ head ec2
"PricePerUnit","Location","Instance Type","Current Generation","vCPU","Memory","Operating System"
0.3680000000,US West (N. California),m3.xlarge,No,4,15,RHEL
3.6640000000,Asia Pacific (Mumbai),c5d.18xlarge,Yes,72,144,SUSE
1.1320000000,Asia Pacific (Osaka-Local),m4.4xlarge,Yes,16,64,SUSE
2.8320000000,Asia Pacific (Seoul),m5.12xlarge,Yes,48,192,Linux
1.3920000000,Asia Pacific (Sydney),r5d.4xlarge,Yes,16,128,Linux
0.2196000000,AWS GovCloud (US),r4.large,Yes,2,15.25,RHEL
0.2110000000,EU (London),m5.large,Yes,2,8,SUSE
0.2048000000,Canada (Central),t2.xlarge,Yes,4,16,Linux
0.0158000000,US East (Ohio),t2.nano,Yes,1,0.5,SUSE
0.0230000000,US East (N. Virginia),t2.small,Yes,1,2,Linux
Please note above spreadsheet also includes Azure costs (using screen scraping).

No comments:

Post a Comment