[英]aws product api: what is the correct regional location and url for us west 2
I am using boto3 pricing client to get on-demand pricing as boto3 ec2 client doesn't have on-demand but spot pricing. 我正在使用boto3定价客户端来获得按需定价,因为boto3 ec2客户端没有按需定价,而是现货定价。
This gives me error saying Could not connect to the endpoint URL: "https://api.pricing.us-west-2.amazonaws.com/
. 这给了我一个错误,提示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. 以下是我们西2的正确区域名称或位置值是多少。我检查了这些区域,这是正确的区域。 Does pricing api isn't in Oregon region? 定价API是否不在俄勒冈州地区?
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: AWS Price List Service API仅支持两个服务终端节点:
You will need to pick from one of those. 您将需要从其中之一中进行选择。 us-west-2 is not supported. 不支持us-west-2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.