diff --git a/hack/generate-instance-store-table.sh b/hack/generate-instance-store-table.sh new file mode 100755 index 0000000000..b4b4417e33 --- /dev/null +++ b/hack/generate-instance-store-table.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2023 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. + +# Generates instance store table for `pkg/cloud/volume_limits.go` from the AWS API +# Ensure you are opted into all opt-in regions before running +# Ensure your account isn't in any private instance type betas before running + +set -euo pipefail + +BIN="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../bin" + +function get_instance_stores_for_region() { + REGION="${1}" + echo "Getting limits for ${REGION}..." >&2 + "${BIN}/aws" ec2 describe-instance-types --region "${REGION}" --filters "Name=instance-storage-supported,Values=true" --query "InstanceTypes[].[InstanceType, InstanceStorageInfo]" | + jq -r 'map("\"" + .[0] + "\": " + (.[1].Disks | map(.Count) | add | tostring) + ",") | .[]' +} + +function get_all_instance_stores() { + "${BIN}/aws" account list-regions --max-results 50 | jq -r '.Regions | map(.RegionName) | .[]' | while read REGION; do + get_instance_stores_for_region $REGION + done +} + +get_all_instance_stores | sort | uniq diff --git a/pkg/cloud/volume_limits.go b/pkg/cloud/volume_limits.go index 0884cd8e70..ced91717aa 100644 --- a/pkg/cloud/volume_limits.go +++ b/pkg/cloud/volume_limits.go @@ -131,215 +131,337 @@ func GetNVMeInstanceStoreVolumesForInstanceType(it string) int { return 0 } -// / https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes +// / https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-store-volumes.html // / IMDS does not provide NVMe instance store data; we'll just list all instances here // / TODO: See if we can get these values from DescribeInstanceTypes API var nvmeInstanceStoreVolumes = map[string]int{ - "c5ad.large": 1, - "c5ad.xlarge": 1, - "c5ad.2xlarge": 1, - "c5ad.4xlarge": 2, - "c5ad.8xlarge": 2, - "c5ad.12xlarge": 2, - "c5ad.16xlarge": 2, - "c5ad.24xlarge": 2, - "c5d.large": 1, - "c5d.xlarge": 1, - "c5d.2xlarge": 1, - "c5d.4xlarge": 1, - "c5d.9xlarge": 1, - "c5d.12xlarge": 2, - "c5d.18xlarge": 2, - "c5d.24xlarge": 4, - "c5d.metal": 4, - "c6gd.medium": 1, - "c6gd.large": 1, - "c6gd.xlarge": 1, - "c6gd.2xlarge": 1, - "c6gd.4xlarge": 1, - "c6gd.8xlarge": 1, - "c6gd.12xlarge": 2, - "c6gd.16xlarge": 2, - "c6gd.metal": 2, - "c6id.large": 1, - "c6id.xlarge": 1, - "c6id.2xlarge": 1, - "c6id.4xlarge": 1, - "c6id.8xlarge": 1, - "c6id.12xlarge": 2, - "c6id.16xlarge": 2, - "c6id.24xlarge": 4, - "c6id.32xlarge": 4, - "c6id.metal": 4, - "dl1.24xlarge": 4, - "f1.2xlarge": 1, - "f1.4xlarge": 1, - "f1.16xlarge": 4, - "g4ad.xlarge": 1, - "g4ad.2xlarge": 1, - "g4ad.4xlarge": 1, - "g4ad.8xlarge": 1, - "g4ad.16xlarge": 2, - "g4dn.xlarge": 1, - "g4dn.2xlarge": 1, - "g4dn.4xlarge": 1, - "g4dn.8xlarge": 1, - "g4dn.12xlarge": 1, - "g4dn.16xlarge": 1, - "g4dn.metal": 2, - "g5.xlarge": 1, - "g5.2xlarge": 1, - "g5.4xlarge": 1, - "g5.8xlarge": 1, - "g5.12xlarge": 1, - "g5.16xlarge": 1, - "g5.24xlarge": 1, - "g5.48xlarge": 2, - "i3.large": 1, - "i3.xlarge": 1, - "i3.2xlarge": 1, - "i3.4xlarge": 2, - "i3.8xlarge": 4, - "i3.16xlarge": 8, - "i3.metal": 8, - "i3en.large": 1, - "i3en.xlarge": 1, - "i3en.2xlarge": 2, - "i3en.3xlarge": 1, - "i3en.6xlarge": 2, - "i3en.12xlarge": 4, - "i3en.24xlarge": 8, - "i3en.metal": 8, - "i4i.large": 1, - "i4i.xlarge": 1, - "i4i.2xlarge": 1, - "i4i.4xlarge": 1, - "i4i.8xlarge": 2, - "i4i.16xlarge": 4, - "i4i.32xlarge": 8, - "i4i.metal": 8, - "im4gn.large": 1, - "im4gn.xlarge": 1, - "im4gn.2xlarge": 1, - "im4gn.4xlarge": 1, - "im4gn.8xlarge": 2, - "im4gn.16xlarge": 4, - "is4gen.medium": 1, - "is4gen.large": 1, - "is4gen.xlarge": 1, - "is4gen.2xlarge": 1, - "is4gen.4xlarge": 2, - "is4gen.8xlarge": 4, - "m5ad.large": 1, - "m5ad.xlarge": 1, - "m5ad.2xlarge": 1, - "m5ad.4xlarge": 2, - "m5ad.8xlarge": 2, - "m5ad.12xlarge": 2, - "m5ad.16xlarge": 4, - "m5ad.24xlarge": 4, - "m5d.large": 1, - "m5d.xlarge": 1, - "m5d.2xlarge": 1, - "m5d.4xlarge": 2, - "m5d.8xlarge": 2, - "m5d.12xlarge": 2, - "m5d.16xlarge": 4, - "m5d.24xlarge": 4, - "m5d.metal": 4, - "m5dn.large": 1, - "m5dn.xlarge": 1, - "m5dn.2xlarge": 1, - "m5dn.4xlarge": 2, - "m5dn.8xlarge": 2, - "m5dn.12xlarge": 2, - "m5dn.16xlarge": 4, - "m5dn.24xlarge": 4, - "m5dn.metal": 4, - "m6gd.medium": 1, - "m6gd.large": 1, - "m6gd.xlarge": 1, - "m6gd.2xlarge": 1, - "m6gd.4xlarge": 1, - "m6gd.8xlarge": 1, - "m6gd.12xlarge": 2, - "m6gd.16xlarge": 2, - "m6gd.metal": 2, - "m6id.large": 1, - "m6id.xlarge": 1, - "m6id.2xlarge": 1, - "m6id.4xlarge": 1, - "m6id.8xlarge": 1, - "m6id.12xlarge": 2, - "m6id.16xlarge": 2, - "m6id.24xlarge": 4, - "m6id.32xlarge": 4, - "m6id.metal": 4, - "p3dn.24xlarge": 2, - "p4d.24xlarge": 8, - "r5ad.large": 1, - "r5ad.xlarge": 1, - "r5ad.2xlarge": 1, - "r5ad.4xlarge": 2, - "r5ad.8xlarge": 2, - "r5ad.12xlarge": 2, - "r5ad.16xlarge": 4, - "r5ad.24xlarge": 4, - "r5d.large": 1, - "r5d.xlarge": 1, - "r5d.2xlarge": 1, - "r5d.4xlarge": 2, - "r5d.8xlarge": 2, - "r5d.12xlarge": 2, - "r5d.16xlarge": 4, - "r5d.24xlarge": 4, - "r5d.metal": 4, - "r5dn.large": 1, - "r5dn.xlarge": 1, - "r5dn.2xlarge": 1, - "r5dn.4xlarge": 2, - "r5dn.8xlarge": 2, - "r5dn.12xlarge": 2, - "r5dn.16xlarge": 4, - "r5dn.24xlarge": 4, - "r5dn.metal": 4, - "r6gd.medium": 1, - "r6gd.large": 1, - "r6gd.xlarge": 1, - "r6gd.2xlarge": 1, - "r6gd.4xlarge": 1, - "r6gd.8xlarge": 1, - "r6gd.12xlarge": 2, - "r6gd.16xlarge": 2, - "r6gd.metal": 2, - "r6id.large": 1, - "r6id.xlarge": 1, - "r6id.2xlarge": 1, - "r6id.4xlarge": 1, - "r6id.8xlarge": 1, - "r6id.12xlarge": 2, - "r6id.16xlarge": 2, - "r6id.24xlarge": 4, - "r6id.32xlarge": 4, - "r6id.metal": 4, - "x2gd.medium": 1, - "x2gd.large": 1, - "x2gd.xlarge": 1, - "x2gd.2xlarge": 1, - "x2gd.4xlarge": 1, - "x2gd.8xlarge": 1, - "x2gd.12xlarge": 2, - "x2gd.16xlarge": 2, - "x2gd.metal": 2, - "x2idn.16xlarge": 1, - "x2idn.24xlarge": 2, - "x2idn.32xlarge": 2, - "x2idn.metal": 2, - "z1d.large": 1, - "z1d.xlarge": 1, - "z1d.2xlarge": 1, - "z1d.3xlarge": 1, - "z1d.6xlarge": 1, - "z1d.12xlarge": 2, - "z1d.metal": 2, + "c1.medium": 1, + "c1.xlarge": 4, + "c3.2xlarge": 2, + "c3.4xlarge": 2, + "c3.8xlarge": 2, + "c3.large": 2, + "c3.xlarge": 2, + "c5ad.12xlarge": 2, + "c5ad.16xlarge": 2, + "c5ad.24xlarge": 2, + "c5ad.2xlarge": 1, + "c5ad.4xlarge": 2, + "c5ad.8xlarge": 2, + "c5ad.large": 1, + "c5ad.xlarge": 1, + "c5d.12xlarge": 2, + "c5d.18xlarge": 2, + "c5d.24xlarge": 4, + "c5d.2xlarge": 1, + "c5d.4xlarge": 1, + "c5d.9xlarge": 1, + "c5d.large": 1, + "c5d.metal": 4, + "c5d.xlarge": 1, + "c6gd.12xlarge": 2, + "c6gd.16xlarge": 2, + "c6gd.2xlarge": 1, + "c6gd.4xlarge": 1, + "c6gd.8xlarge": 1, + "c6gd.large": 1, + "c6gd.medium": 1, + "c6gd.metal": 2, + "c6gd.xlarge": 1, + "c6id.12xlarge": 2, + "c6id.16xlarge": 2, + "c6id.24xlarge": 4, + "c6id.2xlarge": 1, + "c6id.32xlarge": 4, + "c6id.4xlarge": 1, + "c6id.8xlarge": 1, + "c6id.large": 1, + "c6id.metal": 4, + "c6id.xlarge": 1, + "c7gd.12xlarge": 2, + "c7gd.16xlarge": 2, + "c7gd.2xlarge": 1, + "c7gd.4xlarge": 1, + "c7gd.8xlarge": 1, + "c7gd.large": 1, + "c7gd.medium": 1, + "c7gd.metal": 2, + "c7gd.xlarge": 1, + "d2.2xlarge": 6, + "d2.4xlarge": 12, + "d2.8xlarge": 24, + "d2.xlarge": 3, + "d3.2xlarge": 6, + "d3.4xlarge": 12, + "d3.8xlarge": 24, + "d3en.12xlarge": 24, + "d3en.2xlarge": 4, + "d3en.4xlarge": 8, + "d3en.6xlarge": 12, + "d3en.8xlarge": 16, + "d3en.xlarge": 2, + "d3.xlarge": 3, + "dl1.24xlarge": 4, + "f1.16xlarge": 4, + "f1.2xlarge": 1, + "f1.4xlarge": 1, + "g4ad.16xlarge": 2, + "g4ad.2xlarge": 1, + "g4ad.4xlarge": 1, + "g4ad.8xlarge": 1, + "g4ad.xlarge": 1, + "g4dn.12xlarge": 1, + "g4dn.16xlarge": 1, + "g4dn.2xlarge": 1, + "g4dn.4xlarge": 1, + "g4dn.8xlarge": 1, + "g4dn.metal": 2, + "g4dn.xlarge": 1, + "g5.12xlarge": 1, + "g5.16xlarge": 1, + "g5.24xlarge": 1, + "g5.2xlarge": 1, + "g5.48xlarge": 2, + "g5.4xlarge": 1, + "g5.8xlarge": 1, + "g5.xlarge": 1, + "h1.16xlarge": 8, + "h1.2xlarge": 1, + "h1.4xlarge": 2, + "h1.8xlarge": 4, + "hpc6id.32xlarge": 4, + "i2.2xlarge": 2, + "i2.4xlarge": 4, + "i2.8xlarge": 8, + "i2.xlarge": 1, + "i3.16xlarge": 8, + "i3.2xlarge": 1, + "i3.4xlarge": 2, + "i3.8xlarge": 4, + "i3en.12xlarge": 4, + "i3en.24xlarge": 8, + "i3en.2xlarge": 2, + "i3en.3xlarge": 1, + "i3en.6xlarge": 2, + "i3en.large": 1, + "i3en.metal": 8, + "i3en.xlarge": 1, + "i3.large": 1, + "i3.metal": 8, + "i3.xlarge": 1, + "i4g.16xlarge": 4, + "i4g.2xlarge": 1, + "i4g.4xlarge": 1, + "i4g.8xlarge": 2, + "i4g.large": 1, + "i4g.xlarge": 1, + "i4i.12xlarge": 3, + "i4i.16xlarge": 4, + "i4i.24xlarge": 6, + "i4i.2xlarge": 1, + "i4i.32xlarge": 8, + "i4i.4xlarge": 1, + "i4i.8xlarge": 2, + "i4i.large": 1, + "i4i.metal": 8, + "i4i.xlarge": 1, + "im4gn.16xlarge": 4, + "im4gn.2xlarge": 1, + "im4gn.4xlarge": 1, + "im4gn.8xlarge": 2, + "im4gn.large": 1, + "im4gn.xlarge": 1, + "is4gen.2xlarge": 1, + "is4gen.4xlarge": 2, + "is4gen.8xlarge": 4, + "is4gen.large": 1, + "is4gen.medium": 1, + "is4gen.xlarge": 1, + "m1.large": 2, + "m1.medium": 1, + "m1.small": 1, + "m1.xlarge": 4, + "m2.2xlarge": 1, + "m2.4xlarge": 2, + "m2.xlarge": 1, + "m3.2xlarge": 2, + "m3.large": 1, + "m3.medium": 1, + "m3.xlarge": 2, + "m5ad.12xlarge": 2, + "m5ad.16xlarge": 4, + "m5ad.24xlarge": 4, + "m5ad.2xlarge": 1, + "m5ad.4xlarge": 2, + "m5ad.8xlarge": 2, + "m5ad.large": 1, + "m5ad.xlarge": 1, + "m5d.12xlarge": 2, + "m5d.16xlarge": 4, + "m5d.24xlarge": 4, + "m5d.2xlarge": 1, + "m5d.4xlarge": 2, + "m5d.8xlarge": 2, + "m5d.large": 1, + "m5d.metal": 4, + "m5dn.12xlarge": 2, + "m5dn.16xlarge": 4, + "m5dn.24xlarge": 4, + "m5dn.2xlarge": 1, + "m5dn.4xlarge": 2, + "m5dn.8xlarge": 2, + "m5dn.large": 1, + "m5dn.metal": 4, + "m5dn.xlarge": 1, + "m5d.xlarge": 1, + "m6gd.12xlarge": 2, + "m6gd.16xlarge": 2, + "m6gd.2xlarge": 1, + "m6gd.4xlarge": 1, + "m6gd.8xlarge": 1, + "m6gd.large": 1, + "m6gd.medium": 1, + "m6gd.metal": 2, + "m6gd.xlarge": 1, + "m6id.12xlarge": 2, + "m6id.16xlarge": 2, + "m6id.24xlarge": 4, + "m6id.2xlarge": 1, + "m6id.32xlarge": 4, + "m6id.4xlarge": 1, + "m6id.8xlarge": 1, + "m6id.large": 1, + "m6id.metal": 4, + "m6idn.12xlarge": 2, + "m6idn.16xlarge": 2, + "m6idn.24xlarge": 4, + "m6idn.2xlarge": 1, + "m6idn.32xlarge": 4, + "m6idn.4xlarge": 1, + "m6idn.8xlarge": 1, + "m6idn.large": 1, + "m6idn.metal": 4, + "m6idn.xlarge": 1, + "m6id.xlarge": 1, + "m7gd.12xlarge": 2, + "m7gd.16xlarge": 2, + "m7gd.2xlarge": 1, + "m7gd.4xlarge": 1, + "m7gd.8xlarge": 1, + "m7gd.large": 1, + "m7gd.medium": 1, + "m7gd.metal": 2, + "m7gd.xlarge": 1, + "p3dn.24xlarge": 2, + "p4d.24xlarge": 8, + "p4de.24xlarge": 8, + "p5.48xlarge": 8, + "r3.2xlarge": 1, + "r3.4xlarge": 1, + "r3.8xlarge": 2, + "r3.large": 1, + "r3.xlarge": 1, + "r5ad.12xlarge": 2, + "r5ad.16xlarge": 4, + "r5ad.24xlarge": 4, + "r5ad.2xlarge": 1, + "r5ad.4xlarge": 2, + "r5ad.8xlarge": 2, + "r5ad.large": 1, + "r5ad.xlarge": 1, + "r5d.12xlarge": 2, + "r5d.16xlarge": 4, + "r5d.24xlarge": 4, + "r5d.2xlarge": 1, + "r5d.4xlarge": 2, + "r5d.8xlarge": 2, + "r5d.large": 1, + "r5d.metal": 4, + "r5dn.12xlarge": 2, + "r5dn.16xlarge": 4, + "r5dn.24xlarge": 4, + "r5dn.2xlarge": 1, + "r5dn.4xlarge": 2, + "r5dn.8xlarge": 2, + "r5dn.large": 1, + "r5dn.metal": 4, + "r5dn.xlarge": 1, + "r5d.xlarge": 1, + "r6gd.12xlarge": 2, + "r6gd.16xlarge": 2, + "r6gd.2xlarge": 1, + "r6gd.4xlarge": 1, + "r6gd.8xlarge": 1, + "r6gd.large": 1, + "r6gd.medium": 1, + "r6gd.metal": 2, + "r6gd.xlarge": 1, + "r6id.12xlarge": 2, + "r6id.16xlarge": 2, + "r6id.24xlarge": 4, + "r6id.2xlarge": 1, + "r6id.32xlarge": 4, + "r6id.4xlarge": 1, + "r6id.8xlarge": 1, + "r6id.large": 1, + "r6id.metal": 4, + "r6idn.12xlarge": 2, + "r6idn.16xlarge": 2, + "r6idn.24xlarge": 4, + "r6idn.2xlarge": 1, + "r6idn.32xlarge": 4, + "r6idn.4xlarge": 1, + "r6idn.8xlarge": 1, + "r6idn.large": 1, + "r6idn.metal": 4, + "r6idn.xlarge": 1, + "r6id.xlarge": 1, + "r7gd.12xlarge": 2, + "r7gd.16xlarge": 2, + "r7gd.2xlarge": 1, + "r7gd.4xlarge": 1, + "r7gd.8xlarge": 1, + "r7gd.large": 1, + "r7gd.medium": 1, + "r7gd.metal": 2, + "r7gd.xlarge": 1, + "trn1.2xlarge": 1, + "trn1.32xlarge": 4, + "trn1n.32xlarge": 4, + "x1.16xlarge": 1, + "x1.32xlarge": 2, + "x1e.16xlarge": 1, + "x1e.2xlarge": 1, + "x1e.32xlarge": 2, + "x1e.4xlarge": 1, + "x1e.8xlarge": 1, + "x1e.xlarge": 1, + "x2gd.12xlarge": 2, + "x2gd.16xlarge": 2, + "x2gd.2xlarge": 1, + "x2gd.4xlarge": 1, + "x2gd.8xlarge": 1, + "x2gd.large": 1, + "x2gd.medium": 1, + "x2gd.metal": 2, + "x2gd.xlarge": 1, + "x2idn.16xlarge": 1, + "x2idn.24xlarge": 2, + "x2idn.32xlarge": 2, + "x2idn.metal": 2, + "x2iedn.16xlarge": 1, + "x2iedn.24xlarge": 2, + "x2iedn.2xlarge": 1, + "x2iedn.32xlarge": 2, + "x2iedn.4xlarge": 1, + "x2iedn.8xlarge": 1, + "x2iedn.metal": 2, + "x2iedn.xlarge": 1, + "z1d.12xlarge": 2, + "z1d.2xlarge": 1, + "z1d.3xlarge": 1, + "z1d.6xlarge": 1, + "z1d.large": 1, + "z1d.metal": 2, + "z1d.xlarge": 1, }