amazon-pricing 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -2
- data/lib/amazon-pricing.rb +13 -12
- data/lib/amazon-pricing/instance-type.rb +8 -0
- data/lib/amazon-pricing/version.rb +1 -1
- data/test/ec2_instance_types_test.rb +3 -3
- metadata +26 -21
data/Gemfile.lock
CHANGED
data/lib/amazon-pricing.rb
CHANGED
@@ -74,8 +74,9 @@ module AwsPricing
|
|
74
74
|
region
|
75
75
|
end
|
76
76
|
|
77
|
-
EC2_BASE_URL = "http://
|
78
|
-
|
77
|
+
EC2_BASE_URL = "http://a0.awsstatic.com/pricing/1/ec2/"
|
78
|
+
EBS_BASE_URL = "http://a0.awsstatic.com/pricing/1/ebs/"
|
79
|
+
RDS_BASE_URL = "http://a0.awsstatic.com/pricing/1/rds/"
|
79
80
|
|
80
81
|
# Lookup allows us to map to AWS API region names
|
81
82
|
@@Region_Lookup = {
|
@@ -109,14 +110,14 @@ module AwsPricing
|
|
109
110
|
|
110
111
|
def get_ec2_on_demand_instance_pricing
|
111
112
|
@@OS_TYPES.each do |os|
|
112
|
-
fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-od.js", :ondemand, os)
|
113
|
+
fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-od.min.js", :ondemand, os)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
116
117
|
def get_ec2_reserved_instance_pricing
|
117
118
|
@@OS_TYPES.each do |os|
|
118
119
|
@@RES_TYPES.each do |res_type|
|
119
|
-
fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-ri-#{res_type}.js", res_type, os)
|
120
|
+
fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-ri-#{res_type}.min.js", res_type, os)
|
120
121
|
end
|
121
122
|
end
|
122
123
|
end
|
@@ -148,7 +149,7 @@ module AwsPricing
|
|
148
149
|
end
|
149
150
|
|
150
151
|
def fetch_ec2_ebs_pricing
|
151
|
-
res = PriceList.fetch_url(
|
152
|
+
res = PriceList.fetch_url(EBS_BASE_URL + "pricing-ebs.min.js")
|
152
153
|
res["config"]["regions"].each do |ebs_types|
|
153
154
|
region = get_region(ebs_types["region"])
|
154
155
|
region.ebs_price = EbsPrice.new(region, ebs_types)
|
@@ -204,9 +205,9 @@ module AwsPricing
|
|
204
205
|
is_byol = is_byol? dp_type
|
205
206
|
|
206
207
|
if [:mysql, :postgresql, :oracle].include? db
|
207
|
-
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{dp_type}-deployments.js",:ondemand, db_type, is_byol)
|
208
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{dp_type}-deployments.min.js",:ondemand, db_type, is_byol)
|
208
209
|
elsif db == :sqlserver
|
209
|
-
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-ondemand.js",:ondemand, db_type, is_byol)
|
210
|
+
fetch_on_demand_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-ondemand.min.js",:ondemand, db_type, is_byol)
|
210
211
|
end
|
211
212
|
end
|
212
213
|
}
|
@@ -218,9 +219,9 @@ module AwsPricing
|
|
218
219
|
if [:mysql, :postgresql].include? db
|
219
220
|
@@RES_TYPES.each do |res_type|
|
220
221
|
if db == :postgresql and res_type == :heavy
|
221
|
-
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{res_type}-utilization-reserved-instances.js", res_type, db, false)
|
222
|
+
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{res_type}-utilization-reserved-instances.min.js", res_type, db, false)
|
222
223
|
elsif db == :mysql
|
223
|
-
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{res_type}-utilization-reserved-instances.js", res_type, db, false)
|
224
|
+
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{res_type}-utilization-reserved-instances.min.js", res_type, db, false)
|
224
225
|
end
|
225
226
|
end
|
226
227
|
else
|
@@ -229,9 +230,9 @@ module AwsPricing
|
|
229
230
|
db_instance.each do |dp_type|
|
230
231
|
is_byol = is_byol? dp_type
|
231
232
|
if db == :oracle
|
232
|
-
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{dp_type}-#{res_type}-utilization-reserved-instances.js", res_type, db_type, is_byol)
|
233
|
+
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/pricing-#{dp_type}-#{res_type}-utilization-reserved-instances.min.js", res_type, db_type, is_byol)
|
233
234
|
elsif db == :sqlserver
|
234
|
-
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-#{res_type}-ri.js", res_type, db_type, is_byol)
|
235
|
+
fetch_reserved_rds_instance_pricing(RDS_BASE_URL+"#{db}/sqlserver-#{dp_type}-#{res_type}-ri.min.js", res_type, db_type, is_byol)
|
235
236
|
end
|
236
237
|
end
|
237
238
|
end
|
@@ -250,7 +251,7 @@ module AwsPricing
|
|
250
251
|
begin
|
251
252
|
#
|
252
253
|
# this is special case URL, it is oracle - multiAZ type of deployment but it doesn't have mutliAZ attributes in json.
|
253
|
-
if url == "http://aws.amazon.com/rds/pricing/oracle/pricing-li-multiAZ-deployments.js"
|
254
|
+
if url == "http://aws.amazon.com/rds/pricing/oracle/pricing-li-multiAZ-deployments.min.js"
|
254
255
|
is_multi_az = true
|
255
256
|
else
|
256
257
|
is_multi_az = is_multi_az? type["name"]
|
@@ -171,6 +171,8 @@ module AwsPricing
|
|
171
171
|
'g2.2xlarge' => 'Cluster GPU Double Extra Large',
|
172
172
|
'c3.large' => 'High-Compute Large', 'c3.xlarge' => 'High-Compute Extra Large', 'c3.2xlarge' => 'High-Compute Double Extra Large', 'c3.4xlarge' => 'High-Compute Quadruple Extra Large', 'c3.8xlarge' => 'High-Compute Eight Extra Large',
|
173
173
|
'i2.xlarge' => 'High I/O Extra Large', 'i2.2xlarge' => 'High I/O Double Extra Large', 'i2.4xlarge' => 'High I/O Quadruple Extra Large', 'i2.8xlarge' => 'High I/O Eight Extra Large',
|
174
|
+
# Remove asterisk when this is released instance type
|
175
|
+
#'r3.large *' => 'Memory Optimized Large', 'r3.xlarge *' => 'Memory Optimized Extra Large', 'r3.2xlarge *' => 'Memory Optimized Double Extra Large', 'r3.4xlarge *' => 'Memory Optimized Quadruple Extra Large', 'r3.8xlarge *' => 'Memory Optimized Eight Extra Large',
|
174
176
|
}
|
175
177
|
@@Disk_Lookup = {
|
176
178
|
'm1.small' => 160, 'm1.medium' => 410, 'm1.large' =>850, 'm1.xlarge' => 1690,
|
@@ -189,6 +191,8 @@ module AwsPricing
|
|
189
191
|
'db.t1.micro' => 160,
|
190
192
|
'c3.large' => 32, 'c3.xlarge' => 80, 'c3.2xlarge' => 160, 'c3.4xlarge' => 320, 'c3.8xlarge' => 640,
|
191
193
|
'i2.large' => 360, 'i2.xlarge' => 720, 'i2.2xlarge' => 1440, 'i2.4xlarge' => 2880, 'i2.8xlarge' => 5760,
|
194
|
+
# Remove asterisk when this is released instance type
|
195
|
+
#'r3.large *' => 0, 'r3.xlarge *' => 0, 'r3.2xlarge *' => 0, 'r3.4xlarge *' => 0, 'r3.8xlarge *' => 0,
|
192
196
|
}
|
193
197
|
@@Platform_Lookup = {
|
194
198
|
'm1.small' => 32, 'm1.medium' => 32, 'm1.large' => 64, 'm1.xlarge' => 64,
|
@@ -207,6 +211,8 @@ module AwsPricing
|
|
207
211
|
'db.t1.micro' => 64,
|
208
212
|
'c3.large' => 64, 'c3.xlarge' => 64, 'c3.2xlarge' => 64, 'c3.4xlarge' => 64, 'c3.8xlarge' => 64,
|
209
213
|
'i2.large' => 64, 'i2.xlarge' => 64, 'i2.2xlarge' => 64, 'i2.4xlarge' => 64, 'i2.8xlarge' => 64,
|
214
|
+
# Remove asterisk when this is released instance type
|
215
|
+
#'r3.large *' => 64, 'r3.xlarge *' => 64, 'r3.2xlarge *' => 64, 'r3.4xlarge *' => 64, 'r3.8xlarge *' => 64,
|
210
216
|
}
|
211
217
|
@@Disk_Type_Lookup = {
|
212
218
|
'm1.small' => :ephemeral, 'm1.medium' => :ephemeral, 'm1.large' => :ephemeral, 'm1.xlarge' => :ephemeral,
|
@@ -226,6 +232,8 @@ module AwsPricing
|
|
226
232
|
'db.t1.micro' => :ebs,
|
227
233
|
'c3.large' => :ssd, 'c3.xlarge' => :ssd, 'c3.2xlarge' => :ssd, 'c3.4xlarge' => :ssd, 'c3.8xlarge' => :ssd,
|
228
234
|
'i2.large' => :ssd, 'i2.xlarge' => :ssd, 'i2.2xlarge' => :ssd, 'i2.4xlarge' => :ssd, 'i2.8xlarge' => :ssd,
|
235
|
+
# Remove asterisk when this is released instance type
|
236
|
+
#'r3.large *' => :ssd, 'r3.xlarge *' => :ssd, 'r3.2xlarge *' => :ssd, 'r3.4xlarge *' => :ssd, 'r3.8xlarge *' => :ssd,
|
229
237
|
}
|
230
238
|
|
231
239
|
# Due to fact AWS pricing API only reports these for EC2, we will fetch from EC2 and keep around for lookup
|
@@ -70,7 +70,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
70
70
|
region = @@ec2_pricing.get_region('us-east')
|
71
71
|
instance = region.get_ec2_instance_type('m1.large')
|
72
72
|
bem = instance.get_breakeven_month(:linux, :heavy, :year1)
|
73
|
-
assert bem ==
|
73
|
+
assert bem == 8
|
74
74
|
end
|
75
75
|
|
76
76
|
def test_memory
|
@@ -88,8 +88,8 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
88
88
|
|
89
89
|
def test_ebs
|
90
90
|
region = @@ec2_pricing.get_region('us-east')
|
91
|
-
assert region.ebs_price.standard_per_gb == 0.
|
92
|
-
assert region.ebs_price.standard_per_million_io == 0.
|
91
|
+
assert region.ebs_price.standard_per_gb == 0.05
|
92
|
+
assert region.ebs_price.standard_per_million_io == 0.05
|
93
93
|
assert region.ebs_price.preferred_per_gb == 0.125
|
94
94
|
assert region.ebs_price.preferred_per_iops == 0.10
|
95
95
|
assert region.ebs_price.s3_snaps_per_gb == 0.095
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.26
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joe Kinsella
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
15
15
|
email:
|
@@ -47,39 +47,44 @@ files:
|
|
47
47
|
homepage: http://github.com/CloudHealth/amazon-pricing
|
48
48
|
licenses:
|
49
49
|
- MIT
|
50
|
-
post_install_message:
|
50
|
+
post_install_message:
|
51
51
|
rdoc_options:
|
52
|
-
-
|
52
|
+
- --title
|
53
53
|
- amazon-pricing documentation
|
54
|
-
-
|
55
|
-
-
|
54
|
+
- --line-numbers
|
55
|
+
- --main
|
56
56
|
- README.md
|
57
57
|
require_paths:
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
60
61
|
requirements:
|
61
|
-
- -
|
62
|
+
- - ! '>='
|
62
63
|
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
63
65
|
segments:
|
64
66
|
- 0
|
65
|
-
|
66
|
-
MA==
|
67
|
-
hash: 2
|
68
|
-
none: false
|
67
|
+
hash: -1099421878339302140
|
69
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ! '>='
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
73
74
|
segments:
|
74
75
|
- 0
|
75
|
-
|
76
|
-
MA==
|
77
|
-
hash: 2
|
78
|
-
none: false
|
76
|
+
hash: -1099421878339302140
|
79
77
|
requirements: []
|
80
78
|
rubyforge_project: amazon-pricing
|
81
|
-
rubygems_version: 1.8.
|
82
|
-
signing_key:
|
79
|
+
rubygems_version: 1.8.25
|
80
|
+
signing_key:
|
83
81
|
specification_version: 3
|
84
82
|
summary: Amazon Web Services Pricing Ruby gem
|
85
|
-
test_files:
|
83
|
+
test_files:
|
84
|
+
- spec/instance_type_spec.rb
|
85
|
+
- spec/price_list_spec.rb
|
86
|
+
- spec/rds_pricing_spec.rb
|
87
|
+
- spec/spec_helper.rb
|
88
|
+
- spec/support/.gitignore
|
89
|
+
- test/ec2_instance_types_test.rb
|
90
|
+
- test/helper.rb
|