Skip to content

EC2 and pricing updates [v2]#649

Closed
pmhahn wants to merge 11 commits intoapache:trunkfrom
pmhahn:trunk
Closed

EC2 and pricing updates [v2]#649
pmhahn wants to merge 11 commits intoapache:trunkfrom
pmhahn:trunk

Conversation

@pmhahn
Copy link
Copy Markdown

@pmhahn pmhahn commented Dec 2, 2015

The EC2 Instance Type information contains some errors (especially the disk size for the m3 instances), conversion errors between GiB an M[i]B, disk count, ..
Also g2.8xlarge and t2.large are missing.

The values on <https://aws.amazon.com/ec2/instance-types/?nc1=f_ls> are
given in [GiB].

Let Python convert them to [MiB], as the current values are a mix of
[MB] and [MiB].
The values on <https://aws.amazon.com/ec2/instance-types/?nc1=f_ls> are
given in [GB].

Let Python calculate the size of multiple disks.

Remove wrong factor 1000 from m3 instances.
i2 are I/O optimized, while d2 are dense optimized
t2.micro is also a "Burstable Performance General Purpose" instance
type.
Add source URLs.
Add unit type for RAM and disk size.
Commit b7d851f added the pricing and instance info multiple times.
Comment thread contrib/scrape-ec2-prices.py Outdated
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed a trailing comma here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added and force-pushed

@jimbobhickville
Copy link
Copy Markdown

Wow, that must have been super tedious. I'm surprised Amazon doesn't provide an API for this information. It looked good to me apart from that missing comma, but I don't have a lot of context around AWS so someone else more familiar should probably review.

contrib/scrape-ec2-prices.py changes the ordering of data/pricing.json,
as it sorts the dictionary keys by string, which puts '10' before '2'.

Add a function to split the dictionary keys into the numeric, alphabetic
and other part and compare the first as integer, the middle by meaning,
and the later as string.
Please note that the scraper stores the price as string and does not
beautify the string to have exactly 3 digits in the radix part.
Remove duplicate description for NodeState.STOPPED added by
commit b09c1be
@pmhahn
Copy link
Copy Markdown
Author

pmhahn commented Dec 2, 2015

I only slightly improved the sorting of EC2 scraper written mainly by Tomaz Muraus, which basically used the data from https://a0.awsstatic.com/pricing/1/ec2/linux-od.min.js. That could also be used to fill in the data in <libcloud/compute/drivers/ec2.py>, but that's for another day.
But yes, finding those mistakes of mixing 1000 and 1024 was some work ;-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmhahn Why has outscale been completely removed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonybaloney No it hasn't been removed conmpletely, only the duplicate entries: it's a JSON dictionary, where the key is unique and only the last(?) entry wins:
Warning: the following script will create the files [1-8].py in your current directory!

curl -s https://raw.githubusercontent.com/apache/libcloud/trunk/libcloud/compute/drivers/ec2.py | sed -ne '
1567,1593w 1.py
1594,1620w 2.py
1621,1647w 3.py
1648,1674w 4.py

1729,1755w 5.py
1756,1782w 6.py
1783,1809w 7.py
1810,1836w 8.py
'
diff 1.py 2.py ; diff 2.py 3.py ; diff 3.py 4.py
diff 5.py 6.py ; diff 6.py 7.py ; diff 7.py 8.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, eu-west-2 exists up above in the elided part of the diff, line 1293.

@tonybaloney
Copy link
Copy Markdown
Contributor

@pmhahn that basically undoes #645 I think you made an error in merging (resyncing from trunk).

@Kami
Copy link
Copy Markdown
Member

Kami commented Dec 3, 2015

Yeah, there is contrib/scrape-ec2-prices.py, but it's possible that it's not working anymore since some of those .js files have been deprecated for a while now 😞

@pmhahn
Copy link
Copy Markdown
Author

pmhahn commented Dec 3, 2015

@tonybaloney: My reading is, that #645 is wrong, since OUTSCALE_(SAS|INC)_REGION_DETAILS is a dictionary and the keys "eu-west-2", "us-east-2" are used multiple times:

$ curl -s https://raw.githubusercontent.com/apache/libcloud/trunk/libcloud/data/pricing.json | sed -rne '/^ {8}"/p' | sort | uniq -d
        "osc_inc_eu_west_2": {
        "osc_inc_us_east_2": {
        "osc_sas_eu_west_2": {
        "osc_sas_us_east_2": {
$ curl -s https://raw.githubusercontent.com/apache/libcloud/trunk/libcloud/compute/drivers/ec2.py | sed -rne "/^OUTSCALE_SAS_REGION_DETAILS/,/^}/{/^ {4}'/p}" | sort | uniq -d
    'eu-west-2': {
    'us-east-2': {
$ curl -s https://raw.githubusercontent.com/apache/libcloud/trunk/libcloud/compute/drivers/ec2.py | sed -rne "/^OUTSCALE_INC_REGION_DETAILS/,/^}/{/^ {4}'/p}" | sort | uniq -d
    'eu-west-2': {
    'us-east-2': {

@Kami: You wan't me not not update the EC2 pricing? At least adding the prices for g2.8xlarge and t2.large is required to not break the unit test.

@tonybaloney
Copy link
Copy Markdown
Contributor

@pmhahn yep good point, i see the mistake now.

@Kami
Copy link
Copy Markdown
Member

Kami commented Dec 4, 2015

LGTM

@tonybaloney
Copy link
Copy Markdown
Contributor

Ok @pmhahn I'll close and merge this. FYI @LordShion see above.

@asfgit asfgit closed this in 2f51455 Dec 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants