Class: Awsprice::EC2

Inherits:
Info
  • Object
show all
Defined in:
lib/awsprice.rb

Constant Summary collapse

EC2_BASE_URL =

attr_accessor :all_instances, :ondemand_instances

"http://a0.awsstatic.com/pricing/1/ec2/"
@@OS_TYPES =
[:linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb]
@@RES_TYPES =
[:medium, :heavy]

Instance Method Summary collapse

Methods inherited from Info

fetch_url

Constructor Details

#initializeEC2

Returns a new instance of EC2.



57
58
59
60
61
62
63
64
65
# File 'lib/awsprice.rb', line 57

def initialize
  @ec2_spec =  {}
  @ec2_ondemand_price = []
  @ec2_medium_reserved_price = []
  @ec2_heavy_reserved_price = []
  # unless File.exist? "awsprice.pstore"
  crawl
  # end
end

Instance Method Details

#get_price_ondemandObject



81
82
83
84
85
86
# File 'lib/awsprice.rb', line 81

def get_price_ondemand
  @ec2_ondemand_price
  # @ec2_ondemand_price.each do |price|
  #   puts "#{price.region} #{price.size} #{price.os} #{price.price_per_hour}"
  # end
end

#get_price_reserved_heavyObject



74
75
76
77
78
79
# File 'lib/awsprice.rb', line 74

def get_price_reserved_heavy
  @ec2_heavy_reserved_price
  # @ec2_heavy_reserved_price.each do |price|
  #   puts "#{price.region} #{price.size} #{price.os} #{price.yrTerm1} #{price.yrTerm1Hourly}, #{price.yrTerm3}, #{price.yrTerm3Hourly}"
  # end
end

#get_price_reserved_mediumObject



67
68
69
70
71
72
# File 'lib/awsprice.rb', line 67

def get_price_reserved_medium
  @ec2_medium_reserved_price
  # @ec2_medium_reserved_price.each do |price|
  #   puts "#{price.region} #{price.size} #{price.os} #{price.yrTerm1} #{price.yrTerm1Hourly}, #{price.yrTerm3}, #{price.yrTerm3Hourly}"
  # end
end

#get_specObject



88
89
90
91
92
93
# File 'lib/awsprice.rb', line 88

def get_spec
  @ec2_spec.values
  # @ec2_spec.each do |key, ins|
  #   puts "#{ins.size} #{ins.type} #{ins.memory}, #{ins.ecu}, #{ins.vcpu}, #{ins.storage}"
  # end
end