简体   繁体   中英

Available filter for AWS boto3 Pricing API - get_products

I'm trying to get the pricing for different EC2 instances. I have to specify different filters to get the most accurate price. For example,

import boto3 

client = boto3.client('pricing')

response = client.get_products(
    ServiceCode='string',
    Filters=[
        {
            'Type': 'TERM_MATCH',
            'Field': 'string',
            'Value': 'string'
        },
    ],
    FormatVersion='string',
    NextToken='string',
    MaxResults=123
)

I would like to know all the available fields and values for EC2 instances. I've not been able to find anything on this so any help will be appreciated.

Thank you all!

Use method describe_services() with service code to get all available attributes.

Use method get_attribute_values() to get list of attribute values

More information from the same API documentation where get_products() was described: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pricing.html#pricing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM