ec2instances.info icon indicating copy to clipboard operation
ec2instances.info copied to clipboard

Can you add pricing from China?

Open opswm opened this issue 6 years ago • 15 comments

China's aws users are also very large, I believe it will be very valuable.

opswm avatar Mar 26 '18 03:03 opswm

希望关注这个问题,谢谢。

opswm avatar Dec 06 '18 08:12 opswm

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

cristim avatar Dec 06 '18 09:12 cristim

Should be very similar to https://github.com/powdahound/ec2instances.info/pull/395 once AWS makes that data available. I can prepare a pull request in advance

PatMyron avatar Dec 10 '18 18:12 PatMyron

@PatMyron The data is available now 🎉 https://aws.amazon.com/about-aws/whats-new/2018/12/announcing-aws-price-list-api-availability-in-china/

tomcook avatar Dec 18 '18 17:12 tomcook

@PatMyron, @ChampionWolf please try to update #403, test and report back the results.

cristim avatar Dec 25 '18 01:12 cristim

@cristim Good call, still seeing "unavailable" in the price cells when I test that pull request.

Anyone have any ideas why?

PatMyron avatar Dec 25 '18 02:12 PatMyron

From poking around, I found one China offer index file that existed but it seems like the corresponding file for a specific China region is not available:

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 avatar Dec 25 '18 02:12 PatMyron

@PatMyron I think the Chinese pricing API is only available if you have AWS China account.

blckct avatar Jan 28 '19 00:01 blckct

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.

cristim avatar Mar 28 '19 12:03 cristim

FWIW it's available from https://amazonaws.cn/en/ec2/pricing/ec2-linux-pricing/, but yes it is quite awkward to parse and intake.

difanz avatar Jun 21 '19 19:06 difanz

@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 avatar Aug 06 '19 09:08 difanz

@difanz please consider creating a patch that integrates these into the codebase.

cristim avatar Aug 06 '19 11:08 cristim

Great find! I worry about outdated data if 20190716030142 is hardcoded

Replacing with current reveals some files:

https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/cn/AmazonEC2/current/cn-north-1/index.json

https://pricing.cn-north-1.amazonaws.com.cn/offers/v1.0/cn/AmazonEC2/current/cn-northwest-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 avatar Aug 06 '19 15:08 PatMyron

@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.

cristim avatar Aug 06 '19 19:08 cristim

I don't think Pricing API can do this. rds.py parses through a very similar file so it might be a good idea to just extract the code from there. Also #367 might provide more context from the last time we discussed pricing data.

blckct avatar Aug 07 '19 00:08 blckct