Open opswm opened 6 years ago
希望关注这个问题,谢谢。
The data should be easy to add, but it's not currently available at https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/$REGION>/index.json
Please raise this with AWS and once we have the data available there for the Chinese regions as well we can easily add support for it
similar to https://github.com/powdahound/ec2instances.info/pull/395 once AWS makes that data available. Drafted a pull request: https://github.com/vantage-sh/ec2instances.info/pull/403
@PatMyron The data is available now 🎉 https://aws.amazon.com/about-aws/whats-new/2018/12/announcing-aws-price-list-api-availability-in-china/
@PatMyron, @ChampionWolf please try to update #403, test and report back the results.
@cristim still seeing "unavailable" in the price cells when I test that
Anyone have any ideas why?
found one China offer index file that existed but it seems like the corresponding file for a specific China region is unavailable:
https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/aws/AmazonEC2/current/index.json
https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/aws/AmazonEC2/current/cn-north-1/index.json
@PatMyron I think the Chinese pricing API is only available if you have AWS China account.
Perhaps someone with access to an account from China could process and publish this data as JSON somewhere so then we can merge this data at build time with the data from the rest of the world and display all the data on ec2instances.info.
Or maybe someone can create something like ec2instances.cn that just has the Chinese data.
Any suggestions or help to sort this out would be more than welcome.
FWIW it's available from https://amazonaws.cn/en/ec2/pricing/ec2-linux-pricing/, but yes it is quite awkward to parse and intake.
@PatMyron So according to https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/cn/AmazonEC2/current/region_index.json, the following index files should be used:
"regions" : {
"cn-north-1" : {
"regionCode" : "cn-north-1",
"currentVersionUrl" : "/offers/v1.0/cn/AmazonEC2/20190716030142/cn-north-1/index.json"
},
"cn-northwest-1" : {
"regionCode" : "cn-northwest-1",
"currentVersionUrl" : "/offers/v1.0/cn/AmazonEC2/20190716030142/cn-northwest-1/index.json"
}
}
@difanz please consider creating a patch that integrates these into the codebase.
Great find! Worry about outdated data if 20190716030142
is hardcoded
Replacing with current
reveals files:
https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/cn/AmazonEC2/current/cn-north-1/index.json
https://pricing.us-east-1.amazonaws.com/offers/v1.0/cn/AmazonEC2/current/cn-north-1/index.json
https://pricing.us-east-1.amazonaws.com/offers/v1.0/cn/AmazonEC2/current/cn-northwest-1/index.json
https://pricing.us-east-1.amazonaws.com/offers/v1.0/cn/AmazonRDS/current/index.json
@PatMyron I guess we won't hardcode that but fetch the current index from https://pricing.us-east-1.amazonaws.com/offers/v1.0/cn/AmazonEC2/current/region_index.json and generate the versioned URLs from its content. Or perhaps the pricing API may just do this under the hood (hopefully) without any work from our side.
China's aws users are also very large, I believe it will be very valuable.