Class: AWSPricing::EC2
- Inherits:
-
Object
- Object
- AWSPricing::EC2
- Defined in:
- lib/aws-pricing/products/ec2.rb
Constant Summary collapse
- EC2_BASE_URL =
'/ec2/pricing/pricing-'
- EC2_RESERVED_BASE_URL =
'/ec2/pricing/'
Class Method Summary collapse
-
.cloud_watch ⇒ Object
Returns Hash of Cloudwatch monitoring pricing information.
-
.data_transfer ⇒ Object
Returns Hash of data transfer pricing information.
-
.ebs ⇒ Object
Returns Hash of elastic block storage pricing information.
-
.elastic_ips ⇒ Object
Returns Hash of elastic IP pricing information.
-
.elb ⇒ Object
Returns Hash of elastic loadbalancer pricing information.
-
.instances ⇒ Object
Returns Hash of on-demand server instance pricing information.
-
.reserved_instances(options = {}) ⇒ Object
Returns Hash of reserved server instance pricing information.
-
.spot_instances ⇒ Object
Returns Hash of current spot instance pricing information (5m).
Class Method Details
.cloud_watch ⇒ Object
Returns Hash of Cloudwatch monitoring pricing information
49 50 51 |
# File 'lib/aws-pricing/products/ec2.rb', line 49 def self.cloud_watch Base.get(EC2_BASE_URL + 'cloudwatch') end |
.data_transfer ⇒ Object
Returns Hash of data transfer pricing information
39 40 41 |
# File 'lib/aws-pricing/products/ec2.rb', line 39 def self.data_transfer Base.get(EC2_BASE_URL + 'data-transfer') end |
.ebs ⇒ Object
Returns Hash of elastic block storage pricing information
34 35 36 |
# File 'lib/aws-pricing/products/ec2.rb', line 34 def self.ebs Base.get(EC2_BASE_URL + 'ebs') end |
.elastic_ips ⇒ Object
Returns Hash of elastic IP pricing information
44 45 46 |
# File 'lib/aws-pricing/products/ec2.rb', line 44 def self.elastic_ips Base.get(EC2_BASE_URL + 'elastic-ips') end |
.elb ⇒ Object
Returns Hash of elastic loadbalancer pricing information
54 55 56 |
# File 'lib/aws-pricing/products/ec2.rb', line 54 def self.elb Base.get(EC2_BASE_URL + 'elb') end |
.instances ⇒ Object
Returns Hash of on-demand server instance pricing information
11 12 13 |
# File 'lib/aws-pricing/products/ec2.rb', line 11 def self.instances Base.get(EC2_BASE_URL + 'on-demand-instances') end |
.reserved_instances(options = {}) ⇒ Object
Returns Hash of reserved server instance pricing information
16 17 18 19 20 21 22 23 |
# File 'lib/aws-pricing/products/ec2.rb', line 16 def self.reserved_instances( = {}) opts = { :os => 'linux', :utilization => 'heavy' }.merge() raise "AWSPricing: Invalid OS" unless /^linux|mswin+$/ =~ opts[:os].to_s raise "AWSPricing: Invalid Utilization" unless /^light|medium|heavy$/ =~ opts[:utilization].to_s Base.get(EC2_RESERVED_BASE_URL + "ri-#{opts[:utilization]}-#{opts[:os]}") end |
.spot_instances ⇒ Object
Returns Hash of current spot instance pricing information (5m)
26 27 28 29 30 31 |
# File 'lib/aws-pricing/products/ec2.rb', line 26 def self.spot_instances callback_response = Net::HTTP.get_response(URI.parse 'http://spot-price.s3.amazonaws.com/spot.js').body callback_response.gsub!('callback(','') callback_response.slice!(callback_response.length-1) JSON.parse callback_response end |