I am using boto3 pricing client to get on-demand pricing as boto3 ec2 client doesn't have on-demand but spot pricing.
This gives me error saying Could not connect to the endpoint URL: "https://api.pricing.us-west-2.amazonaws.com/
.
What is the correct region name or location value below for us west 2. I check ed the regions and this is the correct one. Does pricing api isn't in Oregon region?
pricing = boto3.client('pricing', region_name='us-west-2')
response = pricing.get_products(
ServiceCode='AmazonEC2',
Filters=[
{'Type': 'TERM_MATCH', 'Field': 'operatingSystem', 'Value': 'Linux'},
{'Type':'TERM_MATCH', 'Field': 'location', 'Value': 'US West (Oregon)'}
],
MaxResults=20
)
for price in response['PriceList']:
resp = json.loads(price)
on_demand = resp['terms']['OnDemand']
print len(on_demand)
print(on_demand)
There are only two services endpoints supported by the AWS Price List Service API:
You will need to pick from one of those. us-west-2 is not supported.