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!
CodePudding user response:
Use method describe_services() with service code to get all available attributes.
Use method get_attribute_values() to get the list of all attribute values for a certain attribute.
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