![](/img/trans.png)
[英]Credential should be scoped to a valid region, not 'us-west-1' using AWS SES
[英]AWS Elasticache price list REST api for us-west-1 region of On-Demand nodes
我想要 JSON 或 CSV 格式的成本信息節點類型和每小時價格。 AWS 是否已將此信息作為 REST 端點提供?。
或者我是否必須抓取以下網頁才能獲取所需信息?。
當然有一個 API(它是 AWS,幾乎總是有一個 API)。 以下是按地區獲取定價的方法。
import requests
url = "https://b0.p.awsstatic.com/pricing/2.0/meteredUnitMaps/elasticache/USD/current/elasticache.json?timestamp=1598870451424"
r = requests.get(url).json()
for region in r["regions"].values():
for k, v in region.items():
print(k)
print(f"{v['Instance Type']} - {v['price']}")
這產生:
OnDemand Cache Instance Standard cache m3.2xlarge Memcached Previous Generation
cache.m3.2xlarge - 0.8550000000
OnDemand Cache Instance Standard cache m3.2xlarge Redis Previous Generation
cache.m3.2xlarge - 0.8550000000
OnDemand Cache Instance Standard cache m3.large Memcached Previous Generation
cache.m3.large - 0.2180000000
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.