From 8e2058063759b51fe40ad4b5807c912ba3d89e76 Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Mon, 6 Apr 2020 21:41:34 -0500 Subject: [PATCH] Use ec2.DescribeInstanceTypes for machine type info --- Makefile | 7 - cloudmock/aws/mockec2/instances.go | 5 + hack/.packages | 1 - hack/machine_types/.gitignore | 1 - hack/machine_types/BUILD.bazel | 21 - hack/machine_types/README.md | 19 - hack/machine_types/machine_types.go | 328 --- pkg/apis/kops/validation/BUILD.bazel | 1 - pkg/apis/kops/validation/aws.go | 17 - upup/pkg/fi/cloudup/apply_cluster.go | 10 +- upup/pkg/fi/cloudup/awstasks/helper.go | 2 +- upup/pkg/fi/cloudup/awsup/aws_cloud.go | 33 + upup/pkg/fi/cloudup/awsup/machine_types.go | 2524 +---------------- upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go | 5 + .../fi/cloudup/spotinsttasks/elastigroup.go | 10 +- 15 files changed, 87 insertions(+), 2897 deletions(-) delete mode 100644 hack/machine_types/.gitignore delete mode 100644 hack/machine_types/BUILD.bazel delete mode 100644 hack/machine_types/README.md delete mode 100644 hack/machine_types/machine_types.go diff --git a/Makefile b/Makefile index 698ef361ec4c3..c9ac872afa8b5 100644 --- a/Makefile +++ b/Makefile @@ -804,13 +804,6 @@ build-docs-netlify: pip install -r ${KOPS_ROOT}/images/mkdocs/requirements.txt mkdocs build -# Update machine_types.go -.PHONY: update-machine-types -update-machine-types: - go build -o hack/machine_types/machine_types ${KOPS_ROOT}/hack/machine_types/ - hack/machine_types/machine_types --out upup/pkg/fi/cloudup/awsup/machine_types.go - go fmt upup/pkg/fi/cloudup/awsup/machine_types.go - #----------------------------------------------------------- # development targets diff --git a/cloudmock/aws/mockec2/instances.go b/cloudmock/aws/mockec2/instances.go index 69519882cb98e..a4e482fc91323 100644 --- a/cloudmock/aws/mockec2/instances.go +++ b/cloudmock/aws/mockec2/instances.go @@ -49,3 +49,8 @@ func (m *MockEC2) DescribeInstancesPages(request *ec2.DescribeInstancesInput, ca func (m *MockEC2) DescribeInstancesPagesWithContext(aws.Context, *ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool, ...request.Option) error { panic("Not implemented") } + +func (m *MockEC2) DescribeInstanceTypes(*ec2.DescribeInstanceTypesInput) (*ec2.DescribeInstanceTypesOutput, error) { + klog.Warningf("MockEc2::DescribeInstanceTypes is stub-implemented") + return &ec2.DescribeInstanceTypesOutput{}, nil +} diff --git a/hack/.packages b/hack/.packages index 641524423c381..f1871b911d3f4 100644 --- a/hack/.packages +++ b/hack/.packages @@ -32,7 +32,6 @@ k8s.io/kops/dnsprovider/pkg/dnsprovider/providers/openstack/designate k8s.io/kops/dnsprovider/pkg/dnsprovider/rrstype k8s.io/kops/dnsprovider/pkg/dnsprovider/tests k8s.io/kops/examples/kops-api-example -k8s.io/kops/hack/machine_types k8s.io/kops/kube-discovery/cmd/kube-discovery k8s.io/kops/node-authorizer/cmd/node-authorizer k8s.io/kops/node-authorizer/pkg/authorizers/alwaysallow diff --git a/hack/machine_types/.gitignore b/hack/machine_types/.gitignore deleted file mode 100644 index c6239bdb1432d..0000000000000 --- a/hack/machine_types/.gitignore +++ /dev/null @@ -1 +0,0 @@ -machine_types \ No newline at end of file diff --git a/hack/machine_types/BUILD.bazel b/hack/machine_types/BUILD.bazel deleted file mode 100644 index b8c5b0c507059..0000000000000 --- a/hack/machine_types/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") - -go_library( - name = "go_default_library", - srcs = ["machine_types.go"], - importpath = "k8s.io/kops/hack/machine_types", - visibility = ["//visibility:private"], - deps = [ - "//upup/pkg/fi/cloudup/awsup:go_default_library", - "//vendor/github.com/aws/aws-sdk-go/aws:go_default_library", - "//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library", - "//vendor/github.com/aws/aws-sdk-go/service/ec2:go_default_library", - "//vendor/k8s.io/klog:go_default_library", - ], -) - -go_binary( - name = "machinetypes", - embed = [":go_default_library"], - visibility = ["//visibility:public"], -) diff --git a/hack/machine_types/README.md b/hack/machine_types/README.md deleted file mode 100644 index 9d9e5ddebb80f..0000000000000 --- a/hack/machine_types/README.md +++ /dev/null @@ -1,19 +0,0 @@ -Machine Types Generator -======================= - -To prevent errors or lagging updates, we use this generator to update the known aws machine types -that are [hard coded in kops](https://github.com/kubernetes/kops/blob/7d7112c1e9a52d4f677db6bd98943d308ec9f581/upup/pkg/fi/cloudup/awsup/machine_types.go#L76). - -This generator uses the AWS Pricing API to get most of it's info on what instance types are supported. - -Usage ------ -``` -make update-machine-types -git add . -git commit -am "Updated machine types" -``` - -TODO: ------ -* Cross reference other regions besides us-east-1. Currently we just look at one region to determine instance types. diff --git a/hack/machine_types/machine_types.go b/hack/machine_types/machine_types.go deleted file mode 100644 index a263ea4b973fa..0000000000000 --- a/hack/machine_types/machine_types.go +++ /dev/null @@ -1,328 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "io/ioutil" - "math" - "os" - "sort" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ec2" - "k8s.io/klog" - "k8s.io/kops/upup/pkg/fi/cloudup/awsup" -) - -var outputPath = "" - -func main() { - flag.StringVar(&outputPath, "out", outputPath, "file to write") - - flag.Parse() - - if err := run(); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - os.Exit(1) - } -} - -func run() error { - if outputPath == "" { - return fmt.Errorf("must specify output file with --out") - } - - klog.Info("Beginning AWS Machine Refresh") - - // These are instance types not available in every account - // If they're not available, they wont be in the ec2.DescribeInstanceTypes response - // so they are hardcoded here for reference. - // Note that the m6g instances do not have ENI or IP information - machines := []awsup.AWSMachineTypeInfo{ - { - Name: "cr1.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{120, 120}, - }, - { - Name: "hs1.8xlarge", - MemoryGB: 117, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000}, - }, - { - Name: "m6g.medium", - MemoryGB: 4, - Cores: 1, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - } - families := map[string]struct{}{ - "cr1": {}, - "hs1": {}, - "m6g": {}, - } - - config := aws.NewConfig() - // Give verbose errors on auth problems - config = config.WithCredentialsChainVerboseErrors(true) - // Default to us-east-1 - config = config.WithRegion("us-east-1") - - sess, err := session.NewSession() - if err != nil { - return err - } - client := ec2.New(sess, config) - instanceTypes := make([]*ec2.InstanceTypeInfo, 0) - err = client.DescribeInstanceTypesPages(&ec2.DescribeInstanceTypesInput{}, - func(page *ec2.DescribeInstanceTypesOutput, lastPage bool) bool { - instanceTypes = append(instanceTypes, page.InstanceTypes...) - return true - }) - if err != nil { - return err - } - - var warnings []string - - seen := map[string]bool{} - for _, typeInfo := range instanceTypes { - instanceType := *typeInfo.InstanceType - - if _, ok := seen[instanceType]; ok { - continue - } - seen[instanceType] = true - machine := awsup.AWSMachineTypeInfo{ - Name: instanceType, - GPU: typeInfo.GpuInfo != nil, - InstanceENIs: intValue(typeInfo.NetworkInfo.MaximumNetworkInterfaces), - InstanceIPsPerENI: intValue(typeInfo.NetworkInfo.Ipv4AddressesPerInterface), - } - memoryGB := float64(intValue(typeInfo.MemoryInfo.SizeInMiB)) / 1024 - machine.MemoryGB = float32(math.Round(memoryGB*100) / 100) - - if typeInfo.VCpuInfo != nil && typeInfo.VCpuInfo.DefaultVCpus != nil { - machine.Cores = intValue(typeInfo.VCpuInfo.DefaultVCpus) - } - if typeInfo.InstanceStorageInfo != nil && len(typeInfo.InstanceStorageInfo.Disks) > 0 { - disks := make([]int, 0) - for _, disk := range typeInfo.InstanceStorageInfo.Disks { - for i := 0; i < intValue(disk.Count); i++ { - disks = append(disks, intValue(disk.SizeInGB)) - } - } - machine.EphemeralDisks = disks - } - - machines = append(machines, machine) - - family := strings.Split(instanceType, ".")[0] - families[family] = struct{}{} - - } - - sortedFamilies := []string{} - for f := range families { - sortedFamilies = append(sortedFamilies, f) - } - sort.Strings(sortedFamilies) - - sort.Slice(machines, func(i, j int) bool { - // Sort first by family - tokensI := strings.Split(machines[i].Name, ".") - tokensJ := strings.Split(machines[j].Name, ".") - - if tokensI[0] != tokensJ[0] { - return tokensI[0] < tokensJ[0] - } - - // Then sort by size within the family - if machines[i].MemoryGB != machines[j].MemoryGB { - return machines[i].MemoryGB < machines[j].MemoryGB - } - - // Fallback: sort by name - return machines[i].Name < machines[j].Name - }) - - var output string - - if len(warnings) != 0 { - output = output + "\n" - for _, warning := range warnings { - output = output + "// WARNING: " + warning + "\n" - } - output = output + "\n" - } - - for _, f := range sortedFamilies { - output = output + fmt.Sprintf("\n// %s family", f) - for _, m := range machines { - if family := strings.Split(m.Name, ".")[0]; family == f { - - body := fmt.Sprintf(` - { - Name: "%s", - MemoryGB: %v, - Cores: %v, - InstanceENIs: %v, - InstanceIPsPerENI: %v, - `, m.Name, m.MemoryGB, m.Cores, m.InstanceENIs, m.InstanceIPsPerENI) - output = output + body - - // Avoid awkward []int(nil) syntax - if len(m.EphemeralDisks) == 0 { - output = output + "EphemeralDisks: nil,\n" - } else { - output = output + fmt.Sprintf("EphemeralDisks: %#v,\n", m.EphemeralDisks) - } - - if m.GPU { - output = output + "GPU: true,\n" - } - - output = output + "},\n" - } - } - output = output + "\n" - } - - klog.Infof("Writing changes to %v", outputPath) - - fileInput, err := ioutil.ReadFile(outputPath) - if err != nil { - return fmt.Errorf("error reading %s: %v", outputPath, err) - } - scanner := bufio.NewScanner(bytes.NewReader(fileInput)) - - scanner.Split(bufio.ScanLines) - - var newfile string - flag := false - done := false - for scanner.Scan() { - line := scanner.Text() - - if strings.Contains(line, "END GENERATED CONTENT") { - flag = false - done = true - } - if !flag { - newfile = newfile + line + "\n" - } - if strings.Contains(line, "BEGIN GENERATED CONTENT") { - flag = true - newfile = newfile + output - } - } - - if !done { - return fmt.Errorf("BEGIN GENERATED CONTENT / END GENERATED CONTENT markers not found") - } - - err = ioutil.WriteFile(outputPath, []byte(newfile), 0644) - if err != nil { - return fmt.Errorf("error writing %s: %v", outputPath, err) - } - - klog.Info("Done.") - klog.Flush() - - return nil -} - -func intValue(v *int64) int { - return int(aws.Int64Value(v)) -} diff --git a/pkg/apis/kops/validation/BUILD.bazel b/pkg/apis/kops/validation/BUILD.bazel index fd4795343a8a5..4c06ea16b476e 100644 --- a/pkg/apis/kops/validation/BUILD.bazel +++ b/pkg/apis/kops/validation/BUILD.bazel @@ -21,7 +21,6 @@ go_library( "//pkg/model/iam:go_default_library", "//pkg/util/subnet:go_default_library", "//upup/pkg/fi:go_default_library", - "//upup/pkg/fi/cloudup/awsup:go_default_library", "//vendor/github.com/aws/aws-sdk-go/aws/arn:go_default_library", "//vendor/github.com/blang/semver:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/validation:go_default_library", diff --git a/pkg/apis/kops/validation/aws.go b/pkg/apis/kops/validation/aws.go index 00267b89310d9..9913f3444d048 100644 --- a/pkg/apis/kops/validation/aws.go +++ b/pkg/apis/kops/validation/aws.go @@ -25,7 +25,6 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/klog" "k8s.io/kops/pkg/apis/kops" - "k8s.io/kops/upup/pkg/fi/cloudup/awsup" ) func awsValidateCluster(c *kops.Cluster) field.ErrorList { @@ -45,8 +44,6 @@ func awsValidateInstanceGroup(ig *kops.InstanceGroup) field.ErrorList { allErrs = append(allErrs, awsValidateAdditionalSecurityGroups(field.NewPath("spec", "additionalSecurityGroups"), ig.Spec.AdditionalSecurityGroups)...) - allErrs = append(allErrs, awsValidateMachineType(field.NewPath(ig.GetName(), "spec", "machineType"), ig.Spec.MachineType)...) - allErrs = append(allErrs, awsValidateAMIforNVMe(field.NewPath(ig.GetName(), "spec", "machineType"), ig)...) allErrs = append(allErrs, awsValidateSpotDurationInMinute(field.NewPath(ig.GetName(), "spec", "spotDurationInMinutes"), ig)...) @@ -75,20 +72,6 @@ func awsValidateAdditionalSecurityGroups(fieldPath *field.Path, groups []string) return allErrs } -func awsValidateMachineType(fieldPath *field.Path, machineType string) field.ErrorList { - allErrs := field.ErrorList{} - - if machineType != "" { - for _, typ := range strings.Split(machineType, ",") { - if _, err := awsup.GetMachineTypeInfo(typ); err != nil { - allErrs = append(allErrs, field.Invalid(fieldPath, typ, "machine type specified is invalid")) - } - } - } - - return allErrs -} - // TODO: make image validation smarter? graduate from jessie to stretch? This is quick and dirty because we keep getting reports func awsValidateAMIforNVMe(fieldPath *field.Path, ig *kops.InstanceGroup) field.ErrorList { // TODO: how can we put this list somewhere better? diff --git a/upup/pkg/fi/cloudup/apply_cluster.go b/upup/pkg/fi/cloudup/apply_cluster.go index 8aa910c0efe02..f4fda8c8c0236 100644 --- a/upup/pkg/fi/cloudup/apply_cluster.go +++ b/upup/pkg/fi/cloudup/apply_cluster.go @@ -457,8 +457,14 @@ func (c *ApplyClusterCmd) Run() error { if len(sshPublicKeys) > 1 { return fmt.Errorf("exactly one 'admin' SSH public key can be specified when running with AWS; please delete a key using `kops delete secret`") } - - l.TemplateFunctions["MachineTypeInfo"] = awsup.GetMachineTypeInfo + for _, ig := range c.InstanceGroups { + for _, mt := range strings.Split(ig.Spec.MachineType, ",") { + _, err := awsup.GetMachineTypeInfo(awsCloud, mt) + if err != nil { + return fmt.Errorf("machine type in instance group %v is invalid: %v %v", ig.Name, mt, err) + } + } + } } case kops.CloudProviderALI: diff --git a/upup/pkg/fi/cloudup/awstasks/helper.go b/upup/pkg/fi/cloudup/awstasks/helper.go index 178f4a482e58f..cf84b9c61fd3c 100644 --- a/upup/pkg/fi/cloudup/awstasks/helper.go +++ b/upup/pkg/fi/cloudup/awstasks/helper.go @@ -26,7 +26,7 @@ import ( // buildEphemeralDevices looks up the machine type and discovery any ephemeral device mappings func buildEphemeralDevices(cloud awsup.AWSCloud, machineType string) (map[string]*BlockDeviceMapping, error) { - mt, err := awsup.GetMachineTypeInfo(machineType) + mt, err := awsup.GetMachineTypeInfo(cloud, machineType) if err != nil { return nil, fmt.Errorf("failed to find instance type details on: %s, error: %s", machineType, err) } diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index a6b49a94ae6d6..138b4e5f9539b 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -155,6 +155,9 @@ type AWSCloud interface { // DefaultInstanceType determines a suitable instance type for the specified instance group DefaultInstanceType(cluster *kops.Cluster, ig *kops.InstanceGroup) (string, error) + // DescribeInstanceType calls ec2.DescribeInstanceType to get information for a particular instance type + DescribeInstanceType(instanceType string) (*ec2.InstanceTypeInfo, error) + // FindClusterStatus gets the status of the cluster as it exists in AWS, inferred from volumes FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error) } @@ -174,6 +177,8 @@ type awsCloudImplementation struct { tags map[string]string regionDelayers *RegionDelayers + + instanceTypes map[string]*ec2.InstanceTypeInfo } type RegionDelayers struct { @@ -1509,3 +1514,31 @@ func (c *awsCloudImplementation) zonesWithInstanceType(instanceType string) (set return zones, nil } + +// DescribeInstanceType calls ec2.DescribeInstanceType to get information for a particular instance type +func (c *awsCloudImplementation) DescribeInstanceType(instanceType string) (*ec2.InstanceTypeInfo, error) { + if info, ok := c.instanceTypes[instanceType]; ok { + return info, nil + } + info, err := describeInstanceType(c, instanceType) + if err != nil { + return nil, err + } + c.instanceTypes[instanceType] = info + return info, nil +} + +func describeInstanceType(c AWSCloud, instanceType string) (*ec2.InstanceTypeInfo, error) { + req := &ec2.DescribeInstanceTypesInput{ + InstanceTypes: aws.StringSlice([]string{instanceType}), + MaxResults: aws.Int64(1), + } + resp, err := c.EC2().DescribeInstanceTypes(req) + if err != nil { + return nil, err + } + if len(resp.InstanceTypes) != 1 { + return nil, fmt.Errorf("invalid instance type specified: %v", instanceType) + } + return resp.InstanceTypes[0], nil +} diff --git a/upup/pkg/fi/cloudup/awsup/machine_types.go b/upup/pkg/fi/cloudup/awsup/machine_types.go index a73728c3ed8b3..41b681b0e70ec 100644 --- a/upup/pkg/fi/cloudup/awsup/machine_types.go +++ b/upup/pkg/fi/cloudup/awsup/machine_types.go @@ -18,7 +18,9 @@ package awsup import ( "fmt" + "math" + "github.com/aws/aws-sdk-go/aws" "k8s.io/klog" ) @@ -58,2503 +60,37 @@ func (m *AWSMachineTypeInfo) EphemeralDevices() []*EphemeralDevice { return disks } -func GetMachineTypeInfo(machineType string) (*AWSMachineTypeInfo, error) { - for i := range MachineTypes { - m := &MachineTypes[i] - if m.Name == machineType { - return m, nil +func GetMachineTypeInfo(c AWSCloud, machineType string) (*AWSMachineTypeInfo, error) { + + info, err := c.DescribeInstanceType(machineType) + if err != nil { + return nil, err + } + machine := AWSMachineTypeInfo{ + Name: machineType, + GPU: info.GpuInfo != nil, + InstanceENIs: intValue(info.NetworkInfo.MaximumNetworkInterfaces), + InstanceIPsPerENI: intValue(info.NetworkInfo.Ipv4AddressesPerInterface), + } + memoryGB := float64(intValue(info.MemoryInfo.SizeInMiB)) / 1024 + machine.MemoryGB = float32(math.Round(memoryGB*100) / 100) + + if info.VCpuInfo != nil && info.VCpuInfo.DefaultVCpus != nil { + machine.Cores = intValue(info.VCpuInfo.DefaultVCpus) + } + if info.InstanceStorageInfo != nil && len(info.InstanceStorageInfo.Disks) > 0 { + disks := make([]int, 0) + for _, disk := range info.InstanceStorageInfo.Disks { + for i := 0; i < intValue(disk.Count); i++ { + disks = append(disks, intValue(disk.SizeInGB)) + } } + machine.EphemeralDisks = disks } - return nil, fmt.Errorf("instance type not handled: %q", machineType) + return &machine, nil } -var MachineTypes []AWSMachineTypeInfo = []AWSMachineTypeInfo{ - // This is tedious, but seems simpler than trying to have some logic and then a lot of exceptions - - // NOTE: Content below is auto generated by `make update-machine-types` - // BEGIN GENERATED CONTENT - - // a1 family - { - Name: "a1.medium", - MemoryGB: 2, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 4, - EphemeralDisks: nil, - }, - - { - Name: "a1.large", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "a1.xlarge", - MemoryGB: 8, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "a1.2xlarge", - MemoryGB: 16, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "a1.4xlarge", - MemoryGB: 32, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "a1.metal", - MemoryGB: 32, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - // c1 family - { - Name: "c1.medium", - MemoryGB: 1.7, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 6, - EphemeralDisks: []int{350}, - }, - - { - Name: "c1.xlarge", - MemoryGB: 7, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{420, 420, 420, 420}, - }, - - // c3 family - { - Name: "c3.large", - MemoryGB: 3.75, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{16, 16}, - }, - - { - Name: "c3.xlarge", - MemoryGB: 7.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{40, 40}, - }, - - { - Name: "c3.2xlarge", - MemoryGB: 15, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{80, 80}, - }, - - { - Name: "c3.4xlarge", - MemoryGB: 30, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{160, 160}, - }, - - { - Name: "c3.8xlarge", - MemoryGB: 60, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{320, 320}, - }, - - // c4 family - { - Name: "c4.large", - MemoryGB: 3.75, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "c4.xlarge", - MemoryGB: 7.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c4.2xlarge", - MemoryGB: 15, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c4.4xlarge", - MemoryGB: 30, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c4.8xlarge", - MemoryGB: 60, - Cores: 36, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - // c5 family - { - Name: "c5.large", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "c5.xlarge", - MemoryGB: 8, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c5.2xlarge", - MemoryGB: 16, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c5.4xlarge", - MemoryGB: 32, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c5.9xlarge", - MemoryGB: 72, - Cores: 36, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c5.12xlarge", - MemoryGB: 96, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c5.18xlarge", - MemoryGB: 144, - Cores: 72, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "c5.24xlarge", - MemoryGB: 192, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "c5.metal", - MemoryGB: 192, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // c5d family - { - Name: "c5d.large", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{50}, - }, - - { - Name: "c5d.xlarge", - MemoryGB: 8, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{100}, - }, - - { - Name: "c5d.2xlarge", - MemoryGB: 16, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{200}, - }, - - { - Name: "c5d.4xlarge", - MemoryGB: 32, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{400}, - }, - - { - Name: "c5d.9xlarge", - MemoryGB: 72, - Cores: 36, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900}, - }, - - { - Name: "c5d.12xlarge", - MemoryGB: 96, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "c5d.18xlarge", - MemoryGB: 144, - Cores: 72, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "c5d.24xlarge", - MemoryGB: 192, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - { - Name: "c5d.metal", - MemoryGB: 192, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // c5n family - { - Name: "c5n.large", - MemoryGB: 5.25, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "c5n.xlarge", - MemoryGB: 10.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c5n.2xlarge", - MemoryGB: 21, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "c5n.4xlarge", - MemoryGB: 42, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c5n.9xlarge", - MemoryGB: 96, - Cores: 36, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "c5n.18xlarge", - MemoryGB: 192, - Cores: 72, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "c5n.metal", - MemoryGB: 192, - Cores: 72, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // cc2 family - { - Name: "cc2.8xlarge", - MemoryGB: 60.5, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{840, 840, 840, 840}, - }, - - // cr1 family - { - Name: "cr1.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{120, 120}, - }, - - // d2 family - { - Name: "d2.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{2048, 2048, 2048}, - }, - - { - Name: "d2.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{2048, 2048, 2048, 2048, 2048, 2048}, - }, - - { - Name: "d2.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048}, - }, - - { - Name: "d2.8xlarge", - MemoryGB: 244, - Cores: 36, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048}, - }, - - // f1 family - { - Name: "f1.2xlarge", - MemoryGB: 122, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{470}, - }, - - { - Name: "f1.4xlarge", - MemoryGB: 244, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{940}, - }, - - { - Name: "f1.16xlarge", - MemoryGB: 976, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{940, 940, 940, 940}, - }, - - // g2 family - { - Name: "g2.2xlarge", - MemoryGB: 15, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{60}, - GPU: true, - }, - - { - Name: "g2.8xlarge", - MemoryGB: 60, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{120, 120}, - GPU: true, - }, - - // g3 family - { - Name: "g3.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "g3.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "g3.16xlarge", - MemoryGB: 488, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - GPU: true, - }, - - // g3s family - { - Name: "g3s.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - GPU: true, - }, - - // g4dn family - { - Name: "g4dn.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{125}, - GPU: true, - }, - - { - Name: "g4dn.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{225}, - GPU: true, - }, - - { - Name: "g4dn.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{225}, - GPU: true, - }, - - { - Name: "g4dn.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{900}, - GPU: true, - }, - - { - Name: "g4dn.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900}, - GPU: true, - }, - - { - Name: "g4dn.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{900}, - GPU: true, - }, - - // h1 family - { - Name: "h1.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{2000}, - }, - - { - Name: "h1.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2000, 2000}, - }, - - { - Name: "h1.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2000, 2000, 2000, 2000}, - }, - - { - Name: "h1.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000}, - }, - - // hs1 family - { - Name: "hs1.8xlarge", - MemoryGB: 117, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000}, - }, - - // i2 family - { - Name: "i2.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{800}, - }, - - { - Name: "i2.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{800, 800}, - }, - - { - Name: "i2.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{800, 800, 800, 800}, - }, - - { - Name: "i2.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{800, 800, 800, 800, 800, 800, 800, 800}, - }, - - // i3 family - { - Name: "i3.large", - MemoryGB: 15.25, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{475}, - }, - - { - Name: "i3.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{950}, - }, - - { - Name: "i3.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{1900}, - }, - - { - Name: "i3.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1900, 1900}, - }, - - { - Name: "i3.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1900, 1900, 1900, 1900}, - }, - - { - Name: "i3.16xlarge", - MemoryGB: 488, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900}, - }, - - { - Name: "i3.metal", - MemoryGB: 512, - Cores: 72, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900}, - }, - - // i3en family - { - Name: "i3en.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{1250}, - }, - - { - Name: "i3en.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{2500}, - }, - - { - Name: "i3en.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{2500, 2500}, - }, - - { - Name: "i3en.3xlarge", - MemoryGB: 96, - Cores: 12, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{7500}, - }, - - { - Name: "i3en.6xlarge", - MemoryGB: 192, - Cores: 24, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{7500, 7500}, - }, - - { - Name: "i3en.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{7500, 7500, 7500, 7500}, - }, - - { - Name: "i3en.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{7500, 7500, 7500, 7500, 7500, 7500, 7500, 7500}, - }, - - { - Name: "i3en.metal", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{7500, 7500, 7500, 7500, 7500, 7500, 7500, 7500}, - }, - - // inf1 family - { - Name: "inf1.xlarge", - MemoryGB: 8, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "inf1.2xlarge", - MemoryGB: 16, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "inf1.6xlarge", - MemoryGB: 48, - Cores: 24, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "inf1.24xlarge", - MemoryGB: 192, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - // m1 family - { - Name: "m1.small", - MemoryGB: 1.7, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 4, - EphemeralDisks: []int{160}, - }, - - { - Name: "m1.medium", - MemoryGB: 3.7, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 6, - EphemeralDisks: []int{410}, - }, - - { - Name: "m1.large", - MemoryGB: 7.5, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{420, 420}, - }, - - { - Name: "m1.xlarge", - MemoryGB: 15, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{420, 420, 420, 420}, - }, - - // m2 family - { - Name: "m2.xlarge", - MemoryGB: 17.1, - Cores: 2, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{420}, - }, - - { - Name: "m2.2xlarge", - MemoryGB: 34.2, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{850}, - }, - - { - Name: "m2.4xlarge", - MemoryGB: 68.4, - Cores: 8, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{840, 840}, - }, - - // m3 family - { - Name: "m3.medium", - MemoryGB: 3.75, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 6, - EphemeralDisks: []int{4}, - }, - - { - Name: "m3.large", - MemoryGB: 7.5, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{32}, - }, - - { - Name: "m3.xlarge", - MemoryGB: 15, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{40, 40}, - }, - - { - Name: "m3.2xlarge", - MemoryGB: 30, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{80, 80}, - }, - - // m4 family - { - Name: "m4.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "m4.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m4.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m4.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m4.10xlarge", - MemoryGB: 160, - Cores: 40, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m4.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - // m5 family - { - Name: "m5.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "m5.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "m5.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "m5.metal", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // m5a family - { - Name: "m5a.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "m5a.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5a.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5a.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5a.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5a.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5a.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "m5a.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // m5ad family - { - Name: "m5ad.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "m5ad.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "m5ad.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "m5ad.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "m5ad.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "m5ad.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // m5d family - { - Name: "m5d.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "m5d.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "m5d.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "m5d.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "m5d.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{600, 600}, - }, - - { - Name: "m5d.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "m5d.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{600, 600, 600, 600}, - }, - - { - Name: "m5d.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - { - Name: "m5d.metal", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // m5dn family - { - Name: "m5dn.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "m5dn.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "m5dn.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "m5dn.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "m5dn.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{600, 600}, - }, - - { - Name: "m5dn.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "m5dn.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{600, 600, 600, 600}, - }, - - { - Name: "m5dn.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // m5n family - { - Name: "m5n.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "m5n.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5n.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "m5n.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5n.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5n.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "m5n.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "m5n.24xlarge", - MemoryGB: 384, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // m6g family - { - Name: "m6g.medium", - MemoryGB: 4, - Cores: 1, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.4xlarge", - MemoryGB: 64, - Cores: 16, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.8xlarge", - MemoryGB: 128, - Cores: 32, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.12xlarge", - MemoryGB: 192, - Cores: 48, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - { - Name: "m6g.16xlarge", - MemoryGB: 256, - Cores: 64, - InstanceENIs: 0, - InstanceIPsPerENI: 0, - EphemeralDisks: nil, - }, - - // p2 family - { - Name: "p2.xlarge", - MemoryGB: 61, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "p2.8xlarge", - MemoryGB: 488, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "p2.16xlarge", - MemoryGB: 732, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - // p3 family - { - Name: "p3.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "p3.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - { - Name: "p3.16xlarge", - MemoryGB: 488, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - GPU: true, - }, - - // p3dn family - { - Name: "p3dn.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900}, - GPU: true, - }, - - // r3 family - { - Name: "r3.large", - MemoryGB: 15, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{32}, - }, - - { - Name: "r3.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{80}, - }, - - { - Name: "r3.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{160}, - }, - - { - Name: "r3.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{320}, - }, - - { - Name: "r3.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{320, 320}, - }, - - // r4 family - { - Name: "r4.large", - MemoryGB: 15.25, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "r4.xlarge", - MemoryGB: 30.5, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r4.2xlarge", - MemoryGB: 61, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r4.4xlarge", - MemoryGB: 122, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r4.8xlarge", - MemoryGB: 244, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r4.16xlarge", - MemoryGB: 488, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // r5 family - { - Name: "r5.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "r5.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5.8xlarge", - MemoryGB: 256, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5.16xlarge", - MemoryGB: 512, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "r5.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "r5.metal", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // r5a family - { - Name: "r5a.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "r5a.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5a.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5a.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5a.8xlarge", - MemoryGB: 256, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5a.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5a.16xlarge", - MemoryGB: 512, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "r5a.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // r5ad family - { - Name: "r5ad.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "r5ad.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "r5ad.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "r5ad.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "r5ad.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "r5ad.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // r5d family - { - Name: "r5d.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "r5d.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "r5d.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "r5d.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "r5d.8xlarge", - MemoryGB: 256, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{600, 600}, - }, - - { - Name: "r5d.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "r5d.16xlarge", - MemoryGB: 512, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{600, 600, 600, 600}, - }, - - { - Name: "r5d.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - { - Name: "r5d.metal", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // r5dn family - { - Name: "r5dn.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "r5dn.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "r5dn.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "r5dn.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{300, 300}, - }, - - { - Name: "r5dn.8xlarge", - MemoryGB: 256, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{600, 600}, - }, - - { - Name: "r5dn.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "r5dn.16xlarge", - MemoryGB: 512, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{600, 600, 600, 600}, - }, - - { - Name: "r5dn.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900, 900, 900}, - }, - - // r5n family - { - Name: "r5n.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: nil, - }, - - { - Name: "r5n.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5n.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "r5n.4xlarge", - MemoryGB: 128, - Cores: 16, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5n.8xlarge", - MemoryGB: 256, - Cores: 32, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5n.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: nil, - }, - - { - Name: "r5n.16xlarge", - MemoryGB: 512, - Cores: 64, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - { - Name: "r5n.24xlarge", - MemoryGB: 768, - Cores: 96, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: nil, - }, - - // t1 family - { - Name: "t1.micro", - MemoryGB: 0.61, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - // t2 family - { - Name: "t2.nano", - MemoryGB: 0.5, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t2.micro", - MemoryGB: 1, - Cores: 1, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t2.small", - MemoryGB: 2, - Cores: 1, - InstanceENIs: 3, - InstanceIPsPerENI: 4, - EphemeralDisks: nil, - }, - - { - Name: "t2.medium", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 6, - EphemeralDisks: nil, - }, - - { - Name: "t2.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 12, - EphemeralDisks: nil, - }, - - { - Name: "t2.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 3, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "t2.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 3, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - // t3 family - { - Name: "t3.nano", - MemoryGB: 0.5, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t3.micro", - MemoryGB: 1, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t3.small", - MemoryGB: 2, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 4, - EphemeralDisks: nil, - }, - - { - Name: "t3.medium", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 6, - EphemeralDisks: nil, - }, - - { - Name: "t3.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 12, - EphemeralDisks: nil, - }, - - { - Name: "t3.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "t3.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - // t3a family - { - Name: "t3a.nano", - MemoryGB: 0.5, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t3a.micro", - MemoryGB: 1, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 2, - EphemeralDisks: nil, - }, - - { - Name: "t3a.small", - MemoryGB: 2, - Cores: 2, - InstanceENIs: 2, - InstanceIPsPerENI: 4, - EphemeralDisks: nil, - }, - - { - Name: "t3a.medium", - MemoryGB: 4, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 6, - EphemeralDisks: nil, - }, - - { - Name: "t3a.large", - MemoryGB: 8, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 12, - EphemeralDisks: nil, - }, - - { - Name: "t3a.xlarge", - MemoryGB: 16, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - { - Name: "t3a.2xlarge", - MemoryGB: 32, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: nil, - }, - - // x1 family - { - Name: "x1.16xlarge", - MemoryGB: 976, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1920}, - }, - - { - Name: "x1.32xlarge", - MemoryGB: 1952, - Cores: 128, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1920, 1920}, - }, - - // x1e family - { - Name: "x1e.xlarge", - MemoryGB: 122, - Cores: 4, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{120}, - }, - - { - Name: "x1e.2xlarge", - MemoryGB: 244, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{240}, - }, - - { - Name: "x1e.4xlarge", - MemoryGB: 488, - Cores: 16, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{480}, - }, - - { - Name: "x1e.8xlarge", - MemoryGB: 976, - Cores: 32, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{960}, - }, - - { - Name: "x1e.16xlarge", - MemoryGB: 1952, - Cores: 64, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1920}, - }, - - { - Name: "x1e.32xlarge", - MemoryGB: 3904, - Cores: 128, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{1920, 1920}, - }, - - // z1d family - { - Name: "z1d.large", - MemoryGB: 16, - Cores: 2, - InstanceENIs: 3, - InstanceIPsPerENI: 10, - EphemeralDisks: []int{75}, - }, - - { - Name: "z1d.xlarge", - MemoryGB: 32, - Cores: 4, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{150}, - }, - - { - Name: "z1d.2xlarge", - MemoryGB: 64, - Cores: 8, - InstanceENIs: 4, - InstanceIPsPerENI: 15, - EphemeralDisks: []int{300}, - }, - - { - Name: "z1d.3xlarge", - MemoryGB: 96, - Cores: 12, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{450}, - }, - - { - Name: "z1d.6xlarge", - MemoryGB: 192, - Cores: 24, - InstanceENIs: 8, - InstanceIPsPerENI: 30, - EphemeralDisks: []int{900}, - }, - - { - Name: "z1d.12xlarge", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900}, - }, - - { - Name: "z1d.metal", - MemoryGB: 384, - Cores: 48, - InstanceENIs: 15, - InstanceIPsPerENI: 50, - EphemeralDisks: []int{900, 900}, - }, - - // END GENERATED CONTENT +func intValue(v *int64) int { + return int(aws.Int64Value(v)) } diff --git a/upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go b/upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go index eee779b84b588..c67b629a76d65 100644 --- a/upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go @@ -270,3 +270,8 @@ func (c *MockAWSCloud) DefaultInstanceType(cluster *kops.Cluster, ig *kops.Insta return "", fmt.Errorf("MockAWSCloud DefaultInstanceType does not handle %s", ig.Spec.Role) } } + +// DescribeInstanceType calls ec2.DescribeInstanceType to get information for a particular instance type +func (c *MockAWSCloud) DescribeInstanceType(instanceType string) (*ec2.InstanceTypeInfo, error) { + return describeInstanceType(c, instanceType) +} diff --git a/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go b/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go index f632d3c64322b..297684c8bef71 100644 --- a/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go +++ b/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go @@ -502,7 +502,7 @@ func (_ *Elastigroup) create(cloud awsup.AWSCloud, a, e, changes *Elastigroup) e return err } - ephemeralDevices, err := e.buildEphemeralDevices(e.OnDemandInstanceType) + ephemeralDevices, err := e.buildEphemeralDevices(cloud, e.OnDemandInstanceType) if err != nil { return err } @@ -912,7 +912,7 @@ func (_ *Elastigroup) update(cloud awsup.AWSCloud, a, e, changes *Elastigroup) e return err } - ephemeralDevices, err := e.buildEphemeralDevices(e.OnDemandInstanceType) + ephemeralDevices, err := e.buildEphemeralDevices(cloud, e.OnDemandInstanceType) if err != nil { return err } @@ -1446,7 +1446,7 @@ func (_ *Elastigroup) RenderTerraform(t *terraform.TerraformTarget, a, e, change return err } - ephemeralDevices, err := e.buildEphemeralDevices(e.OnDemandInstanceType) + ephemeralDevices, err := e.buildEphemeralDevices(cloud, e.OnDemandInstanceType) if err != nil { return err } @@ -1589,12 +1589,12 @@ func (e *Elastigroup) buildAutoScaleLabels(labelsMap map[string]string) []*aws.A return labels } -func (e *Elastigroup) buildEphemeralDevices(instanceTypeName *string) (map[string]*awstasks.BlockDeviceMapping, error) { +func (e *Elastigroup) buildEphemeralDevices(c awsup.AWSCloud, instanceTypeName *string) (map[string]*awstasks.BlockDeviceMapping, error) { if instanceTypeName == nil { return nil, fi.RequiredField("InstanceType") } - instanceType, err := awsup.GetMachineTypeInfo(*instanceTypeName) + instanceType, err := awsup.GetMachineTypeInfo(c, *instanceTypeName) if err != nil { return nil, err }