alanwsmith.com ~ links ~ podcast

AWS Price List API Serivces, Attributes, and Attribute Values

This is a dump of the services, attributes, and attribute values available from the AWS Price List API's DescribeServices and GetAttributeValues functions. Pulling those are the first two steps in order to get data from the GetProducts function where the actual pricing details reside.

I'm posting this becuase it's silly for everyone to spend time doing the same thing. (I'm also including a usage example below that shows how to use how to use the data)

Update Frequency

This page was generated on Sept. 29, 2022. If you need a more recent set of the data you can pull the scripts from the repo.

The Data

Usage

This example shows how to use the data to start getting details on EC2 instances. (Getting the actual prices for is a little complicated. I'm working on post with the specifics for that)

#!/usr/bin/env python3

import boto3
import json

client = boto3.client('pricing')
paginator = client.get_paginator('get_products')

response_iterator = paginator.paginate(
    ServiceCode='AmazonEC2',
    Filters=[
        {
            'Type':  'TERM_MATCH',
            'Field': 'regionCode',
            'Value': 'us-east-1'
        },
        {
            'Type':  'TERM_MATCH',
            'Field': 'operatingSystem',
            'Value': 'Linux'
        }
    ],
    FormatVersion='aws_v1',
    PaginationConfig={
        'MaxItems': 5,
    },
)

for page in response_iterator:
    for price_data_string in page['PriceList']:
        price_data = json.loads(price_data_string)
        print(price_data['product']['attributes']['instanceType'])
      

Notes

References