LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package ec2 | 4 package ec2 |
5 | 5 |
6 import ( | 6 import ( |
7 "launchpad.net/goamz/aws" | 7 "launchpad.net/goamz/aws" |
8 "launchpad.net/juju-core/environs/instances" | 8 "launchpad.net/juju-core/environs/instances" |
9 ) | 9 ) |
10 | 10 |
11 // Type of virtualisation used. | 11 // Type of virtualisation used. |
12 var ( | 12 var ( |
13 paravirtual = "pv" | 13 paravirtual = "pv" |
14 hvm = "hvm" | 14 hvm = "hvm" |
15 ) | 15 ) |
16 | 16 |
17 // all instance types can run amd64 images, and some can also run i386 ones. | 17 // all instance types can run amd64 images, and some can also run i386 ones. |
18 var ( | 18 var ( |
19 amd64 = []string{"amd64"} | 19 amd64 = []string{"amd64"} |
20 both = []string{"amd64", "i386"} | 20 both = []string{"amd64", "i386"} |
21 ) | 21 ) |
22 | 22 |
23 // allRegions is defined here to allow tests to override the content. | 23 // allRegions is defined here to allow tests to override the content. |
24 var allRegions = aws.Regions | 24 var allRegions = aws.Regions |
| 25 |
| 26 // TODO(bug 1212688): the RootDisk defaults to 8G currently until the |
| 27 // referenced bug is fixed, at which point RootDisk can be set to nil and the |
| 28 // specified constraint can be passed through via block device mapping to |
| 29 // request an appropriate resize of the root disk. |
25 | 30 |
26 // allInstanceTypes holds the relevant attributes of every known | 31 // allInstanceTypes holds the relevant attributes of every known |
27 // instance type. | 32 // instance type. |
28 var allInstanceTypes = []instances.InstanceType{ | 33 var allInstanceTypes = []instances.InstanceType{ |
29 { // First generation. | 34 { // First generation. |
30 Name: "m1.small", | 35 Name: "m1.small", |
31 Arches: both, | 36 Arches: both, |
32 CpuCores: 1, | 37 CpuCores: 1, |
33 CpuPower: instances.CpuPower(100), | 38 CpuPower: instances.CpuPower(100), |
34 Mem: 1740, | 39 Mem: 1740, |
| 40 RootDisk: 8192, |
35 VType: ¶virtual, | 41 VType: ¶virtual, |
36 }, { | 42 }, { |
37 Name: "m1.medium", | 43 Name: "m1.medium", |
38 Arches: both, | 44 Arches: both, |
39 CpuCores: 1, | 45 CpuCores: 1, |
40 CpuPower: instances.CpuPower(200), | 46 CpuPower: instances.CpuPower(200), |
41 Mem: 3840, | 47 Mem: 3840, |
| 48 RootDisk: 8192, |
42 VType: ¶virtual, | 49 VType: ¶virtual, |
43 }, { | 50 }, { |
44 Name: "m1.large", | 51 Name: "m1.large", |
45 Arches: amd64, | 52 Arches: amd64, |
46 CpuCores: 2, | 53 CpuCores: 2, |
47 CpuPower: instances.CpuPower(400), | 54 CpuPower: instances.CpuPower(400), |
48 Mem: 7680, | 55 Mem: 7680, |
| 56 RootDisk: 8192, |
49 VType: ¶virtual, | 57 VType: ¶virtual, |
50 }, { | 58 }, { |
51 Name: "m1.xlarge", | 59 Name: "m1.xlarge", |
52 Arches: amd64, | 60 Arches: amd64, |
53 CpuCores: 4, | 61 CpuCores: 4, |
54 CpuPower: instances.CpuPower(800), | 62 CpuPower: instances.CpuPower(800), |
55 Mem: 15360, | 63 Mem: 15360, |
| 64 RootDisk: 8192, |
56 VType: ¶virtual, | 65 VType: ¶virtual, |
57 }, | 66 }, |
58 { // Second generation. | 67 { // Second generation. |
59 Name: "m3.xlarge", | 68 Name: "m3.xlarge", |
60 Arches: amd64, | 69 Arches: amd64, |
61 CpuCores: 4, | 70 CpuCores: 4, |
62 CpuPower: instances.CpuPower(1300), | 71 CpuPower: instances.CpuPower(1300), |
63 Mem: 15360, | 72 Mem: 15360, |
| 73 RootDisk: 8192, |
64 VType: ¶virtual, | 74 VType: ¶virtual, |
65 }, { | 75 }, { |
66 Name: "m3.2xlarge", | 76 Name: "m3.2xlarge", |
67 Arches: amd64, | 77 Arches: amd64, |
68 CpuCores: 8, | 78 CpuCores: 8, |
69 CpuPower: instances.CpuPower(2600), | 79 CpuPower: instances.CpuPower(2600), |
70 Mem: 30720, | 80 Mem: 30720, |
| 81 RootDisk: 8192, |
71 VType: ¶virtual, | 82 VType: ¶virtual, |
72 }, | 83 }, |
73 { // Micro. | 84 { // Micro. |
74 Name: "t1.micro", | 85 Name: "t1.micro", |
75 Arches: both, | 86 Arches: both, |
76 CpuCores: 1, | 87 CpuCores: 1, |
77 CpuPower: instances.CpuPower(20), | 88 CpuPower: instances.CpuPower(20), |
78 Mem: 613, | 89 Mem: 613, |
| 90 RootDisk: 8192, |
79 VType: ¶virtual, | 91 VType: ¶virtual, |
80 }, | 92 }, |
81 { // High-Memory. | 93 { // High-Memory. |
82 Name: "m2.xlarge", | 94 Name: "m2.xlarge", |
83 Arches: amd64, | 95 Arches: amd64, |
84 CpuCores: 2, | 96 CpuCores: 2, |
85 CpuPower: instances.CpuPower(650), | 97 CpuPower: instances.CpuPower(650), |
86 Mem: 17408, | 98 Mem: 17408, |
| 99 RootDisk: 8192, |
87 VType: ¶virtual, | 100 VType: ¶virtual, |
88 }, { | 101 }, { |
89 Name: "m2.2xlarge", | 102 Name: "m2.2xlarge", |
90 Arches: amd64, | 103 Arches: amd64, |
91 CpuCores: 4, | 104 CpuCores: 4, |
92 CpuPower: instances.CpuPower(1300), | 105 CpuPower: instances.CpuPower(1300), |
93 Mem: 34816, | 106 Mem: 34816, |
| 107 RootDisk: 8192, |
94 VType: ¶virtual, | 108 VType: ¶virtual, |
95 }, { | 109 }, { |
96 Name: "m2.4xlarge", | 110 Name: "m2.4xlarge", |
97 Arches: amd64, | 111 Arches: amd64, |
98 CpuCores: 8, | 112 CpuCores: 8, |
99 CpuPower: instances.CpuPower(2600), | 113 CpuPower: instances.CpuPower(2600), |
100 Mem: 69632, | 114 Mem: 69632, |
| 115 RootDisk: 8192, |
101 VType: ¶virtual, | 116 VType: ¶virtual, |
102 }, | 117 }, |
103 { // High-CPU. | 118 { // High-CPU. |
104 Name: "c1.medium", | 119 Name: "c1.medium", |
105 Arches: both, | 120 Arches: both, |
106 CpuCores: 2, | 121 CpuCores: 2, |
107 CpuPower: instances.CpuPower(500), | 122 CpuPower: instances.CpuPower(500), |
108 Mem: 1740, | 123 Mem: 1740, |
| 124 RootDisk: 8192, |
109 VType: ¶virtual, | 125 VType: ¶virtual, |
110 }, { | 126 }, { |
111 Name: "c1.xlarge", | 127 Name: "c1.xlarge", |
112 Arches: amd64, | 128 Arches: amd64, |
113 CpuCores: 8, | 129 CpuCores: 8, |
114 CpuPower: instances.CpuPower(2000), | 130 CpuPower: instances.CpuPower(2000), |
115 Mem: 7168, | 131 Mem: 7168, |
| 132 RootDisk: 8192, |
116 VType: ¶virtual, | 133 VType: ¶virtual, |
117 }, | 134 }, |
118 { // Cluster compute. | 135 { // Cluster compute. |
119 Name: "cc1.4xlarge", | 136 Name: "cc1.4xlarge", |
120 Arches: amd64, | 137 Arches: amd64, |
121 CpuCores: 8, | 138 CpuCores: 8, |
122 CpuPower: instances.CpuPower(3350), | 139 CpuPower: instances.CpuPower(3350), |
123 Mem: 23552, | 140 Mem: 23552, |
| 141 RootDisk: 8192, |
124 VType: &hvm, | 142 VType: &hvm, |
125 }, { | 143 }, { |
126 Name: "cc2.8xlarge", | 144 Name: "cc2.8xlarge", |
127 Arches: amd64, | 145 Arches: amd64, |
128 CpuCores: 16, | 146 CpuCores: 16, |
129 CpuPower: instances.CpuPower(8800), | 147 CpuPower: instances.CpuPower(8800), |
130 Mem: 61952, | 148 Mem: 61952, |
| 149 RootDisk: 8192, |
131 VType: &hvm, | 150 VType: &hvm, |
132 }, | 151 }, |
133 { // High Memory cluster. | 152 { // High Memory cluster. |
134 Name: "cr1.8xlarge", | 153 Name: "cr1.8xlarge", |
135 Arches: amd64, | 154 Arches: amd64, |
136 CpuCores: 16, | 155 CpuCores: 16, |
137 CpuPower: instances.CpuPower(8800), | 156 CpuPower: instances.CpuPower(8800), |
138 Mem: 249856, | 157 Mem: 249856, |
| 158 RootDisk: 8192, |
139 VType: &hvm, | 159 VType: &hvm, |
140 }, | 160 }, |
141 { // Cluster GPU. | 161 { // Cluster GPU. |
142 Name: "cg1.4xlarge", | 162 Name: "cg1.4xlarge", |
143 Arches: amd64, | 163 Arches: amd64, |
144 CpuCores: 8, | 164 CpuCores: 8, |
145 CpuPower: instances.CpuPower(3350), | 165 CpuPower: instances.CpuPower(3350), |
146 Mem: 22528, | 166 Mem: 22528, |
| 167 RootDisk: 8192, |
147 VType: &hvm, | 168 VType: &hvm, |
148 }, | 169 }, |
149 { // High I/O. | 170 { // High I/O. |
150 Name: "hi1.4xlarge", | 171 Name: "hi1.4xlarge", |
151 Arches: amd64, | 172 Arches: amd64, |
152 CpuCores: 16, | 173 CpuCores: 16, |
153 CpuPower: instances.CpuPower(3500), | 174 CpuPower: instances.CpuPower(3500), |
154 Mem: 61952, | 175 Mem: 61952, |
| 176 RootDisk: 8192, |
155 VType: ¶virtual, | 177 VType: ¶virtual, |
156 }, | 178 }, |
157 { // High storage. | 179 { // High storage. |
158 Name: "hs1.8xlarge", | 180 Name: "hs1.8xlarge", |
159 Arches: amd64, | 181 Arches: amd64, |
160 CpuCores: 16, | 182 CpuCores: 16, |
161 CpuPower: instances.CpuPower(3500), | 183 CpuPower: instances.CpuPower(3500), |
162 Mem: 119808, | 184 Mem: 119808, |
| 185 RootDisk: 8192, |
163 VType: ¶virtual, | 186 VType: ¶virtual, |
164 }, | 187 }, |
165 } | 188 } |
166 | 189 |
167 type instanceTypeCost map[string]uint64 | 190 type instanceTypeCost map[string]uint64 |
168 type regionCosts map[string]instanceTypeCost | 191 type regionCosts map[string]instanceTypeCost |
169 | 192 |
170 // allRegionCosts holds the cost in USDe-3/hour for each available instance | 193 // allRegionCosts holds the cost in USDe-3/hour for each available instance |
171 // type in each region. | 194 // type in each region. |
172 var allRegionCosts = regionCosts{ | 195 var allRegionCosts = regionCosts{ |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 "m2.xlarge": 410, | 309 "m2.xlarge": 410, |
287 "m2.2xlarge": 820, | 310 "m2.2xlarge": 820, |
288 "m2.4xlarge": 1640, | 311 "m2.4xlarge": 1640, |
289 "c1.medium": 145, | 312 "c1.medium": 145, |
290 "c1.xlarge": 580, | 313 "c1.xlarge": 580, |
291 "cc2.8xlarge": 2400, | 314 "cc2.8xlarge": 2400, |
292 "cr1.8xlarge": 3500, | 315 "cr1.8xlarge": 3500, |
293 "hi1.4xlarge": 3100, | 316 "hi1.4xlarge": 3100, |
294 }, | 317 }, |
295 } | 318 } |
LEFT | RIGHT |