我正在使用boto3定价客户端来获取按需定价,因为boto3 ec2客户端没有按需定价,而是现货定价。
这给了我错误的说法Could not connect to the endpoint URL: "https://api.pricing.us-west-2.amazonaws.com/。
以下是我们西2的正确区域名称或位置值是多少。我检查了这些区域,这是正确的区域。定价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)
相关分类