AWS Elasticache 价目表 REST api 适用于按需节点的 us-west-1 区域
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
...
我想要 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
...