【问题标题】:aws product api: what is the correct regional location and url for us west 2aws 产品 api:美国西部 2 的正确区域位置和网址是什么
【发布时间】:2019-01-02 20:40:50
【问题描述】:

我正在使用 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)

【问题讨论】:

    标签: python amazon-ec2 boto3 amazon-product-api ondemand


    【解决方案1】:

    AWS 价目表服务 API 仅支持两个服务端点:

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-21
    • 1970-01-01
    • 1970-01-01
    • 2015-07-24
    • 1970-01-01
    • 2022-01-19
    • 2013-09-13
    • 2017-03-30
    相关资源
    最近更新 更多