launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/provider/ec2/instancetype.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package ec2 5 6 import ( 7 "launchpad.net/goamz/aws" 8 9 "launchpad.net/juju-core/environs/instances" 10 ) 11 12 // Type of virtualisation used. 13 var ( 14 paravirtual = "pv" 15 hvm = "hvm" 16 ) 17 18 // all instance types can run amd64 images, and some can also run i386 ones. 19 var ( 20 amd64 = []string{"amd64"} 21 both = []string{"amd64", "i386"} 22 ) 23 24 // allRegions is defined here to allow tests to override the content. 25 var allRegions = aws.Regions 26 27 // allInstanceTypes holds the relevant attributes of every known 28 // instance type. 29 // Note that while the EC2 root disk default is 8G, constraints on disk 30 // for amazon will simply cause the root disk to grow to match the constraint 31 var allInstanceTypes = []instances.InstanceType{ 32 { // First generation. 33 Name: "m1.small", 34 Arches: both, 35 CpuCores: 1, 36 CpuPower: instances.CpuPower(100), 37 Mem: 1740, 38 VType: ¶virtual, 39 }, { 40 Name: "m1.medium", 41 Arches: both, 42 CpuCores: 1, 43 CpuPower: instances.CpuPower(200), 44 Mem: 3840, 45 VType: ¶virtual, 46 }, { 47 Name: "m1.large", 48 Arches: amd64, 49 CpuCores: 2, 50 CpuPower: instances.CpuPower(400), 51 Mem: 7680, 52 VType: ¶virtual, 53 }, { 54 Name: "m1.xlarge", 55 Arches: amd64, 56 CpuCores: 4, 57 CpuPower: instances.CpuPower(800), 58 Mem: 15360, 59 VType: ¶virtual, 60 }, 61 { // Second generation. 62 Name: "m3.xlarge", 63 Arches: amd64, 64 CpuCores: 4, 65 CpuPower: instances.CpuPower(1300), 66 Mem: 15360, 67 VType: ¶virtual, 68 }, { 69 Name: "m3.2xlarge", 70 Arches: amd64, 71 CpuCores: 8, 72 CpuPower: instances.CpuPower(2600), 73 Mem: 30720, 74 VType: ¶virtual, 75 }, 76 { // Micro. 77 Name: "t1.micro", 78 Arches: both, 79 CpuCores: 1, 80 CpuPower: instances.CpuPower(20), 81 Mem: 613, 82 VType: ¶virtual, 83 }, 84 { // High-Memory. 85 Name: "m2.xlarge", 86 Arches: amd64, 87 CpuCores: 2, 88 CpuPower: instances.CpuPower(650), 89 Mem: 17408, 90 VType: ¶virtual, 91 }, { 92 Name: "m2.2xlarge", 93 Arches: amd64, 94 CpuCores: 4, 95 CpuPower: instances.CpuPower(1300), 96 Mem: 34816, 97 VType: ¶virtual, 98 }, { 99 Name: "m2.4xlarge", 100 Arches: amd64, 101 CpuCores: 8, 102 CpuPower: instances.CpuPower(2600), 103 Mem: 69632, 104 VType: ¶virtual, 105 }, 106 { // High-CPU. 107 Name: "c1.medium", 108 Arches: both, 109 CpuCores: 2, 110 CpuPower: instances.CpuPower(500), 111 Mem: 1740, 112 VType: ¶virtual, 113 }, { 114 Name: "c1.xlarge", 115 Arches: amd64, 116 CpuCores: 8, 117 CpuPower: instances.CpuPower(2000), 118 Mem: 7168, 119 VType: ¶virtual, 120 }, 121 { // Cluster compute. 122 Name: "cc1.4xlarge", 123 Arches: amd64, 124 CpuCores: 8, 125 CpuPower: instances.CpuPower(3350), 126 Mem: 23552, 127 VType: &hvm, 128 }, { 129 Name: "cc2.8xlarge", 130 Arches: amd64, 131 CpuCores: 16, 132 CpuPower: instances.CpuPower(8800), 133 Mem: 61952, 134 VType: &hvm, 135 }, 136 { // High Memory cluster. 137 Name: "cr1.8xlarge", 138 Arches: amd64, 139 CpuCores: 16, 140 CpuPower: instances.CpuPower(8800), 141 Mem: 249856, 142 VType: &hvm, 143 }, 144 { // Cluster GPU. 145 Name: "cg1.4xlarge", 146 Arches: amd64, 147 CpuCores: 8, 148 CpuPower: instances.CpuPower(3350), 149 Mem: 22528, 150 VType: &hvm, 151 }, 152 { // High I/O. 153 Name: "hi1.4xlarge", 154 Arches: amd64, 155 CpuCores: 16, 156 CpuPower: instances.CpuPower(3500), 157 Mem: 61952, 158 VType: ¶virtual, 159 }, 160 { // High storage. 161 Name: "hs1.8xlarge", 162 Arches: amd64, 163 CpuCores: 16, 164 CpuPower: instances.CpuPower(3500), 165 Mem: 119808, 166 VType: ¶virtual, 167 }, 168 } 169 170 type instanceTypeCost map[string]uint64 171 type regionCosts map[string]instanceTypeCost 172 173 // allRegionCosts holds the cost in USDe-3/hour for each available instance 174 // type in each region. 175 var allRegionCosts = regionCosts{ 176 "ap-northeast-1": { // Tokyo. 177 "m1.small": 88, 178 "m1.medium": 175, 179 "m1.large": 350, 180 "m1.xlarge": 700, 181 "m3.xlarge": 760, 182 "m3.2xlarge": 1520, 183 "t1.micro": 27, 184 "m2.xlarge": 505, 185 "m2.2xlarge": 1010, 186 "m2.4xlarge": 2020, 187 "c1.medium": 185, 188 "c1.xlarge": 740, 189 }, 190 "ap-southeast-1": { // Singapore. 191 "m1.small": 80, 192 "m1.medium": 160, 193 "m1.large": 320, 194 "m1.xlarge": 640, 195 "m3.xlarge": 700, 196 "m3.2xlarge": 1400, 197 "t1.micro": 20, 198 "m2.xlarge": 495, 199 "m2.2xlarge": 990, 200 "m2.4xlarge": 1980, 201 "c1.medium": 183, 202 "c1.xlarge": 730, 203 }, 204 "ap-southeast-2": { // Sydney. 205 "m1.small": 80, 206 "m1.medium": 160, 207 "m1.large": 320, 208 "m1.xlarge": 640, 209 "m3.xlarge": 700, 210 "m3.2xlarge": 1400, 211 "t1.micro": 20, 212 "m2.xlarge": 495, 213 "m2.2xlarge": 990, 214 "m2.4xlarge": 1980, 215 "c1.medium": 183, 216 "c1.xlarge": 730, 217 }, 218 "eu-west-1": { // Ireland. 219 "m1.small": 65, 220 "m1.medium": 130, 221 "m1.large": 260, 222 "m1.xlarge": 520, 223 "m3.xlarge": 550, 224 "m3.2xlarge": 1100, 225 "t1.micro": 20, 226 "m2.xlarge": 460, 227 "m2.2xlarge": 920, 228 "m2.4xlarge": 1840, 229 "c1.medium": 165, 230 "c1.xlarge": 660, 231 "cc2.8xlarge": 2700, 232 "cg1.4xlarge": 2360, 233 "hi1.4xlarge": 3410, 234 }, 235 "sa-east-1": { // Sao Paulo. 236 "m1.small": 80, 237 "m1.medium": 160, 238 "m1.large": 320, 239 "m1.xlarge": 640, 240 "t1.micro": 27, 241 "m2.xlarge": 540, 242 "m2.2xlarge": 1080, 243 "m2.4xlarge": 2160, 244 "c1.medium": 200, 245 "c1.xlarge": 800, 246 }, 247 "us-east-1": { // Northern Virginia. 248 "m1.small": 60, 249 "m1.medium": 120, 250 "m1.large": 240, 251 "m1.xlarge": 480, 252 "m3.xlarge": 500, 253 "m3.2xlarge": 1000, 254 "t1.micro": 20, 255 "m2.xlarge": 410, 256 "m2.2xlarge": 820, 257 "m2.4xlarge": 1640, 258 "c1.medium": 145, 259 "c1.xlarge": 580, 260 "cc1.4xlarge": 1300, 261 "cc2.8xlarge": 2400, 262 "cr1.8xlarge": 3500, 263 "cg1.4xlarge": 2100, 264 "hi1.4xlarge": 3100, 265 "hs1.8xlarge": 4600, 266 }, 267 "us-west-1": { // Northern California. 268 "m1.small": 65, 269 "m1.medium": 130, 270 "m1.large": 260, 271 "m1.xlarge": 520, 272 "m3.xlarge": 550, 273 "m3.2xlarge": 1100, 274 "t1.micro": 25, 275 "m2.xlarge": 460, 276 "m2.2xlarge": 920, 277 "m2.4xlarge": 1840, 278 "c1.medium": 165, 279 "c1.xlarge": 660, 280 }, 281 "us-west-2": { // Oregon. 282 "m1.small": 60, 283 "m1.medium": 120, 284 "m1.large": 240, 285 "m1.xlarge": 480, 286 "m3.xlarge": 500, 287 "m3.2xlarge": 1000, 288 "t1.micro": 20, 289 "m2.xlarge": 410, 290 "m2.2xlarge": 820, 291 "m2.4xlarge": 1640, 292 "c1.medium": 145, 293 "c1.xlarge": 580, 294 "cc2.8xlarge": 2400, 295 "cr1.8xlarge": 3500, 296 "hi1.4xlarge": 3100, 297 }, 298 }