Class: AWSCosts::EMR
- Inherits:
-
Object
- Object
- AWSCosts::EMR
- Defined in:
- lib/awscosts/emr.rb
Constant Summary collapse
- TYPE_TRANSLATION =
{ 'stdODI.sm' => 'm1.small', 'stdODI.med' => 'm1.medium', 'stdODI.lg' => 'm1.large', 'stdODI.xl' => 'm1.xlarge', 'hiMemODI.xl' => 'm2.xlarge', 'hiMemODI.xxl' => 'm2.2xlarge', 'hiMemODI.xxxxl' => 'm2.4xlarge', 'hiCPUODI.med' => 'c1.medium', 'hiCPUODI.xl' => 'c1.xlarge', 'clusterComputeI.xxxxl' => 'cc1.4xlarge', 'clusterComputeI.xxxxxxxxl' => 'cc2.8xlarge', 'clusterGPUI.xxxxl' => 'cg1.4xlarge', 'hiStoreODI.xxxxxxxxl' => 'hs1.8xlarge', 'hiIOODI.xxxxl' => 'hi1.4xlarge' }
Class Method Summary collapse
Instance Method Summary collapse
- #ec2_price(size = nil) ⇒ Object
- #emr_price(size = nil) ⇒ Object
-
#initialize(data) ⇒ EMR
constructor
A new instance of EMR.
Constructor Details
#initialize(data) ⇒ EMR
Returns a new instance of EMR.
20 21 22 |
# File 'lib/awscosts/emr.rb', line 20 def initialize data @data= data end |
Class Method Details
.fetch(region) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/awscosts/emr.rb', line 32 def self.fetch region transformed= AWSCosts::Cache.get("/elasticmapreduce/pricing/pricing-emr.json") do |data| result = {} data['config']['regions'].each do |region| platforms = {} region['instanceTypes'].each do |instance_type| type = instance_type['type'] instance_type['sizes'].each do |instance_size| size = instance_size['size'] platform_cost = Hash.new({}) instance_size['valueColumns'].each do |value| platform_cost[value['name']] = value['prices']['USD'].to_f end platform_cost.each_pair do |p,v| platforms[p] = {} unless platforms.key?(p) platforms[p][size] = v end end end result[region['region']] = platforms end result end self.new(transformed[region]) end |
Instance Method Details
#ec2_price(size = nil) ⇒ Object
24 25 26 |
# File 'lib/awscosts/emr.rb', line 24 def ec2_price size=nil size ? @data['ec2'][size] : @data['ec2'] end |
#emr_price(size = nil) ⇒ Object
28 29 30 |
# File 'lib/awscosts/emr.rb', line 28 def emr_price size=nil size ? @data['emr'][size] : @data['emr'] end |