vantage-sh / ec2instances.info

Amazon EC2 instance comparison site
https://ec2instances.info
MIT License
5.15k stars 583 forks source link

Can you add pricing from China? #330

Open opswm opened 6 years ago

opswm commented 6 years ago

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

opswm commented 5 years ago

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

cristim commented 5 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

PatMyron commented 5 years ago

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

tomcook commented 5 years ago

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

cristim commented 5 years ago

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

PatMyron commented 5 years ago

@cristim still seeing "unavailable" in the price cells when I test that

Anyone have any ideas why?

PatMyron commented 5 years ago

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

blckct commented 5 years ago

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

cristim commented 5 years ago

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.

difanz commented 5 years ago

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 commented 5 years ago

@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"
    }
  }
cristim commented 5 years ago

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

PatMyron commented 5 years ago

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

cristim commented 5 years ago

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

blckct commented 5 years ago

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.