amazon-pricing 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/amazon-pricing.gemspec +1 -0
- data/lib/amazon-pricing/instance-type.rb +14 -5
- data/lib/amazon-pricing/operating-system.rb +6 -0
- data/lib/amazon-pricing/region.rb +1 -4
- data/lib/amazon-pricing/version.rb +1 -1
- data/test/test-ec2-instance-types.rb +15 -0
- metadata +19 -19
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -31,7 +31,7 @@ task :test do
|
|
31
31
|
ruby "test/test-ec2-instance-types.rb"
|
32
32
|
end
|
33
33
|
|
34
|
-
desc "Prints current EC2 pricing
|
34
|
+
desc "Prints current EC2 pricing in CSV format"
|
35
35
|
task :print_price_list do
|
36
36
|
require 'lib/amazon-pricing'
|
37
37
|
pricing = AwsPricing::PriceList.new
|
data/amazon-pricing.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://github.com/sonian/amazon-pricing"
|
12
12
|
s.summary = "Amazon Web Services Pricing Ruby gem"
|
13
13
|
s.description = "A Ruby library for retrieving pricing for Amazon Web Services"
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.rubyforge_project = "amazon-pricing"
|
16
17
|
|
@@ -46,6 +46,15 @@ module AwsPricing
|
|
46
46
|
@operating_systems[name]
|
47
47
|
end
|
48
48
|
|
49
|
+
# Returns whether an instance_type is available.
|
50
|
+
# operating_system = :linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb
|
51
|
+
# type_of_instance = :ondemand, :light, :medium, :heavy
|
52
|
+
def available?(type_of_instance = :ondemand, operating_system = :linux)
|
53
|
+
os = get_operating_system(operating_system)
|
54
|
+
return false if os.nil?
|
55
|
+
os.available?(type_of_instance)
|
56
|
+
end
|
57
|
+
|
49
58
|
# type_of_instance = :ondemand, :light, :medium, :heavy
|
50
59
|
# term = :year_1, :year_3, nil
|
51
60
|
def price_per_hour(operating_system, type_of_instance, term = nil)
|
@@ -190,7 +199,7 @@ module AwsPricing
|
|
190
199
|
@@Memory_Lookup = {
|
191
200
|
'm1.small' => 1700, 'm1.medium' => 3750, 'm1.large' => 7500, 'm1.xlarge' => 15000,
|
192
201
|
'm2.xlarge' => 17100, 'm2.2xlarge' => 34200, 'm2.4xlarge' => 68400,
|
193
|
-
|
202
|
+
'm3.xlarge' => 15000, 'm3.2xlarge' => 30000,
|
194
203
|
'c1.medium' => 1700, 'c1.xlarge' => 7000,
|
195
204
|
'hi1.4xlarge' => 60500,
|
196
205
|
'cg1.4xlarge' => 22000,
|
@@ -203,7 +212,7 @@ module AwsPricing
|
|
203
212
|
@@Disk_Lookup = {
|
204
213
|
'm1.small' => 160, 'm1.medium' => 410, 'm1.large' =>850, 'm1.xlarge' => 1690,
|
205
214
|
'm2.xlarge' => 420, 'm2.2xlarge' => 850, 'm2.4xlarge' => 1690,
|
206
|
-
|
215
|
+
'm3.xlarge' => 0, 'm3.2xlarge' => 0,
|
207
216
|
'c1.medium' => 350, 'c1.xlarge' => 1690,
|
208
217
|
'hi1.4xlarge' => 2048,
|
209
218
|
'cg1.4xlarge' => 1690,
|
@@ -216,7 +225,7 @@ module AwsPricing
|
|
216
225
|
@@Platform_Lookup = {
|
217
226
|
'm1.small' => 32, 'm1.medium' => 32, 'm1.large' => 64, 'm1.xlarge' => 64,
|
218
227
|
'm2.xlarge' => 64, 'm2.2xlarge' => 64, 'm2.4xlarge' => 64,
|
219
|
-
|
228
|
+
'm3.xlarge' => 64, 'm3.2xlarge' => 64,
|
220
229
|
'c1.medium' => 32, 'c1.xlarge' => 64,
|
221
230
|
'hi1.4xlarge' => 64,
|
222
231
|
'cg1.4xlarge' => 64,
|
@@ -229,7 +238,7 @@ module AwsPricing
|
|
229
238
|
@@Compute_Units_Lookup = {
|
230
239
|
'm1.small' => 1, 'm1.medium' => 2, 'm1.large' => 4, 'm1.xlarge' => 8,
|
231
240
|
'm2.xlarge' => 6, 'm2.2xlarge' => 13, 'm2.4xlarge' => 26,
|
232
|
-
|
241
|
+
'm3.xlarge' => 13, 'm3.2xlarge' => 26,
|
233
242
|
'c1.medium' => 5, 'c1.xlarge' => 20,
|
234
243
|
'hi1.4xlarge' => 35,
|
235
244
|
'cg1.4xlarge' => 34,
|
@@ -242,7 +251,7 @@ module AwsPricing
|
|
242
251
|
@@Virtual_Cores_Lookup = {
|
243
252
|
'm1.small' => 1, 'm1.medium' => 1, 'm1.large' => 2, 'm1.xlarge' => 4,
|
244
253
|
'm2.xlarge' => 2, 'm2.2xlarge' => 4, 'm2.4xlarge' => 8,
|
245
|
-
|
254
|
+
'm3.xlarge' => 4, 'm3.2xlarge' => 8,
|
246
255
|
'c1.medium' => 2, 'c1.xlarge' => 8,
|
247
256
|
'hi1.4xlarge' => 16,
|
248
257
|
'cg1.4xlarge' => 8,
|
@@ -21,6 +21,12 @@ module AwsPricing
|
|
21
21
|
@name = name
|
22
22
|
end
|
23
23
|
|
24
|
+
# Returns whether an instance_type is available.
|
25
|
+
# type_of_instance = :ondemand, :light, :medium, :heavy
|
26
|
+
def available?(type_of_instance = :ondemand)
|
27
|
+
not price_per_hour(type_of_instance).nil?
|
28
|
+
end
|
29
|
+
|
24
30
|
# type_of_instance = :ondemand, :light, :medium, :heavy
|
25
31
|
# term = :year_1, :year_3, nil
|
26
32
|
def prepay(type_of_instance = :ondemand, term = nil)
|
@@ -32,10 +32,7 @@ module AwsPricing
|
|
32
32
|
def instance_type_available?(api_name, type_of_instance = :ondemand, operating_system = :linux)
|
33
33
|
instance = @instance_types[api_name]
|
34
34
|
return false if instance.nil?
|
35
|
-
|
36
|
-
return false if os.nil?
|
37
|
-
pph = os.price_per_hour(type_of_instance)
|
38
|
-
not pph.nil?
|
35
|
+
instance.available?(type_of_instance, operating_system)
|
39
36
|
end
|
40
37
|
|
41
38
|
# type_of_instance = :ondemand, :light, :medium, :heavy
|
@@ -48,6 +48,21 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
48
48
|
assert region.instance_type_available?('m1.large')
|
49
49
|
end
|
50
50
|
|
51
|
+
def test_fetch_all_breakeven_months
|
52
|
+
pricing = AwsPricing::PriceList.new
|
53
|
+
pricing.regions.each do |region|
|
54
|
+
region.instance_types.each do |instance|
|
55
|
+
instance.operating_systems.each do |os|
|
56
|
+
[:light, :medium, :heavy].each do |res_type|
|
57
|
+
next if not instance.available?(res_type)
|
58
|
+
assert_not_nil(os.get_breakeven_month(res_type, :year1))
|
59
|
+
assert_not_nil(os.get_breakeven_month(res_type, :year3))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
51
66
|
def test_breakeven_month
|
52
67
|
pricing = AwsPricing::PriceList.new
|
53
68
|
region = pricing.get_region('us-east')
|
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
|
-
|
5
|
-
|
4
|
+
version: 0.1.8
|
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: 2013-07-
|
12
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
15
15
|
email:
|
@@ -37,34 +37,33 @@ files:
|
|
37
37
|
- test/helper.rb
|
38
38
|
- test/test-ec2-instance-types.rb
|
39
39
|
homepage: http://github.com/sonian/amazon-pricing
|
40
|
-
licenses:
|
41
|
-
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
post_install_message:
|
42
43
|
rdoc_options:
|
43
|
-
-
|
44
|
+
- --title
|
44
45
|
- amazon-pricing documentation
|
45
|
-
-
|
46
|
-
-
|
46
|
+
- --line-numbers
|
47
|
+
- --main
|
47
48
|
- README
|
48
49
|
require_paths:
|
49
50
|
- lib
|
50
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
51
53
|
requirements:
|
52
|
-
- -
|
54
|
+
- - ! '>='
|
53
55
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
MA==
|
56
|
-
none: false
|
56
|
+
version: '0'
|
57
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
58
59
|
requirements:
|
59
|
-
- -
|
60
|
+
- - ! '>='
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
MA==
|
63
|
-
none: false
|
62
|
+
version: '0'
|
64
63
|
requirements: []
|
65
64
|
rubyforge_project: amazon-pricing
|
66
|
-
rubygems_version: 1.8.
|
67
|
-
signing_key:
|
65
|
+
rubygems_version: 1.8.25
|
66
|
+
signing_key:
|
68
67
|
specification_version: 3
|
69
68
|
summary: Amazon Web Services Pricing Ruby gem
|
70
69
|
test_files:
|
@@ -72,3 +71,4 @@ test_files:
|
|
72
71
|
- spec/price_list_spec.rb
|
73
72
|
- test/helper.rb
|
74
73
|
- test/test-ec2-instance-types.rb
|
74
|
+
has_rdoc:
|