awscosts 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +8 -0
- data/lib/awscosts.rb +1 -0
- data/lib/awscosts/emr.rb +65 -0
- data/lib/awscosts/region.rb +3 -0
- data/lib/awscosts/version.rb +1 -1
- metadata +4 -3
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,13 @@ To find the price per GB processed of an ELB in the Sydney region.
|
|
51
51
|
|
52
52
|
AWSCosts.region('ap-southeast-2').ec2.elb.price_per_gb
|
53
53
|
|
54
|
+
### EMR
|
55
|
+
|
56
|
+
To find the on demand EC2 price and Elastic MapReduce price for the Oregon region.
|
57
|
+
|
58
|
+
AWSCosts.region('us-west-2').emr.ec2_price('cc2.8xlarge')
|
59
|
+
AWSCosts.region('us-west-2').emr.emr_price('cc2.8xlarge')
|
60
|
+
|
54
61
|
## Supported Services
|
55
62
|
|
56
63
|
The following AWS services are currently support (more to come):
|
@@ -60,6 +67,7 @@ The following AWS services are currently support (more to come):
|
|
60
67
|
* Reserved medium utilisation
|
61
68
|
* Reserved heavy utilisation
|
62
69
|
* Elastic Load Balancer (ELB)
|
70
|
+
* Elastic MapReduce (EMR)
|
63
71
|
|
64
72
|
EC2 platforms:
|
65
73
|
|
data/lib/awscosts.rb
CHANGED
data/lib/awscosts/emr.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class AWSCosts::EMR
|
5
|
+
|
6
|
+
TYPE_TRANSLATION = { 'stdODI.sm' => 'm1.small',
|
7
|
+
'stdODI.med' => 'm1.medium',
|
8
|
+
'stdODI.lg' => 'm1.large',
|
9
|
+
'stdODI.xl' => 'm1.xlarge',
|
10
|
+
'hiMemODI.xl' => 'm2.xlarge',
|
11
|
+
'hiMemODI.xxl' => 'm2.2xlarge',
|
12
|
+
'hiMemODI.xxxxl' => 'm2.4xlarge',
|
13
|
+
'hiCPUODI.med' => 'c1.medium',
|
14
|
+
'hiCPUODI.xl' => 'c1.xlarge',
|
15
|
+
'clusterComputeI.xxxxl' => 'cc1.4xlarge',
|
16
|
+
'clusterComputeI.xxxxxxxxl' => 'cc2.8xlarge',
|
17
|
+
'clusterGPUI.xxxxl' => 'cg1.4xlarge',
|
18
|
+
'hiStoreODI.xxxxxxxxl' => 'hs1.8xlarge',
|
19
|
+
'hiIOODI.xxxxl' => 'hi1.4xlarge' }
|
20
|
+
|
21
|
+
def initialize data
|
22
|
+
@data= data
|
23
|
+
end
|
24
|
+
|
25
|
+
def ec2_price size=nil
|
26
|
+
size ? @data['ec2'][size] : @data['ec2']
|
27
|
+
end
|
28
|
+
|
29
|
+
def emr_price size=nil
|
30
|
+
size ? @data['emr'][size] : @data['emr']
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.fetch region
|
34
|
+
@cache ||= begin
|
35
|
+
result = {}
|
36
|
+
data= JSON.parse(HTTParty.get("http://aws.amazon.com/elasticmapreduce/pricing/pricing-emr.json").body)
|
37
|
+
data['config']['regions'].each do |region|
|
38
|
+
platforms = {}
|
39
|
+
region['instanceTypes'].each do |instance_type|
|
40
|
+
type = instance_type['type']
|
41
|
+
instance_type['sizes'].each do |instance_size|
|
42
|
+
size = instance_size['size']
|
43
|
+
platform_cost = Hash.new({})
|
44
|
+
instance_size['valueColumns'].each do |value|
|
45
|
+
platform_cost[value['name']] = value['prices']['USD'].to_f
|
46
|
+
end
|
47
|
+
platform_cost.each_pair do |p,v|
|
48
|
+
platforms[p] = {} unless platforms.key?(p)
|
49
|
+
platforms[p][TYPE_TRANSLATION["#{type}.#{size}"]] = v
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
result[region['region']] = platforms
|
54
|
+
end
|
55
|
+
result
|
56
|
+
end
|
57
|
+
self.new(@cache[region])
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
def self.cache
|
62
|
+
@@cache ||= {}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/lib/awscosts/region.rb
CHANGED
data/lib/awscosts/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awscosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/awscosts/ec2_elb.rb
|
95
95
|
- lib/awscosts/ec2_on_demand.rb
|
96
96
|
- lib/awscosts/ec2_reserved_instances.rb
|
97
|
+
- lib/awscosts/emr.rb
|
97
98
|
- lib/awscosts/region.rb
|
98
99
|
- lib/awscosts/version.rb
|
99
100
|
- spec/awscosts/ec2_spec.rb
|
@@ -114,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
115
|
version: '0'
|
115
116
|
segments:
|
116
117
|
- 0
|
117
|
-
hash:
|
118
|
+
hash: 1325715737968826083
|
118
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
120
|
none: false
|
120
121
|
requirements:
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
version: '0'
|
124
125
|
segments:
|
125
126
|
- 0
|
126
|
-
hash:
|
127
|
+
hash: 1325715737968826083
|
127
128
|
requirements: []
|
128
129
|
rubyforge_project:
|
129
130
|
rubygems_version: 1.8.23
|