猿问

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

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


杨__羊羊
浏览 195回答 1
1回答
随时随地看视频慕课网APP

相关分类

Python
我要回答