amazon-pricing 0.1.21 → 0.1.22
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
CHANGED
data/lib/amazon-pricing.rb
CHANGED
@@ -40,6 +40,10 @@ module AwsPricing
|
|
40
40
|
page = Net::HTTP.get_response(uri)
|
41
41
|
# Now that AWS switched from json to jsonp, remove first/last lines
|
42
42
|
body = page.body.gsub("callback(", "").reverse.sub(")", "").reverse
|
43
|
+
if body.split("\n").last == ";"
|
44
|
+
# Now remove one more line (rds is returning ";", ec2 empty line)
|
45
|
+
body = body.reverse.sub(";", "").reverse
|
46
|
+
end
|
43
47
|
|
44
48
|
#body = page.body.split("\n")[1..-2].join("\n")
|
45
49
|
JSON.parse(body)
|
@@ -61,21 +61,5 @@ module AwsPricing
|
|
61
61
|
[api_name, name]
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
|
-
@@Name_Lookup = {
|
66
|
-
'm1.small' => 'Standard Small', 'm1.medium' => 'Standard Medium', 'm1.large' => 'Standard Large', 'm1.xlarge' => 'Standard Extra Large',
|
67
|
-
'm2.xlarge' => 'Hi-Memory Extra Large', 'm2.2xlarge' => 'Hi-Memory Double Extra Large', 'm2.4xlarge' => 'Hi-Memory Quadruple Extra Large',
|
68
|
-
'm3.medium' => 'M3 Medium Instance', 'm3.large'=>'M3 Large Instance', 'm3.xlarge' => 'M3 Extra Large Instance', 'm3.2xlarge' => 'M3 Double Extra Large Instance',
|
69
|
-
'c1.medium' => 'High-CPU Medium', 'c1.xlarge' => 'High-CPU Extra Large',
|
70
|
-
'hi1.4xlarge' => 'High I/O Quadruple Extra Large',
|
71
|
-
'cg1.4xlarge' => 'Cluster GPU Quadruple Extra Large',
|
72
|
-
'cc1.4xlarge' => 'Cluster Compute Quadruple Extra Large', 'cc2.8xlarge' => 'Cluster Compute Eight Extra Large',
|
73
|
-
't1.micro' => 'Micro',
|
74
|
-
'cr1.8xlarge' => 'High-Memory Cluster Eight Extra Large',
|
75
|
-
'hs1.8xlarge' => 'High-Storage Eight Extra Large',
|
76
|
-
'g2.2xlarge' => 'Cluster GPU Double Extra Large',
|
77
|
-
'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',
|
78
|
-
'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'
|
79
|
-
}
|
80
64
|
end
|
81
65
|
end
|
@@ -110,6 +110,21 @@ module AwsPricing
|
|
110
110
|
values
|
111
111
|
end
|
112
112
|
|
113
|
+
@@Name_Lookup = {
|
114
|
+
'm1.small' => 'Standard Small', 'm1.medium' => 'Standard Medium', 'm1.large' => 'Standard Large', 'm1.xlarge' => 'Standard Extra Large',
|
115
|
+
'm2.xlarge' => 'Hi-Memory Extra Large', 'm2.2xlarge' => 'Hi-Memory Double Extra Large', 'm2.4xlarge' => 'Hi-Memory Quadruple Extra Large',
|
116
|
+
'm3.medium' => 'M3 Medium Instance', 'm3.large'=>'M3 Large Instance', 'm3.xlarge' => 'M3 Extra Large Instance', 'm3.2xlarge' => 'M3 Double Extra Large Instance',
|
117
|
+
'c1.medium' => 'High-CPU Medium', 'c1.xlarge' => 'High-CPU Extra Large',
|
118
|
+
'hi1.4xlarge' => 'High I/O Quadruple Extra Large',
|
119
|
+
'cg1.4xlarge' => 'Cluster GPU Quadruple Extra Large',
|
120
|
+
'cc1.4xlarge' => 'Cluster Compute Quadruple Extra Large', 'cc2.8xlarge' => 'Cluster Compute Eight Extra Large',
|
121
|
+
't1.micro' => 'Micro',
|
122
|
+
'cr1.8xlarge' => 'High-Memory Cluster Eight Extra Large',
|
123
|
+
'hs1.8xlarge' => 'High-Storage Eight Extra Large',
|
124
|
+
'g2.2xlarge' => 'Cluster GPU Double Extra Large',
|
125
|
+
'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',
|
126
|
+
'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',
|
127
|
+
}
|
113
128
|
@@Memory_Lookup = {
|
114
129
|
'm1.small' => 1700, 'm1.medium' => 3750, 'm1.large' => 7500, 'm1.xlarge' => 15000,
|
115
130
|
'm2.xlarge' => 17100, 'm2.2xlarge' => 34200, 'm2.4xlarge' => 68400,
|
@@ -1,6 +1,26 @@
|
|
1
1
|
require 'amazon-pricing/instance-type'
|
2
2
|
module AwsPricing
|
3
3
|
class RdsInstanceType < InstanceType
|
4
|
+
|
5
|
+
def initialize(region, api_name, name, json)
|
6
|
+
@category_types = {}
|
7
|
+
|
8
|
+
@region = region
|
9
|
+
@name = name
|
10
|
+
@api_name = api_name
|
11
|
+
|
12
|
+
# Let's look up using the standard name but need to remove leading "db." to do so
|
13
|
+
api_name_for_lookup = api_name.sub("db.", "")
|
14
|
+
|
15
|
+
@memory_in_mb = @@Memory_Lookup[api_name_for_lookup]
|
16
|
+
@disk_in_gb = @@Disk_Lookup[api_name_for_lookup]
|
17
|
+
@platform = @@Platform_Lookup[api_name_for_lookup]
|
18
|
+
@compute_units = @@Compute_Units_Lookup[api_name_for_lookup]
|
19
|
+
@virtual_cores = @@Virtual_Cores_Lookup[api_name_for_lookup]
|
20
|
+
@disk_type = @@Disk_Type_Lookup[api_name_for_lookup]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
4
24
|
# database_type = :mysql, :oracle, :sqlserver
|
5
25
|
# type_of_instance = :ondemand, :light, :medium, :heavy
|
6
26
|
|
@@ -56,47 +76,39 @@ module AwsPricing
|
|
56
76
|
protected
|
57
77
|
|
58
78
|
# Returns [api_name, name]
|
59
|
-
|
60
|
-
|
61
|
-
|
79
|
+
# e.g. memDBCurrentGen, db.m3.medium
|
80
|
+
def self.get_name(instance_type, api_name, is_reserved = false)
|
81
|
+
|
82
|
+
# Note: These api names are specific to RDS, not sure why Amazon has given them different API names (note: they have leading "db.")
|
83
|
+
#'cr1.8xl' => 'High-Memory Cluster Eight Extra Large',
|
84
|
+
#'micro' => 'Micro',
|
85
|
+
#'sm' => 'Standard Small',
|
86
|
+
#'xxlHiMem' => 'Hi-Memory Double Extra Large'
|
87
|
+
if ["db.cr1.8xl", "db.micro", "db.sm", "db.xxlHiMem", "sm", "micro", "xxlHiMem"].include? api_name
|
88
|
+
case api_name
|
89
|
+
when "db.cr1.8xl"
|
90
|
+
api_name = "db.cr1.8xlarge"
|
91
|
+
when "db.xxlHiMem", "xxlHiMem"
|
92
|
+
api_name = "db.m2.2xlarge"
|
93
|
+
when "db.micro", "micro"
|
94
|
+
api_name = "db.t1.micro"
|
95
|
+
when "db.sm", "sm"
|
96
|
+
api_name = "db.m1.small"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Let's look up using the standard name but need to remove leading "db." to do so
|
101
|
+
api_name_for_lookup = api_name.sub("db.", "")
|
62
102
|
|
63
103
|
# Let's handle new instances more gracefully
|
64
|
-
unless
|
65
|
-
raise UnknownTypeError, "Unknown instance type #{instance_type}", caller
|
66
|
-
else
|
67
|
-
api_name = lookup[instance_type][size]
|
104
|
+
unless @@Name_Lookup.has_key? api_name_for_lookup
|
105
|
+
raise UnknownTypeError, "Unknown instance type #{instance_type} #{api_name}", caller
|
68
106
|
end
|
69
107
|
|
70
|
-
|
71
|
-
lookup = @@Name_Lookup_Reserved if is_reserved
|
72
|
-
name = lookup[instance_type][size]
|
108
|
+
name = @@Name_Lookup[api_name_for_lookup]
|
73
109
|
|
74
110
|
[api_name, name]
|
75
111
|
end
|
76
|
-
|
77
|
-
@@Api_Name_Lookup = {
|
78
|
-
'udbInstClass' => {'uDBInst'=>'db.t1.micro'},
|
79
|
-
'dbInstClass'=> {'uDBInst' => 'db.t1.micro', 'smDBInst' => 'db.m1.small', 'medDBInst' => 'db.m1.medium', 'lgDBInst' => 'db.m1.large', 'xlDBInst' => 'db.m1.xlarge'},
|
80
|
-
'hiMemDBInstClass'=> {'xlDBInst' => 'db.m2.xlarge', 'xxlDBInst' => 'db.m2.2xlarge', 'xxxxDBInst' => 'db.m2.4xlarge'},
|
81
|
-
'clusterHiMemDB' => {'xxxxxxxxl' => 'db.cr1.8xlarge'},
|
82
|
-
'multiAZDBInstClass'=> {'uDBInst' => 'db.t1.micro', 'smDBInst' => 'db.m1.small', 'medDBInst' => 'db.m1.medium', 'lgDBInst' => 'db.m1.large', 'xlDBInst' => 'db.m1.xlarge'},
|
83
|
-
'multiAZHiMemInstClass'=> {'xlDBInst' => 'db.m2.xlarge', 'xxlDBInst' => 'db.m2.2xlarge', 'xxxxDBInst' => 'db.m2.4xlarge'},
|
84
|
-
}
|
85
|
-
@@Name_Lookup = {
|
86
|
-
'udbInstClass' => {'uDBInst'=>'Standard Micro'},
|
87
|
-
'dbInstClass'=> {'uDBInst' => 'Standard Micro', 'smDBInst' => 'Standard Small', 'medDBInst' => 'Standard Medium', 'lgDBInst' => 'Standard Large', 'xlDBInst' => 'Standard Extra Large'},
|
88
|
-
'hiMemDBInstClass'=> {'xlDBInst' => 'Standard High-Memory Extra Large', 'xxlDBInst' => 'Standard High-Memory Double Extra Large', 'xxxxDBInst' => 'Standard High-Memory Quadruple Extra Large'},
|
89
|
-
'clusterHiMemDB' => {'xxxxxxxxl' => 'Standard High-Memory Cluster Eight Extra Large'},
|
90
|
-
'multiAZDBInstClass'=> {'uDBInst' => 'Multi-AZ Micro', 'smDBInst' => 'Multi-AZ Small', 'medDBInst' => 'Multi-AZ Medium', 'lgDBInst' => 'Multi-AZ Large', 'xlDBInst' => 'Multi-AZ Extra Large'},
|
91
|
-
'multiAZHiMemInstClass'=> {'xlDBInst' => 'Multi-AZ High-Memory Extra Large', 'xxlDBInst' => 'Multi-AZ High-Memory Double Extra Large', 'xxxxDBInst' => 'Multi-AZ High-Memory Quadruple Extra Large'},
|
92
|
-
}
|
93
|
-
@@Api_Name_Lookup_Reserved = {
|
94
|
-
'stdDeployRes' => {'u' => 'db.t1.micro', 'micro' => 'db.t1.micro', 'sm' => 'db.m1.small', 'med' => 'db.m1.medium', 'lg' => 'db.m1.large', 'xl' => 'db.m1.xlarge', 'xlHiMem' => 'db.m2.xlarge', 'xxlHiMem' => 'db.m2.2xlarge', 'xxxxlHiMem' => 'db.m2.4xlarge', 'xxxxxxxxl' => 'db.cr1.8xlarge'},
|
95
|
-
'multiAZdeployRes' => {'u' => 'db.t1.micro', 'micro' => 'db.t1.micro', 'sm' => 'db.m1.small', 'med' => 'db.m1.medium', 'lg' => 'db.m1.large', 'xl' => 'db.m1.xlarge', 'xlHiMem' => 'db.m2.xlarge', 'xxlHiMem' => 'db.m2.2xlarge', 'xxxxlHiMem' => 'db.m2.4xlarge', 'xxxxxxxxl' => 'db.cr1.8xlarge'},
|
96
|
-
}
|
97
|
-
@@Name_Lookup_Reserved = {
|
98
|
-
'stdDeployRes' => {'u' => 'Standard Micro', 'micro' => 'Standard Micro', 'sm' => 'Standard Small', 'med' => 'Standard Medium', 'lg' => 'Standard Large', 'xl' => 'Standard Extra Large', 'xlHiMem' => 'Standard Extra Large High-Memory', 'xxlHiMem' => 'Standard Double Extra Large High-Memory', 'xxxxlHiMem' => 'Standard Quadruple Extra Large High-Memory', 'xxxxxxxxl' => 'Standard Eight Extra Large'} ,
|
99
|
-
'multiAZdeployRes' => {'u' => 'Multi-AZ Micro', 'micro' => 'Multi-AZ Micro', 'sm' => 'Multi-AZ Small', 'med' => 'Multi-AZ Medium', 'lg' => 'Multi-AZ Large', 'xl' => 'Multi-AZ Extra Large', 'xlHiMem' => 'Multi-AZ Extra Large High-Memory', 'xxlHiMem' => 'Multi-AZ Double Extra Large High-Memory', 'xxxxlHiMem' => 'Multi-AZ Quadruple Extra Large High-Memory', 'xxxxxxxxl' => 'Multi-AZ Eight Extra Large'},
|
100
|
-
}
|
101
112
|
end
|
113
|
+
|
102
114
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
15
15
|
email:
|
@@ -62,16 +62,29 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
62
|
- - ! '>='
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
hash: 1817073564314149900
|
65
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
69
|
none: false
|
67
70
|
requirements:
|
68
71
|
- - ! '>='
|
69
72
|
- !ruby/object:Gem::Version
|
70
73
|
version: '0'
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
hash: 1817073564314149900
|
71
77
|
requirements: []
|
72
78
|
rubyforge_project: amazon-pricing
|
73
79
|
rubygems_version: 1.8.25
|
74
80
|
signing_key:
|
75
81
|
specification_version: 3
|
76
82
|
summary: Amazon Web Services Pricing Ruby gem
|
77
|
-
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
|