AWS产品API:什么是我们West 2的正确区域位置和URL

Ati*_*ska 1 python amazon-ec2 ondemand amazon-product-api boto3

我正在使用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)
Run Code Online (Sandbox Code Playgroud)

Joh*_*ley 5

AWS Price List Service API仅支持两个服务终端节点:

您将需要从其中之一中进行选择。不支持us-west-2。