From c39d8cbe65c038c7974e27e19e6168bae5b55a1c Mon Sep 17 00:00:00 2001 From: srikrishnabh Date: Tue, 30 Apr 2024 23:06:26 +0530 Subject: [PATCH 1/5] added clusterrole and cm for vault --- clusterrolebinding.yaml | 12 ++++++++++++ cm.yaml | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 clusterrolebinding.yaml create mode 100644 cm.yaml diff --git a/clusterrolebinding.yaml b/clusterrolebinding.yaml new file mode 100644 index 0000000..eeaa644 --- /dev/null +++ b/clusterrolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cluster-admin-csb +subjects: +- kind: ServiceAccount + name: autoscaler + namespace: autoscaler +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io diff --git a/cm.yaml b/cm.yaml new file mode 100644 index 0000000..08bd32a --- /dev/null +++ b/cm.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +metadata: + name: autoscaler + namespace: autoscaler +data: + policyNames: vault-policy-certs-admin,vault-policy-service-cred-admin,vault-policy-generic-cred-admin + roleName: vault-role-autoscale + servieAccountNameSpaces: autoscaler + servieAccounts: autoscaler +kind: ConfigMap From 8bd47f9124afd4a9b293612a0769cc7a1a4ee940 Mon Sep 17 00:00:00 2001 From: binarybard42 Date: Tue, 30 Apr 2024 23:06:26 +0530 Subject: [PATCH 2/5] added clusterrole and cm for vault --- clusterrolebinding.yaml | 12 ++++++++++++ cm.yaml | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 clusterrolebinding.yaml create mode 100644 cm.yaml diff --git a/clusterrolebinding.yaml b/clusterrolebinding.yaml new file mode 100644 index 0000000..eeaa644 --- /dev/null +++ b/clusterrolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cluster-admin-csb +subjects: +- kind: ServiceAccount + name: autoscaler + namespace: autoscaler +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io diff --git a/cm.yaml b/cm.yaml new file mode 100644 index 0000000..08bd32a --- /dev/null +++ b/cm.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +metadata: + name: autoscaler + namespace: autoscaler +data: + policyNames: vault-policy-certs-admin,vault-policy-service-cred-admin,vault-policy-generic-cred-admin + roleName: vault-role-autoscale + servieAccountNameSpaces: autoscaler + servieAccounts: autoscaler +kind: ConfigMap From 129a9c338c76030dae53053064854480e8200ffc Mon Sep 17 00:00:00 2001 From: binarybard42 Date: Sun, 5 May 2024 09:56:42 +0530 Subject: [PATCH 3/5] adding new provider --- go.mod | 60 +++++++++---- go.sum | 188 ++++++++++++++++++++++++++++++--------- k8s-deploy.yaml | 26 ++++++ main.go | 20 +++-- pkg/config/kubernetes.go | 4 - 5 files changed, 231 insertions(+), 67 deletions(-) create mode 100644 k8s-deploy.yaml diff --git a/go.mod b/go.mod index 75f86ac..0b592c4 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,34 @@ module intelops-scaler -go 1.21 +go 1.22 + +toolchain go1.22.2 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.4.0 - k8s.io/api v0.29.0 - k8s.io/apimachinery v0.29.0 - k8s.io/client-go v0.29.0 - k8s.io/klog/v2 v2.110.1 - k8s.io/kubernetes v1.29.0 + github.com/aws/aws-sdk-go v1.51.30 + github.com/intelops/go-common v1.0.22 + github.com/sirupsen/logrus v1.9.3 + k8s.io/api v0.30.0-alpha.3 + k8s.io/apimachinery v0.30.0-alpha.3 + k8s.io/autoscaler/cluster-autoscaler v0.0.0-20240426184935-4f1c8e69a8a4 + k8s.io/client-go v0.30.0-alpha.3 + k8s.io/klog/v2 v2.120.1 + k8s.io/kubernetes v1.30.0-alpha.3 + k8s.io/utils v0.0.0-20230726121419-3b25d923346b ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect + github.com/cenkalti/backoff/v3 v3.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/evanphx/json-patch v5.6.0+incompatible // indirect + github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect @@ -30,32 +39,47 @@ require ( github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/imdario/mergo v0.3.6 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.4 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/vault/api v1.9.2 // indirect + github.com/hashicorp/vault/api/auth/kubernetes v0.4.1 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/term v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect diff --git a/go.sum b/go.sum index 4eaf6ec..534aed9 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,12 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.51.30 h1:RVFkjn9P0JMwnuZCVH0TlV5k9zepHzlbc4943eZMhGw= +github.com/aws/aws-sdk-go v1.51.30/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c= +github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -21,10 +27,14 @@ github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= +github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= @@ -33,6 +43,8 @@ github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= +github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= @@ -45,7 +57,9 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -54,14 +68,52 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/vault/api v1.9.2 h1:YjkZLJ7K3inKgMZ0wzCU9OHqc+UqMQyXsPXnf3Cl2as= +github.com/hashicorp/vault/api v1.9.2/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8= +github.com/hashicorp/vault/api/auth/kubernetes v0.4.1 h1:amFWL1ZhwMWdmqvT51J9phXu835kY25wFfTrY/3yXd0= +github.com/hashicorp/vault/api/auth/kubernetes v0.4.1/go.mod h1:ikWDT8Adnfvm+8DzKez50vvLD9GWD/unZfJxeqP09sU= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/intelops/go-common v1.0.22 h1:NMu4N12J2ZCMOu2uL663Hu6RrPqkKuKHJCWZETxzZ9k= +github.com/intelops/go-common v1.0.22/go.mod h1:mxWXDclCU5PYafm6xwetolYwT7SftsNr0+WNa0P4LGE= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= +github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -75,6 +127,23 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -82,24 +151,33 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= -github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM= +github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -107,46 +185,74 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= -golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -168,18 +274,20 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= -k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= -k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= -k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= -k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= -k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/kubernetes v1.29.0 h1:DOLN7g8+nnAYBi8JHoW0+/MCrZKDPIqAxzLCXDXd0cg= -k8s.io/kubernetes v1.29.0/go.mod h1:9kztbUQf9stVDcIYXx+BX3nuGCsAQDsuClkGMpPs3pA= +k8s.io/api v0.30.0-alpha.3 h1:EcbaDi8WjoR8QdQS6LKd8oP0qjODWxfKdVj5U8WM1P0= +k8s.io/api v0.30.0-alpha.3/go.mod h1:gUziZ7QreMQgwigIm0O6q1xN4w2DPIs6PwP9Ha3c9dQ= +k8s.io/apimachinery v0.30.0-alpha.3 h1:9FoqT1Wc+48DJ+mYkbmZd3n4351u9YbGnQSPnVWUwWM= +k8s.io/apimachinery v0.30.0-alpha.3/go.mod h1:/862Kkwje5hhHGJWPKiaHuov2c6mw6uCXWikV9kOIP4= +k8s.io/autoscaler/cluster-autoscaler v0.0.0-20240426184935-4f1c8e69a8a4 h1:tI+FR5uzGKwi6NWXTXjI2i5WyaYDLPkPmESpGUkwT8o= +k8s.io/autoscaler/cluster-autoscaler v0.0.0-20240426184935-4f1c8e69a8a4/go.mod h1:pzojWyAQtTU1MIUYGw3jr1wSrkb6Oe/tskKy47W9cNY= +k8s.io/client-go v0.30.0-alpha.3 h1:0dj5DVlvaRI44HhHHI6cJxJ+n3F6GA1TwUV6U+L26No= +k8s.io/client-go v0.30.0-alpha.3/go.mod h1:waezUYZSoIV2fUNG2+pwia+wTwPb8HTRVHKd5v5rDg0= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e h1:snPmy96t93RredGRjKfMFt+gvxuVAncqSAyBveJtr4Q= +k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/kubernetes v1.30.0-alpha.3 h1:iNXxeu3ppkuOuUQ+apUVap8UROzQQw1ToOls9doIzo0= +k8s.io/kubernetes v1.30.0-alpha.3/go.mod h1:aW3opQ6TOnY8LHHsjQDykd7OByY5Ybd4FBXQlTlNDXw= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/k8s-deploy.yaml b/k8s-deploy.yaml new file mode 100644 index 0000000..a1ea844 --- /dev/null +++ b/k8s-deploy.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: autoscaler-deployment + namespace: autoscaler + labels: + app: autoscaler +spec: + replicas: 1 + selector: + matchLabels: + app: autoscaler + template: + metadata: + labels: + app: autoscaler + spec: + containers: + - name: autoscaler + env: + - name: VAULT_ADDR + value: https://vault.azureagent.optimizor.app + - name: VAULT_ROLE + value: vault-role-autoscale + image: srikrishnabh/autoscaler:t-1 + serviceAccountName: autoscaler diff --git a/main.go b/main.go index c1eb11f..c01da0b 100644 --- a/main.go +++ b/main.go @@ -2,20 +2,24 @@ package main import ( "context" - "intelops-scaler/pkg/cloudprovider/azure" + "fmt" + "log" + "os" "os/signal" "syscall" + "intelops-scaler/pkg/cloudprovider/azure" + "intelops-scaler/pkg/vault" + //"fmt" //"intelops-scaler/pkg/cloudprovider/azure" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/client-go/informers" - "log" - "os" - "intelops-scaler/pkg/autoscaler" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + + "intelops-scaler/pkg/autoscaler" //"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5" ) @@ -47,7 +51,13 @@ func main() { fmt.Printf("%+v", updateRes) */ - setupAutoscaler() + //setupAutoscaler() + resp, err := vault.GetGenericCredential(context.Background(), "azsecret", "azsecret") + if err != nil { + log.Fatalf("failed to connect vault") + } + + fmt.Println(resp) } func setupAutoscaler() { diff --git a/pkg/config/kubernetes.go b/pkg/config/kubernetes.go index 22a9068..61891ee 100644 --- a/pkg/config/kubernetes.go +++ b/pkg/config/kubernetes.go @@ -10,10 +10,6 @@ import ( kube_client_cmd "k8s.io/client-go/tools/clientcmd" ) -// This code was borrowed from Heapster to push the work forward and contains some functionality -// that may not be needed in Kubernetes. -// TODO(mwielgus): revisit this once we have the basic structure ready. - const ( defaultUseServiceAccount = false defaultServiceAccountFile = "/var/run/secrets/kubernetes.io/serviceaccount/token" From 341ef618963919f12f1289eb063b9d699f33ed79 Mon Sep 17 00:00:00 2001 From: binarybard42 Date: Sun, 5 May 2024 09:57:24 +0530 Subject: [PATCH 4/5] aws cloud provider --- pkg/cloudprovider/aws/autoscaling_group.go | 553 ++ pkg/cloudprovider/aws/aws_util.go | 79 + pkg/cloudprovider/aws/cache.go | 112 + pkg/cloudprovider/aws/cloud_provider.go | 299 + pkg/cloudprovider/aws/ec2_instance_types.go | 5437 +++++++++++++++++++ pkg/cloudprovider/aws/manager.go | 224 + pkg/cloudprovider/aws/wrapper.go | 768 +++ pkg/vault/vault.go | 31 + 8 files changed, 7503 insertions(+) create mode 100644 pkg/cloudprovider/aws/autoscaling_group.go create mode 100644 pkg/cloudprovider/aws/aws_util.go create mode 100644 pkg/cloudprovider/aws/cache.go create mode 100644 pkg/cloudprovider/aws/cloud_provider.go create mode 100644 pkg/cloudprovider/aws/ec2_instance_types.go create mode 100644 pkg/cloudprovider/aws/manager.go create mode 100644 pkg/cloudprovider/aws/wrapper.go create mode 100644 pkg/vault/vault.go diff --git a/pkg/cloudprovider/aws/autoscaling_group.go b/pkg/cloudprovider/aws/autoscaling_group.go new file mode 100644 index 0000000..c50cac9 --- /dev/null +++ b/pkg/cloudprovider/aws/autoscaling_group.go @@ -0,0 +1,553 @@ +/* +Copyright 2016 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 aws + +import ( + "fmt" + "reflect" + "strings" + "sync" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/autoscaling" + "k8s.io/autoscaler/cluster-autoscaler/config/dynamic" + "k8s.io/klog/v2" +) + +const ( + scaleToZeroSupported = true + placeholderInstanceNamePrefix = "i-placeholder" + placeholderUnfulfillableStatus = "placeholder-cannot-be-fulfilled" +) + +type asgCache struct { + registeredAsgs map[AwsRef]*asg + asgToInstances map[AwsRef][]AwsInstanceRef + instanceToAsg map[AwsInstanceRef]*asg + instanceStatus map[AwsInstanceRef]*string + instanceLifecycle map[AwsInstanceRef]*string + asgInstanceTypeCache *instanceTypeExpirationStore + mutex sync.Mutex + awsService *awsWrapper + interrupt chan struct{} + + explicitlyConfigured map[AwsRef]bool + autoscalingOptions map[AwsRef]map[string]string +} + +type launchTemplate struct { + name string + version string +} + +type mixedInstancesPolicy struct { + launchTemplate *launchTemplate + instanceTypesOverrides []string + instanceRequirementsOverrides *autoscaling.InstanceRequirements +} + +type asg struct { + AwsRef + + minSize int + maxSize int + curSize int + lastUpdateTime time.Time + + AvailabilityZones []string + LaunchConfigurationName string + LaunchTemplate *launchTemplate + MixedInstancesPolicy *mixedInstancesPolicy + Tags []*autoscaling.TagDescription +} + +func newASGCache(awsService *awsWrapper, explicitSpecs []string) (*asgCache, error) { + registry := &asgCache{ + registeredAsgs: make(map[AwsRef]*asg, 0), + awsService: awsService, + asgToInstances: make(map[AwsRef][]AwsInstanceRef), + instanceToAsg: make(map[AwsInstanceRef]*asg), + instanceStatus: make(map[AwsInstanceRef]*string), + instanceLifecycle: make(map[AwsInstanceRef]*string), + asgInstanceTypeCache: newAsgInstanceTypeCache(awsService), + interrupt: make(chan struct{}), + explicitlyConfigured: make(map[AwsRef]bool), + autoscalingOptions: make(map[AwsRef]map[string]string), + } + + if err := registry.parseExplicitAsgs(explicitSpecs); err != nil { + return nil, err + } + + return registry, nil +} + +// Use a function variable for ease of testing +var getInstanceTypeForAsg = func(m *asgCache, group *asg) (string, error) { + if obj, found, _ := m.asgInstanceTypeCache.GetByKey(group.AwsRef.Name); found { + return obj.(instanceTypeCachedObject).instanceType, nil + } + + result, err := m.awsService.getInstanceTypesForAsgs([]*asg{group}) + if err != nil { + return "", fmt.Errorf("could not get instance type for %s: %w", group.AwsRef.Name, err) + } + + if instanceType, ok := result[group.AwsRef.Name]; ok { + return instanceType, nil + } + + return "", fmt.Errorf("could not find instance type for %s", group.AwsRef.Name) +} + +// Fetch explicitly configured ASGs. These ASGs should never be unregistered +// during refreshes, even if they no longer exist in AWS. +func (m *asgCache) parseExplicitAsgs(specs []string) error { + for _, spec := range specs { + asg, err := m.buildAsgFromSpec(spec) + if err != nil { + return fmt.Errorf("failed to parse node group spec: %v", err) + } + m.explicitlyConfigured[asg.AwsRef] = true + m.register(asg) + } + + return nil +} + +// Register ASG. Returns the registered ASG. +func (m *asgCache) register(asg *asg) *asg { + if existing, asgExists := m.registeredAsgs[asg.AwsRef]; asgExists { + if reflect.DeepEqual(existing, asg) { + return existing + } + + // Explicit registered groups should always use the manually provided min/max + // values and the not the ones returned by the API + if !m.explicitlyConfigured[asg.AwsRef] { + existing.minSize = asg.minSize + existing.maxSize = asg.maxSize + } + + existing.curSize = asg.curSize + + // Those information are mainly required to create templates when scaling + // from zero + existing.AvailabilityZones = asg.AvailabilityZones + existing.LaunchConfigurationName = asg.LaunchConfigurationName + existing.LaunchTemplate = asg.LaunchTemplate + existing.MixedInstancesPolicy = asg.MixedInstancesPolicy + existing.Tags = asg.Tags + + klog.V(4).Infof("Updated ASG cache for %s. min/max/current is %d/%d/%d", asg.AwsRef.Name, existing.minSize, existing.maxSize, existing.curSize) + + return existing + } + klog.V(1).Infof("Registering ASG %s", asg.AwsRef.Name) + m.registeredAsgs[asg.AwsRef] = asg + return asg +} + +// Unregister ASG. Returns the unregistered ASG. +func (m *asgCache) unregister(a *asg) *asg { + if _, asgExists := m.registeredAsgs[a.AwsRef]; asgExists { + klog.V(1).Infof("Unregistered ASG %s", a.AwsRef.Name) + delete(m.registeredAsgs, a.AwsRef) + } + return a +} + +func (m *asgCache) buildAsgFromSpec(spec string) (*asg, error) { + s, err := dynamic.SpecFromString(spec, scaleToZeroSupported) + if err != nil { + return nil, fmt.Errorf("failed to parse node group spec: %v", err) + } + asg := &asg{ + AwsRef: AwsRef{Name: s.Name}, + minSize: s.MinSize, + maxSize: s.MaxSize, + } + return asg, nil +} + +// Get returns the currently registered ASGs +func (m *asgCache) Get() map[AwsRef]*asg { + m.mutex.Lock() + defer m.mutex.Unlock() + + return m.registeredAsgs +} + +// GetAutoscalingOptions return autoscaling options strings obtained from ASG tags. +func (m *asgCache) GetAutoscalingOptions(ref AwsRef) map[string]string { + m.mutex.Lock() + defer m.mutex.Unlock() + return m.autoscalingOptions[ref] +} + +// FindForInstance returns AsgConfig of the given Instance +func (m *asgCache) FindForInstance(instance AwsInstanceRef) *asg { + m.mutex.Lock() + defer m.mutex.Unlock() + + return m.findForInstance(instance) +} + +func (m *asgCache) findForInstance(instance AwsInstanceRef) *asg { + if asg, found := m.instanceToAsg[instance]; found { + return asg + } + + return nil +} + +// InstancesByAsg returns the nodes of an ASG +func (m *asgCache) InstancesByAsg(ref AwsRef) ([]AwsInstanceRef, error) { + m.mutex.Lock() + defer m.mutex.Unlock() + + if instances, found := m.asgToInstances[ref]; found { + return instances, nil + } + + return nil, fmt.Errorf("error while looking for instances of ASG: %s", ref) +} + +func (m *asgCache) InstanceStatus(ref AwsInstanceRef) (*string, error) { + m.mutex.Lock() + defer m.mutex.Unlock() + + if status, found := m.instanceStatus[ref]; found { + return status, nil + } + + return nil, fmt.Errorf("could not find instance %v", ref) +} + +func (m *asgCache) findInstanceLifecycle(ref AwsInstanceRef) (*string, error) { + if lifecycle, found := m.instanceLifecycle[ref]; found { + return lifecycle, nil + } + + return nil, fmt.Errorf("could not find instance %v", ref) +} + +func (m *asgCache) SetAsgSize(asg *asg, size int) error { + m.mutex.Lock() + defer m.mutex.Unlock() + + return m.setAsgSizeNoLock(asg, size) +} + +func (m *asgCache) setAsgSizeNoLock(asg *asg, size int) error { + params := &autoscaling.SetDesiredCapacityInput{ + AutoScalingGroupName: aws.String(asg.Name), + DesiredCapacity: aws.Int64(int64(size)), + HonorCooldown: aws.Bool(false), + } + + _, err := m.awsService.SetDesiredCapacity(params) + if err != nil { + return err + } + + // Proactively set the ASG size so autoscaler makes better decisions + asg.curSize = size + + return nil +} + +func (m *asgCache) decreaseAsgSizeByOneNoLock(asg *asg) error { + return m.setAsgSizeNoLock(asg, asg.curSize-1) +} + +// DeleteInstances deletes the given instances. All instances must be controlled by the same ASG. +func (m *asgCache) DeleteInstances(instances []*AwsInstanceRef) error { + m.mutex.Lock() + defer m.mutex.Unlock() + + if len(instances) == 0 { + return nil + } + commonAsg := m.findForInstance(*instances[0]) + if commonAsg == nil { + return fmt.Errorf("can't delete instance %s, which is not part of an ASG", instances[0].Name) + } + + for _, instance := range instances { + asg := m.findForInstance(*instance) + + if asg != commonAsg { + instanceIds := make([]string, len(instances)) + for i, instance := range instances { + instanceIds[i] = instance.Name + } + return fmt.Errorf("can't delete instances %s as they belong to at least two different ASGs (%s and %s)", strings.Join(instanceIds, ","), commonAsg.Name, asg.Name) + } + } + + for _, instance := range instances { + // check if the instance is a placeholder - a requested instance that was never created by the node group + // if it is, just decrease the size of the node group, as there's no specific instance we can remove + if m.isPlaceholderInstance(instance) { + klog.V(4).Infof("instance %s is detected as a placeholder, decreasing ASG requested size instead "+ + "of deleting instance", instance.Name) + m.decreaseAsgSizeByOneNoLock(commonAsg) + } else { + // check if the instance is already terminating - if it is, don't bother terminating again + // as doing so causes unnecessary API calls and can cause the curSize cached value to decrement + // unnecessarily. + lifecycle, err := m.findInstanceLifecycle(*instance) + if err != nil { + return err + } + + if lifecycle != nil && + *lifecycle == autoscaling.LifecycleStateTerminated || + *lifecycle == autoscaling.LifecycleStateTerminating || + *lifecycle == autoscaling.LifecycleStateTerminatingWait || + *lifecycle == autoscaling.LifecycleStateTerminatingProceed { + klog.V(2).Infof("instance %s is already terminating in state %s, will skip instead", instance.Name, *lifecycle) + continue + } + + params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{ + InstanceId: aws.String(instance.Name), + ShouldDecrementDesiredCapacity: aws.Bool(true), + } + + resp, err := m.awsService.TerminateInstanceInAutoScalingGroup(params) + if err != nil { + return err + } + klog.V(4).Infof(*resp.Activity.Description) + + // Proactively decrement the size so autoscaler makes better decisions + commonAsg.curSize-- + } + } + return nil +} + +// isPlaceholderInstance checks if the given instance is only a placeholder +func (m *asgCache) isPlaceholderInstance(instance *AwsInstanceRef) bool { + return strings.HasPrefix(instance.Name, placeholderInstanceNamePrefix) +} + +func (m *asgCache) buildAsgNames() []string { + refreshNames := make([]string, len(m.explicitlyConfigured)) + i := 0 + for k := range m.explicitlyConfigured { + refreshNames[i] = k.Name + i++ + } + + return refreshNames +} + +// regenerate the cached view of explicitly configured and auto-discovered ASGs +func (m *asgCache) regenerate() error { + m.mutex.Lock() + defer m.mutex.Unlock() + + newInstanceToAsgCache := make(map[AwsInstanceRef]*asg) + newAsgToInstancesCache := make(map[AwsRef][]AwsInstanceRef) + newInstanceStatusMap := make(map[AwsInstanceRef]*string) + newInstanceLifecycleMap := make(map[AwsInstanceRef]*string) + + // Fetch details of all ASGs + refreshNames := m.buildAsgNames() + klog.V(4).Infof("Regenerating instance to ASG map for ASG names: %v", refreshNames) + namedGroups, err := m.awsService.getAutoscalingGroupsByNames(refreshNames) + if err != nil { + return err + } + + groups := namedGroups + + // If currently any ASG has more Desired than running Instances, introduce placeholders + // for the instances to come up. This is required to track Desired instances that + // will never come up, like with Spot Request that can't be fulfilled + groups = m.createPlaceholdersForDesiredNonStartedInstances(groups) + + // Register or update ASGs + exists := make(map[AwsRef]bool) + for _, group := range groups { + asg, err := m.buildAsgFromAWS(group) + if err != nil { + return err + } + exists[asg.AwsRef] = true + + asg = m.register(asg) + + newAsgToInstancesCache[asg.AwsRef] = make([]AwsInstanceRef, len(group.Instances)) + + for i, instance := range group.Instances { + ref := m.buildInstanceRefFromAWS(instance) + newInstanceToAsgCache[ref] = asg + newAsgToInstancesCache[asg.AwsRef][i] = ref + newInstanceStatusMap[ref] = instance.HealthStatus + newInstanceLifecycleMap[ref] = instance.LifecycleState + } + } + + // Unregister no longer existing auto-discovered ASGs + for _, asg := range m.registeredAsgs { + if !exists[asg.AwsRef] && !m.explicitlyConfigured[asg.AwsRef] { + m.unregister(asg) + } + } + + err = m.asgInstanceTypeCache.populate(m.registeredAsgs) + if err != nil { + klog.Warningf("Failed to fully populate ASG->instanceType mapping: %v", err) + } + + m.asgToInstances = newAsgToInstancesCache + m.instanceToAsg = newInstanceToAsgCache + m.instanceStatus = newInstanceStatusMap + m.instanceLifecycle = newInstanceLifecycleMap + return nil +} + +func (m *asgCache) createPlaceholdersForDesiredNonStartedInstances(groups []*autoscaling.Group) []*autoscaling.Group { + for _, g := range groups { + desired := *g.DesiredCapacity + realInstances := int64(len(g.Instances)) + if desired <= realInstances { + continue + } + + klog.V(4).Infof("Instance group %s has only %d instances created while requested count is %d. "+ + "Creating placeholder instances.", *g.AutoScalingGroupName, realInstances, desired) + + healthStatus := "" + isAvailable, err := m.isNodeGroupAvailable(g) + if err != nil { + klog.V(4).Infof("Could not check instance availability, creating placeholder node anyways: %v", err) + } else if !isAvailable { + klog.Warningf("Instance group %s cannot provision any more nodes!", *g.AutoScalingGroupName) + healthStatus = placeholderUnfulfillableStatus + } + + for i := realInstances; i < desired; i++ { + id := fmt.Sprintf("%s-%s-%d", placeholderInstanceNamePrefix, *g.AutoScalingGroupName, i) + g.Instances = append(g.Instances, &autoscaling.Instance{ + InstanceId: &id, + AvailabilityZone: g.AvailabilityZones[0], + HealthStatus: &healthStatus, + }) + } + } + return groups +} + +func (m *asgCache) isNodeGroupAvailable(group *autoscaling.Group) (bool, error) { + input := &autoscaling.DescribeScalingActivitiesInput{ + AutoScalingGroupName: group.AutoScalingGroupName, + } + + response, err := m.awsService.DescribeScalingActivities(input) + if err != nil { + return true, err // If we can't describe the scaling activities we assume the node group is available + } + + for _, activity := range response.Activities { + asgRef := AwsRef{Name: *group.AutoScalingGroupName} + if a, ok := m.registeredAsgs[asgRef]; ok { + lut := a.lastUpdateTime + if activity.StartTime.Before(lut) { + break + } else if *activity.StatusCode == "Failed" { + klog.Warningf("ASG %s scaling failed with %s", asgRef.Name, *activity) + return false, nil + } + } else { + klog.V(4).Infof("asg %v is not registered yet, skipping DescribeScalingActivities check", asgRef.Name) + } + } + return true, nil +} + +func (m *asgCache) buildAsgFromAWS(g *autoscaling.Group) (*asg, error) { + spec := dynamic.NodeGroupSpec{ + Name: aws.StringValue(g.AutoScalingGroupName), + MinSize: int(aws.Int64Value(g.MinSize)), + MaxSize: int(aws.Int64Value(g.MaxSize)), + SupportScaleToZero: scaleToZeroSupported, + } + + if verr := spec.Validate(); verr != nil { + return nil, fmt.Errorf("failed to create node group spec: %v", verr) + } + + asg := &asg{ + AwsRef: AwsRef{Name: spec.Name}, + minSize: spec.MinSize, + maxSize: spec.MaxSize, + + curSize: int(aws.Int64Value(g.DesiredCapacity)), + AvailabilityZones: aws.StringValueSlice(g.AvailabilityZones), + LaunchConfigurationName: aws.StringValue(g.LaunchConfigurationName), + Tags: g.Tags, + } + + if g.MixedInstancesPolicy != nil { + getInstanceTypes := func(overrides []*autoscaling.LaunchTemplateOverrides) []string { + res := []string{} + for _, override := range overrides { + if override.InstanceType != nil { + res = append(res, *override.InstanceType) + } + } + return res + } + + getInstanceTypeRequirements := func(overrides []*autoscaling.LaunchTemplateOverrides) *autoscaling.InstanceRequirements { + if len(overrides) == 1 && overrides[0].InstanceRequirements != nil { + return overrides[0].InstanceRequirements + } + return nil + } + + asg.MixedInstancesPolicy = &mixedInstancesPolicy{ + instanceTypesOverrides: getInstanceTypes(g.MixedInstancesPolicy.LaunchTemplate.Overrides), + instanceRequirementsOverrides: getInstanceTypeRequirements(g.MixedInstancesPolicy.LaunchTemplate.Overrides), + } + + if len(asg.MixedInstancesPolicy.instanceTypesOverrides) != 0 && asg.MixedInstancesPolicy.instanceRequirementsOverrides != nil { + return nil, fmt.Errorf("invalid setup of both instance type and instance requirements overrides configured") + } + } + + return asg, nil +} + +func (m *asgCache) buildInstanceRefFromAWS(instance *autoscaling.Instance) AwsInstanceRef { + providerID := fmt.Sprintf("aws:///%s/%s", aws.StringValue(instance.AvailabilityZone), aws.StringValue(instance.InstanceId)) + return AwsInstanceRef{ + ProviderID: providerID, + Name: aws.StringValue(instance.InstanceId), + } +} + +// Cleanup closes the channel to signal the go routine to stop that is handling the cache +func (m *asgCache) Cleanup() { + close(m.interrupt) +} diff --git a/pkg/cloudprovider/aws/aws_util.go b/pkg/cloudprovider/aws/aws_util.go new file mode 100644 index 0000000..58cc85a --- /dev/null +++ b/pkg/cloudprovider/aws/aws_util.go @@ -0,0 +1,79 @@ +/* +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 aws + +import ( + "errors" + "fmt" + "os" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" +) + +var ( + ec2MetaDataServiceUrl = "http://169.254.169.254" +) + +// GenerateEC2InstanceTypes returns a map of ec2 resources +func GenerateEC2InstanceTypes(sess *session.Session) (map[string]*InstanceType, error) { + instanceTypes := make(map[string]*InstanceType) + + if len(instanceTypes) == 0 { + return nil, errors.New("unable to load EC2 Instance Type list") + } + + return instanceTypes, nil +} + +// GetStaticEC2InstanceTypes return pregenerated ec2 instance type list +func GetStaticEC2InstanceTypes() (map[string]*InstanceType, string) { + return InstanceTypes, StaticListLastUpdateTime +} + +func interpretEc2SupportedArchitecure(archName string) string { + switch archName { + case "arm64": + return "arm64" + case "i386": + return "amd64" + case "x86_64": + return "amd64" + case "x86_64_mac": + return "amd64" + default: + return "amd64" + } +} + +// GetCurrentAwsRegion return region of current cluster without building awsManager +func GetCurrentAwsRegion() (string, error) { + region, present := os.LookupEnv("AWS_REGION") + + if !present { + c := aws.NewConfig(). + WithEndpoint(ec2MetaDataServiceUrl) + sess, err := session.NewSession() + if err != nil { + return "", fmt.Errorf("failed to create session") + } + return ec2metadata.New(sess, c).Region() + } + + return region, nil +} diff --git a/pkg/cloudprovider/aws/cache.go b/pkg/cloudprovider/aws/cache.go new file mode 100644 index 0000000..7211d40 --- /dev/null +++ b/pkg/cloudprovider/aws/cache.go @@ -0,0 +1,112 @@ +package aws + +import ( + "sync" + "time" + + "k8s.io/apimachinery/pkg/util/rand" + "k8s.io/client-go/tools/cache" + "k8s.io/utils/clock" +) + +const ( + asgInstanceTypeCacheTTL = time.Minute * 20 + cacheMinTTL = 120 + cacheMaxTTL = 600 +) + +// instanceTypeExpirationStore caches the canonical instance type for an ASG. +// The store expires its keys based on a TTL. This TTL can have a jitter applied to it. +// This allows to get a better repartition of the AWS queries. +type instanceTypeExpirationStore struct { + cache.Store + jitterClock clock.Clock + awsService *awsWrapper +} + +type instanceTypeCachedObject struct { + name string + instanceType string +} + +type jitterClock struct { + clock.Clock + + jitter bool + sync.RWMutex +} + +func newAsgInstanceTypeCache(awsService *awsWrapper) *instanceTypeExpirationStore { + jc := &jitterClock{} + return newAsgInstanceTypeCacheWithClock( + awsService, + jc, + cache.NewExpirationStore(func(obj interface{}) (s string, e error) { + return obj.(instanceTypeCachedObject).name, nil + }, &cache.TTLPolicy{ + TTL: asgInstanceTypeCacheTTL, + Clock: jc, + }), + ) +} + +func newAsgInstanceTypeCacheWithClock(awsService *awsWrapper, jc clock.Clock, store cache.Store) *instanceTypeExpirationStore { + return &instanceTypeExpirationStore{ + store, + jc, + awsService, + } +} + +func (c *jitterClock) Since(ts time.Time) time.Duration { + since := time.Since(ts) + c.RLock() + defer c.RUnlock() + if c.jitter { + return since + (time.Second * time.Duration(rand.IntnRange(cacheMinTTL, cacheMaxTTL))) + } + return since +} + +func (es instanceTypeExpirationStore) populate(autoscalingGroups map[AwsRef]*asg) error { + asgsToQuery := []*asg{} + + if c, ok := es.jitterClock.(*jitterClock); ok { + c.Lock() + c.jitter = true + c.Unlock() + } + + for _, asg := range autoscalingGroups { + if asg == nil { + continue + } + _, found, _ := es.GetByKey(asg.AwsRef.Name) + if found { + continue + } + asgsToQuery = append(asgsToQuery, asg) + } + + if c, ok := es.jitterClock.(*jitterClock); ok { + c.Lock() + c.jitter = false + c.Unlock() + } + + // List expires old entries + _ = es.List() + + instanceTypesByAsg, err := es.awsService.getInstanceTypesForAsgs(asgsToQuery) + if err != nil { + return err + } + + for asgName, instanceType := range instanceTypesByAsg { + es.Add(instanceTypeCachedObject{ + name: asgName, + instanceType: instanceType, + }) + } + return nil +} diff --git a/pkg/cloudprovider/aws/cloud_provider.go b/pkg/cloudprovider/aws/cloud_provider.go new file mode 100644 index 0000000..5e7d25f --- /dev/null +++ b/pkg/cloudprovider/aws/cloud_provider.go @@ -0,0 +1,299 @@ +/* +Copyright 2016 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 aws + +import ( + "errors" + "fmt" + "regexp" + "strings" + + apiv1 "k8s.io/api/core/v1" + klog "k8s.io/klog/v2" +) + +const ( + // GPULabel is the label added to nodes with GPU resource. + GPULabel = "k8s.amazonaws.com/accelerator" + // nodeNotPresentErr indicates no node with the given identifier present in AWS + nodeNotPresentErr = "node is not present in aws" +) + +var ( + availableGPUTypes = map[string]struct{}{ + "nvidia-tesla-k80": {}, + "nvidia-tesla-p100": {}, + "nvidia-tesla-v100": {}, + "nvidia-tesla-t4": {}, + "nvidia-tesla-a100": {}, + "nvidia-a10g": {}, + } +) + +// awsCloudProvider implements CloudProvider interface. +type awsCloudProvider struct { + awsManager *AwsManager +} + +// Cleanup stops the go routine that is handling the current view of the ASGs in the form of a cache +func (aws *awsCloudProvider) Cleanup() error { + aws.awsManager.Cleanup() + return nil +} + +// GPULabel returns the label added to nodes with GPU resource. +func (aws *awsCloudProvider) GPULabel() string { + return GPULabel +} + +// GetAvailableGPUTypes return all available GPU types cloud provider supports +func (aws *awsCloudProvider) GetAvailableGPUTypes() map[string]struct{} { + return availableGPUTypes +} + +// NodeGroups returns all node groups configured for this cloud provider. +func (aws *awsCloudProvider) NodeGroups() []*AwsNodeGroup { + asgs := aws.awsManager.getAsgs() + ngs := make([]*AwsNodeGroup, 0, len(asgs)) + for _, asg := range asgs { + ngs = append(ngs, &AwsNodeGroup{ + asg: asg, + awsManager: aws.awsManager, + }) + } + + return ngs +} + +// NodeGroupForNode returns the node group for the given node. +func (aws *awsCloudProvider) NodeGroupForNode(node *apiv1.Node) (*AwsNodeGroup, error) { + if len(node.Spec.ProviderID) == 0 { + klog.Warningf("Node %v has no providerId", node.Name) + return nil, nil + } + ref, err := AwsRefFromProviderId(node.Spec.ProviderID) + if err != nil { + return nil, err + } + asg := aws.awsManager.GetAsgForInstance(*ref) + + if asg == nil { + return nil, nil + } + + return &AwsNodeGroup{ + asg: asg, + awsManager: aws.awsManager, + }, nil +} + +// HasInstance returns whether a given node has a corresponding instance in this cloud provider +func (aws *awsCloudProvider) HasInstance(node *apiv1.Node) (bool, error) { + // we haven't implemented a way to check if a fargate instance + // exists in the cloud provider + // returning 'true' because we are assuming the node exists in AWS + // this is the default behavior if the check is unimplemented + if strings.HasPrefix(node.GetName(), "fargate") { + return true, errors.New("not Implemented") + } + + // avoid log spam for not autoscaled asgs: + // Nodes that belong to an asg that is not autoscaled will not be found in the asgCache below, + // so do not trigger warning spam by returning an error from being unable to find them. + // Annotation is not automated, but users that see the warning can add the annotation to avoid it. + if node.Annotations != nil && node.Annotations["k8s.io/cluster-autoscaler/enabled"] == "false" { + return false, nil + } + + awsRef, err := AwsRefFromProviderId(node.Spec.ProviderID) + if err != nil { + return false, err + } + + // we don't care about the status + status, err := aws.awsManager.asgCache.InstanceStatus(*awsRef) + if status != nil { + return true, nil + } + + return false, fmt.Errorf("%s: %v", nodeNotPresentErr, err) +} + +// GetAvailableMachineTypes get all machine types that can be requested from the cloud provider. +func (aws *awsCloudProvider) GetAvailableMachineTypes() ([]string, error) { + return []string{}, nil +} + +// Refresh is called before every main loop and can be used to dynamically update cloud provider state. +// In particular the list of node groups returned by NodeGroups can change as a result of CloudProvider.Refresh(). +func (aws *awsCloudProvider) Refresh() error { + return aws.awsManager.Refresh() +} + +// AwsRef contains a reference to some entity in AWS world. +type AwsRef struct { + Name string +} + +// AwsInstanceRef contains a reference to an instance in the AWS world. +type AwsInstanceRef struct { + ProviderID string + Name string +} + +var validAwsRefIdRegex = regexp.MustCompile(fmt.Sprintf(`^aws\:\/\/\/[-0-9a-z]*\/[-0-9a-z]*(\/[-0-9a-z\.]*)?$|aws\:\/\/\/[-0-9a-z]*\/%s.*$`, placeholderInstanceNamePrefix)) + +// AwsRefFromProviderId creates AwsInstanceRef object from provider id which +// must be in format: aws:///zone/name +func AwsRefFromProviderId(id string) (*AwsInstanceRef, error) { + if validAwsRefIdRegex.FindStringSubmatch(id) == nil { + return nil, fmt.Errorf("wrong id: expected format aws:////, got %v", id) + } + splitted := strings.Split(id[7:], "/") + return &AwsInstanceRef{ + ProviderID: id, + Name: splitted[1], + }, nil +} + +// AwsNodeGroup implements NodeGroup interface. +type AwsNodeGroup struct { + awsManager *AwsManager + asg *asg +} + +// MaxSize returns maximum size of the node group. +func (ng *AwsNodeGroup) MaxSize() int { + return ng.asg.maxSize +} + +// MinSize returns minimum size of the node group. +func (ng *AwsNodeGroup) MinSize() int { + return ng.asg.minSize +} + +// TargetSize returns the current TARGET size of the node group. It is possible that the +// number is different from the number of nodes registered in Kubernetes. +func (ng *AwsNodeGroup) TargetSize() (int, error) { + return ng.asg.curSize, nil +} + +// Exist checks if the node group really exists on the cloud provider side. Allows to tell the +// theoretical node group from the real one. +func (ng *AwsNodeGroup) Exist() bool { + return true +} + +// Autoprovisioned returns true if the node group is autoprovisioned. +func (ng *AwsNodeGroup) Autoprovisioned() bool { + return false +} + +// Delete deletes the node group on the cloud provider side. +// This will be executed only for autoprovisioned node groups, once their size drops to 0. +func (ng *AwsNodeGroup) Delete() error { + return nil +} + +// IncreaseSize increases Asg size +func (ng *AwsNodeGroup) IncreaseSize(delta int) error { + if delta <= 0 { + return fmt.Errorf("size increase must be positive") + } + size := ng.asg.curSize + if size+delta > ng.asg.maxSize { + return fmt.Errorf("size increase too large - desired:%d max:%d", size+delta, ng.asg.maxSize) + } + return ng.awsManager.SetAsgSize(ng.asg, size+delta) +} + +// DecreaseTargetSize decreases the target size of the node group. This function +// doesn't permit to delete any existing node and can be used only to reduce the +// request for new nodes that have not been yet fulfilled. Delta should be negative. +// It is assumed that cloud provider will not delete the existing nodes if the size +// when there is an option to just decrease the target. +func (ng *AwsNodeGroup) DecreaseTargetSize(delta int) error { + if delta >= 0 { + return fmt.Errorf("size decrease size must be negative") + } + + size := ng.asg.curSize + nodes, err := ng.awsManager.GetAsgNodes(ng.asg.AwsRef) + if err != nil { + return err + } + if int(size)+delta < len(nodes) { + return fmt.Errorf("attempt to delete existing nodes targetSize:%d delta:%d existingNodes: %d", + size, delta, len(nodes)) + } + return ng.awsManager.SetAsgSize(ng.asg, size+delta) +} + +// Belongs returns true if the given node belongs to the NodeGroup. +func (ng *AwsNodeGroup) Belongs(node *apiv1.Node) (bool, error) { + ref, err := AwsRefFromProviderId(node.Spec.ProviderID) + if err != nil { + return false, err + } + targetAsg := ng.awsManager.GetAsgForInstance(*ref) + if targetAsg == nil { + return false, fmt.Errorf("%s doesn't belong to a known asg", node.Name) + } + if targetAsg.AwsRef != ng.asg.AwsRef { + return false, nil + } + return true, nil +} + +// DeleteNodes deletes the nodes from the group. +func (ng *AwsNodeGroup) DeleteNodes(nodes []*apiv1.Node) error { + size := ng.asg.curSize + if int(size) <= ng.MinSize() { + return fmt.Errorf("min size reached, nodes will not be deleted") + } + refs := make([]*AwsInstanceRef, 0, len(nodes)) + for _, node := range nodes { + belongs, err := ng.Belongs(node) + if err != nil { + return err + } + if !belongs { + return fmt.Errorf("%s belongs to a different asg than %s", node.Name, ng.Id()) + } + awsref, err := AwsRefFromProviderId(node.Spec.ProviderID) + if err != nil { + return err + } + refs = append(refs, awsref) + } + return ng.awsManager.DeleteInstances(refs) +} + +// Id returns asg id. +func (ng *AwsNodeGroup) Id() string { + return ng.asg.Name +} + +// Debug returns a debug string for the Asg. +func (ng *AwsNodeGroup) Debug() string { + return fmt.Sprintf("%s (%d:%d)", ng.Id(), ng.MinSize(), ng.MaxSize()) +} + +// Nodes returns a list of all nodes that belong to this node group. +func (ng *AwsNodeGroup) Nodes() ([]AwsInstanceRef, error) { + return ng.awsManager.GetAsgNodes(ng.asg.AwsRef) +} diff --git a/pkg/cloudprovider/aws/ec2_instance_types.go b/pkg/cloudprovider/aws/ec2_instance_types.go new file mode 100644 index 0000000..e1603af --- /dev/null +++ b/pkg/cloudprovider/aws/ec2_instance_types.go @@ -0,0 +1,5437 @@ +// This file was generated by go generate; DO NOT EDIT + +package aws + +// InstanceType is spec of EC2 instance +type InstanceType struct { + InstanceType string + VCPU int64 + MemoryMb int64 + GPU int64 + Architecture string +} + +// StaticListLastUpdateTime is a string declaring the last time the static list was updated. +var StaticListLastUpdateTime = "2024-04-08" + +// InstanceTypes is a map of ec2 resources +var InstanceTypes = map[string]*InstanceType{ + "a1.2xlarge": { + InstanceType: "a1.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "a1.4xlarge": { + InstanceType: "a1.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "a1.large": { + InstanceType: "a1.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "a1.medium": { + InstanceType: "a1.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "a1.metal": { + InstanceType: "a1.metal", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "a1.xlarge": { + InstanceType: "a1.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c1.medium": { + InstanceType: "c1.medium", + VCPU: 2, + MemoryMb: 1740, + GPU: 0, + Architecture: "amd64", + }, + "c1.xlarge": { + InstanceType: "c1.xlarge", + VCPU: 8, + MemoryMb: 7168, + GPU: 0, + Architecture: "amd64", + }, + "c3.2xlarge": { + InstanceType: "c3.2xlarge", + VCPU: 8, + MemoryMb: 15360, + GPU: 0, + Architecture: "amd64", + }, + "c3.4xlarge": { + InstanceType: "c3.4xlarge", + VCPU: 16, + MemoryMb: 30720, + GPU: 0, + Architecture: "amd64", + }, + "c3.8xlarge": { + InstanceType: "c3.8xlarge", + VCPU: 32, + MemoryMb: 61440, + GPU: 0, + Architecture: "amd64", + }, + "c3.large": { + InstanceType: "c3.large", + VCPU: 2, + MemoryMb: 3840, + GPU: 0, + Architecture: "amd64", + }, + "c3.xlarge": { + InstanceType: "c3.xlarge", + VCPU: 4, + MemoryMb: 7680, + GPU: 0, + Architecture: "amd64", + }, + "c4.2xlarge": { + InstanceType: "c4.2xlarge", + VCPU: 8, + MemoryMb: 15360, + GPU: 0, + Architecture: "amd64", + }, + "c4.4xlarge": { + InstanceType: "c4.4xlarge", + VCPU: 16, + MemoryMb: 30720, + GPU: 0, + Architecture: "amd64", + }, + "c4.8xlarge": { + InstanceType: "c4.8xlarge", + VCPU: 36, + MemoryMb: 61440, + GPU: 0, + Architecture: "amd64", + }, + "c4.large": { + InstanceType: "c4.large", + VCPU: 2, + MemoryMb: 3840, + GPU: 0, + Architecture: "amd64", + }, + "c4.xlarge": { + InstanceType: "c4.xlarge", + VCPU: 4, + MemoryMb: 7680, + GPU: 0, + Architecture: "amd64", + }, + "c5.12xlarge": { + InstanceType: "c5.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c5.18xlarge": { + InstanceType: "c5.18xlarge", + VCPU: 72, + MemoryMb: 147456, + GPU: 0, + Architecture: "amd64", + }, + "c5.24xlarge": { + InstanceType: "c5.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5.2xlarge": { + InstanceType: "c5.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c5.4xlarge": { + InstanceType: "c5.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c5.9xlarge": { + InstanceType: "c5.9xlarge", + VCPU: 36, + MemoryMb: 73728, + GPU: 0, + Architecture: "amd64", + }, + "c5.large": { + InstanceType: "c5.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c5.metal": { + InstanceType: "c5.metal", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5.xlarge": { + InstanceType: "c5.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c5a.12xlarge": { + InstanceType: "c5a.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c5a.16xlarge": { + InstanceType: "c5a.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c5a.24xlarge": { + InstanceType: "c5a.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5a.2xlarge": { + InstanceType: "c5a.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c5a.4xlarge": { + InstanceType: "c5a.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c5a.8xlarge": { + InstanceType: "c5a.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c5a.large": { + InstanceType: "c5a.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c5a.xlarge": { + InstanceType: "c5a.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.12xlarge": { + InstanceType: "c5ad.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.16xlarge": { + InstanceType: "c5ad.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.24xlarge": { + InstanceType: "c5ad.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.2xlarge": { + InstanceType: "c5ad.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.4xlarge": { + InstanceType: "c5ad.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.8xlarge": { + InstanceType: "c5ad.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.large": { + InstanceType: "c5ad.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c5ad.xlarge": { + InstanceType: "c5ad.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c5d.12xlarge": { + InstanceType: "c5d.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c5d.18xlarge": { + InstanceType: "c5d.18xlarge", + VCPU: 72, + MemoryMb: 147456, + GPU: 0, + Architecture: "amd64", + }, + "c5d.24xlarge": { + InstanceType: "c5d.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5d.2xlarge": { + InstanceType: "c5d.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c5d.4xlarge": { + InstanceType: "c5d.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c5d.9xlarge": { + InstanceType: "c5d.9xlarge", + VCPU: 36, + MemoryMb: 73728, + GPU: 0, + Architecture: "amd64", + }, + "c5d.large": { + InstanceType: "c5d.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c5d.metal": { + InstanceType: "c5d.metal", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5d.xlarge": { + InstanceType: "c5d.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c5n.18xlarge": { + InstanceType: "c5n.18xlarge", + VCPU: 72, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5n.2xlarge": { + InstanceType: "c5n.2xlarge", + VCPU: 8, + MemoryMb: 21504, + GPU: 0, + Architecture: "amd64", + }, + "c5n.4xlarge": { + InstanceType: "c5n.4xlarge", + VCPU: 16, + MemoryMb: 43008, + GPU: 0, + Architecture: "amd64", + }, + "c5n.9xlarge": { + InstanceType: "c5n.9xlarge", + VCPU: 36, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c5n.large": { + InstanceType: "c5n.large", + VCPU: 2, + MemoryMb: 5376, + GPU: 0, + Architecture: "amd64", + }, + "c5n.metal": { + InstanceType: "c5n.metal", + VCPU: 72, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c5n.xlarge": { + InstanceType: "c5n.xlarge", + VCPU: 4, + MemoryMb: 10752, + GPU: 0, + Architecture: "amd64", + }, + "c6a.12xlarge": { + InstanceType: "c6a.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c6a.16xlarge": { + InstanceType: "c6a.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c6a.24xlarge": { + InstanceType: "c6a.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c6a.2xlarge": { + InstanceType: "c6a.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c6a.32xlarge": { + InstanceType: "c6a.32xlarge", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6a.48xlarge": { + InstanceType: "c6a.48xlarge", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c6a.4xlarge": { + InstanceType: "c6a.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c6a.8xlarge": { + InstanceType: "c6a.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c6a.large": { + InstanceType: "c6a.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c6a.metal": { + InstanceType: "c6a.metal", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c6a.xlarge": { + InstanceType: "c6a.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c6g.12xlarge": { + InstanceType: "c6g.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c6g.16xlarge": { + InstanceType: "c6g.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c6g.2xlarge": { + InstanceType: "c6g.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c6g.4xlarge": { + InstanceType: "c6g.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c6g.8xlarge": { + InstanceType: "c6g.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c6g.large": { + InstanceType: "c6g.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c6g.medium": { + InstanceType: "c6g.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c6g.metal": { + InstanceType: "c6g.metal", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c6g.xlarge": { + InstanceType: "c6g.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.12xlarge": { + InstanceType: "c6gd.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.16xlarge": { + InstanceType: "c6gd.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.2xlarge": { + InstanceType: "c6gd.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.4xlarge": { + InstanceType: "c6gd.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.8xlarge": { + InstanceType: "c6gd.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.large": { + InstanceType: "c6gd.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.medium": { + InstanceType: "c6gd.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.metal": { + InstanceType: "c6gd.metal", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c6gd.xlarge": { + InstanceType: "c6gd.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.12xlarge": { + InstanceType: "c6gn.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.16xlarge": { + InstanceType: "c6gn.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.2xlarge": { + InstanceType: "c6gn.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.4xlarge": { + InstanceType: "c6gn.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.8xlarge": { + InstanceType: "c6gn.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.large": { + InstanceType: "c6gn.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.medium": { + InstanceType: "c6gn.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c6gn.xlarge": { + InstanceType: "c6gn.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c6i.12xlarge": { + InstanceType: "c6i.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c6i.16xlarge": { + InstanceType: "c6i.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c6i.24xlarge": { + InstanceType: "c6i.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c6i.2xlarge": { + InstanceType: "c6i.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c6i.32xlarge": { + InstanceType: "c6i.32xlarge", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6i.4xlarge": { + InstanceType: "c6i.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c6i.8xlarge": { + InstanceType: "c6i.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c6i.large": { + InstanceType: "c6i.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c6i.metal": { + InstanceType: "c6i.metal", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6i.xlarge": { + InstanceType: "c6i.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c6id.12xlarge": { + InstanceType: "c6id.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c6id.16xlarge": { + InstanceType: "c6id.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c6id.24xlarge": { + InstanceType: "c6id.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c6id.2xlarge": { + InstanceType: "c6id.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c6id.32xlarge": { + InstanceType: "c6id.32xlarge", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6id.4xlarge": { + InstanceType: "c6id.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c6id.8xlarge": { + InstanceType: "c6id.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c6id.large": { + InstanceType: "c6id.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c6id.metal": { + InstanceType: "c6id.metal", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6id.xlarge": { + InstanceType: "c6id.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c6in.12xlarge": { + InstanceType: "c6in.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c6in.16xlarge": { + InstanceType: "c6in.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c6in.24xlarge": { + InstanceType: "c6in.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c6in.2xlarge": { + InstanceType: "c6in.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c6in.32xlarge": { + InstanceType: "c6in.32xlarge", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6in.4xlarge": { + InstanceType: "c6in.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c6in.8xlarge": { + InstanceType: "c6in.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c6in.large": { + InstanceType: "c6in.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c6in.metal": { + InstanceType: "c6in.metal", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c6in.xlarge": { + InstanceType: "c6in.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c7a.12xlarge": { + InstanceType: "c7a.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c7a.16xlarge": { + InstanceType: "c7a.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c7a.24xlarge": { + InstanceType: "c7a.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c7a.2xlarge": { + InstanceType: "c7a.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c7a.32xlarge": { + InstanceType: "c7a.32xlarge", + VCPU: 128, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "c7a.48xlarge": { + InstanceType: "c7a.48xlarge", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c7a.4xlarge": { + InstanceType: "c7a.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c7a.8xlarge": { + InstanceType: "c7a.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c7a.large": { + InstanceType: "c7a.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c7a.medium": { + InstanceType: "c7a.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "amd64", + }, + "c7a.metal-48xl": { + InstanceType: "c7a.metal-48xl", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c7a.xlarge": { + InstanceType: "c7a.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "c7g.12xlarge": { + InstanceType: "c7g.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c7g.16xlarge": { + InstanceType: "c7g.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c7g.2xlarge": { + InstanceType: "c7g.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c7g.4xlarge": { + InstanceType: "c7g.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c7g.8xlarge": { + InstanceType: "c7g.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c7g.large": { + InstanceType: "c7g.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c7g.medium": { + InstanceType: "c7g.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c7g.metal": { + InstanceType: "c7g.metal", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c7g.xlarge": { + InstanceType: "c7g.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.12xlarge": { + InstanceType: "c7gd.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.16xlarge": { + InstanceType: "c7gd.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.2xlarge": { + InstanceType: "c7gd.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.4xlarge": { + InstanceType: "c7gd.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.8xlarge": { + InstanceType: "c7gd.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.large": { + InstanceType: "c7gd.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.medium": { + InstanceType: "c7gd.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c7gd.xlarge": { + InstanceType: "c7gd.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.12xlarge": { + InstanceType: "c7gn.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.16xlarge": { + InstanceType: "c7gn.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.2xlarge": { + InstanceType: "c7gn.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.4xlarge": { + InstanceType: "c7gn.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.8xlarge": { + InstanceType: "c7gn.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.large": { + InstanceType: "c7gn.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.medium": { + InstanceType: "c7gn.medium", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "c7gn.xlarge": { + InstanceType: "c7gn.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "c7i.12xlarge": { + InstanceType: "c7i.12xlarge", + VCPU: 48, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "c7i.16xlarge": { + InstanceType: "c7i.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "c7i.24xlarge": { + InstanceType: "c7i.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c7i.2xlarge": { + InstanceType: "c7i.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "c7i.48xlarge": { + InstanceType: "c7i.48xlarge", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c7i.4xlarge": { + InstanceType: "c7i.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "c7i.8xlarge": { + InstanceType: "c7i.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "c7i.large": { + InstanceType: "c7i.large", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "c7i.metal-24xl": { + InstanceType: "c7i.metal-24xl", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "c7i.metal-48xl": { + InstanceType: "c7i.metal-48xl", + VCPU: 192, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "c7i.xlarge": { + InstanceType: "c7i.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "d2.2xlarge": { + InstanceType: "d2.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 0, + Architecture: "amd64", + }, + "d2.4xlarge": { + InstanceType: "d2.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "d2.8xlarge": { + InstanceType: "d2.8xlarge", + VCPU: 36, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "d2.xlarge": { + InstanceType: "d2.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 0, + Architecture: "amd64", + }, + "d3.2xlarge": { + InstanceType: "d3.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "d3.4xlarge": { + InstanceType: "d3.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "d3.8xlarge": { + InstanceType: "d3.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "d3.xlarge": { + InstanceType: "d3.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "d3en.12xlarge": { + InstanceType: "d3en.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "d3en.2xlarge": { + InstanceType: "d3en.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "d3en.4xlarge": { + InstanceType: "d3en.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "d3en.6xlarge": { + InstanceType: "d3en.6xlarge", + VCPU: 24, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "d3en.8xlarge": { + InstanceType: "d3en.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "d3en.xlarge": { + InstanceType: "d3en.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "dl1.24xlarge": { + InstanceType: "dl1.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 8, + Architecture: "amd64", + }, + "f1.16xlarge": { + InstanceType: "f1.16xlarge", + VCPU: 64, + MemoryMb: 999424, + GPU: 0, + Architecture: "amd64", + }, + "f1.2xlarge": { + InstanceType: "f1.2xlarge", + VCPU: 8, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "f1.4xlarge": { + InstanceType: "f1.4xlarge", + VCPU: 16, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "g2.2xlarge": { + InstanceType: "g2.2xlarge", + VCPU: 8, + MemoryMb: 15360, + GPU: 1, + Architecture: "amd64", + }, + "g2.8xlarge": { + InstanceType: "g2.8xlarge", + VCPU: 32, + MemoryMb: 61440, + GPU: 4, + Architecture: "amd64", + }, + "g3.16xlarge": { + InstanceType: "g3.16xlarge", + VCPU: 64, + MemoryMb: 499712, + GPU: 4, + Architecture: "amd64", + }, + "g3.4xlarge": { + InstanceType: "g3.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 1, + Architecture: "amd64", + }, + "g3.8xlarge": { + InstanceType: "g3.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 2, + Architecture: "amd64", + }, + "g3s.xlarge": { + InstanceType: "g3s.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 1, + Architecture: "amd64", + }, + "g4ad.16xlarge": { + InstanceType: "g4ad.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 4, + Architecture: "amd64", + }, + "g4ad.2xlarge": { + InstanceType: "g4ad.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 1, + Architecture: "amd64", + }, + "g4ad.4xlarge": { + InstanceType: "g4ad.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 1, + Architecture: "amd64", + }, + "g4ad.8xlarge": { + InstanceType: "g4ad.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 2, + Architecture: "amd64", + }, + "g4ad.xlarge": { + InstanceType: "g4ad.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 1, + Architecture: "amd64", + }, + "g4dn.12xlarge": { + InstanceType: "g4dn.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 4, + Architecture: "amd64", + }, + "g4dn.16xlarge": { + InstanceType: "g4dn.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 1, + Architecture: "amd64", + }, + "g4dn.2xlarge": { + InstanceType: "g4dn.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 1, + Architecture: "amd64", + }, + "g4dn.4xlarge": { + InstanceType: "g4dn.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 1, + Architecture: "amd64", + }, + "g4dn.8xlarge": { + InstanceType: "g4dn.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 1, + Architecture: "amd64", + }, + "g4dn.metal": { + InstanceType: "g4dn.metal", + VCPU: 96, + MemoryMb: 393216, + GPU: 8, + Architecture: "amd64", + }, + "g4dn.xlarge": { + InstanceType: "g4dn.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 1, + Architecture: "amd64", + }, + "g5.12xlarge": { + InstanceType: "g5.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 4, + Architecture: "amd64", + }, + "g5.16xlarge": { + InstanceType: "g5.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 1, + Architecture: "amd64", + }, + "g5.24xlarge": { + InstanceType: "g5.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 4, + Architecture: "amd64", + }, + "g5.2xlarge": { + InstanceType: "g5.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 1, + Architecture: "amd64", + }, + "g5.48xlarge": { + InstanceType: "g5.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 8, + Architecture: "amd64", + }, + "g5.4xlarge": { + InstanceType: "g5.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 1, + Architecture: "amd64", + }, + "g5.8xlarge": { + InstanceType: "g5.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 1, + Architecture: "amd64", + }, + "g5.xlarge": { + InstanceType: "g5.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 1, + Architecture: "amd64", + }, + "g5g.16xlarge": { + InstanceType: "g5g.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 2, + Architecture: "arm64", + }, + "g5g.2xlarge": { + InstanceType: "g5g.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 1, + Architecture: "arm64", + }, + "g5g.4xlarge": { + InstanceType: "g5g.4xlarge", + VCPU: 16, + MemoryMb: 32768, + GPU: 1, + Architecture: "arm64", + }, + "g5g.8xlarge": { + InstanceType: "g5g.8xlarge", + VCPU: 32, + MemoryMb: 65536, + GPU: 1, + Architecture: "arm64", + }, + "g5g.metal": { + InstanceType: "g5g.metal", + VCPU: 64, + MemoryMb: 131072, + GPU: 2, + Architecture: "arm64", + }, + "g5g.xlarge": { + InstanceType: "g5g.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 1, + Architecture: "arm64", + }, + "g6.12xlarge": { + InstanceType: "g6.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 4, + Architecture: "amd64", + }, + "g6.16xlarge": { + InstanceType: "g6.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 1, + Architecture: "amd64", + }, + "g6.24xlarge": { + InstanceType: "g6.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 4, + Architecture: "amd64", + }, + "g6.2xlarge": { + InstanceType: "g6.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 1, + Architecture: "amd64", + }, + "g6.48xlarge": { + InstanceType: "g6.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 8, + Architecture: "amd64", + }, + "g6.4xlarge": { + InstanceType: "g6.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 1, + Architecture: "amd64", + }, + "g6.8xlarge": { + InstanceType: "g6.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 1, + Architecture: "amd64", + }, + "g6.xlarge": { + InstanceType: "g6.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 1, + Architecture: "amd64", + }, + "gr6.4xlarge": { + InstanceType: "gr6.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 1, + Architecture: "amd64", + }, + "gr6.8xlarge": { + InstanceType: "gr6.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 1, + Architecture: "amd64", + }, + "h1.16xlarge": { + InstanceType: "h1.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "h1.2xlarge": { + InstanceType: "h1.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "h1.4xlarge": { + InstanceType: "h1.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "h1.8xlarge": { + InstanceType: "h1.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "hpc7g.16xlarge": { + InstanceType: "hpc7g.16xlarge", + VCPU: 64, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "hpc7g.4xlarge": { + InstanceType: "hpc7g.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "hpc7g.8xlarge": { + InstanceType: "hpc7g.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "i2.2xlarge": { + InstanceType: "i2.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 0, + Architecture: "amd64", + }, + "i2.4xlarge": { + InstanceType: "i2.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "i2.8xlarge": { + InstanceType: "i2.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "i2.xlarge": { + InstanceType: "i2.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 0, + Architecture: "amd64", + }, + "i3.16xlarge": { + InstanceType: "i3.16xlarge", + VCPU: 64, + MemoryMb: 499712, + GPU: 0, + Architecture: "amd64", + }, + "i3.2xlarge": { + InstanceType: "i3.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 0, + Architecture: "amd64", + }, + "i3.4xlarge": { + InstanceType: "i3.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "i3.8xlarge": { + InstanceType: "i3.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "i3.large": { + InstanceType: "i3.large", + VCPU: 2, + MemoryMb: 15616, + GPU: 0, + Architecture: "amd64", + }, + "i3.metal": { + InstanceType: "i3.metal", + VCPU: 72, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "i3.xlarge": { + InstanceType: "i3.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 0, + Architecture: "amd64", + }, + "i3en.12xlarge": { + InstanceType: "i3en.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "i3en.24xlarge": { + InstanceType: "i3en.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "i3en.2xlarge": { + InstanceType: "i3en.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "i3en.3xlarge": { + InstanceType: "i3en.3xlarge", + VCPU: 12, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "i3en.6xlarge": { + InstanceType: "i3en.6xlarge", + VCPU: 24, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "i3en.large": { + InstanceType: "i3en.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "i3en.metal": { + InstanceType: "i3en.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "i3en.xlarge": { + InstanceType: "i3en.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "i4g.16xlarge": { + InstanceType: "i4g.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "i4g.2xlarge": { + InstanceType: "i4g.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "i4g.4xlarge": { + InstanceType: "i4g.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "i4g.8xlarge": { + InstanceType: "i4g.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "i4g.large": { + InstanceType: "i4g.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "i4g.xlarge": { + InstanceType: "i4g.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "i4i.12xlarge": { + InstanceType: "i4i.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "i4i.16xlarge": { + InstanceType: "i4i.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "i4i.24xlarge": { + InstanceType: "i4i.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "i4i.2xlarge": { + InstanceType: "i4i.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "i4i.32xlarge": { + InstanceType: "i4i.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "i4i.4xlarge": { + InstanceType: "i4i.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "i4i.8xlarge": { + InstanceType: "i4i.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "i4i.large": { + InstanceType: "i4i.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "i4i.metal": { + InstanceType: "i4i.metal", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "i4i.xlarge": { + InstanceType: "i4i.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "im4gn.16xlarge": { + InstanceType: "im4gn.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "im4gn.2xlarge": { + InstanceType: "im4gn.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "im4gn.4xlarge": { + InstanceType: "im4gn.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "im4gn.8xlarge": { + InstanceType: "im4gn.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "im4gn.large": { + InstanceType: "im4gn.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "im4gn.xlarge": { + InstanceType: "im4gn.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "inf1.24xlarge": { + InstanceType: "inf1.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "inf1.2xlarge": { + InstanceType: "inf1.2xlarge", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "inf1.6xlarge": { + InstanceType: "inf1.6xlarge", + VCPU: 24, + MemoryMb: 49152, + GPU: 0, + Architecture: "amd64", + }, + "inf1.xlarge": { + InstanceType: "inf1.xlarge", + VCPU: 4, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "inf2.24xlarge": { + InstanceType: "inf2.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "inf2.48xlarge": { + InstanceType: "inf2.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "inf2.8xlarge": { + InstanceType: "inf2.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "inf2.xlarge": { + InstanceType: "inf2.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "is4gen.2xlarge": { + InstanceType: "is4gen.2xlarge", + VCPU: 8, + MemoryMb: 49152, + GPU: 0, + Architecture: "arm64", + }, + "is4gen.4xlarge": { + InstanceType: "is4gen.4xlarge", + VCPU: 16, + MemoryMb: 98304, + GPU: 0, + Architecture: "arm64", + }, + "is4gen.8xlarge": { + InstanceType: "is4gen.8xlarge", + VCPU: 32, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "is4gen.large": { + InstanceType: "is4gen.large", + VCPU: 2, + MemoryMb: 12288, + GPU: 0, + Architecture: "arm64", + }, + "is4gen.medium": { + InstanceType: "is4gen.medium", + VCPU: 1, + MemoryMb: 6144, + GPU: 0, + Architecture: "arm64", + }, + "is4gen.xlarge": { + InstanceType: "is4gen.xlarge", + VCPU: 4, + MemoryMb: 24576, + GPU: 0, + Architecture: "arm64", + }, + "m1.large": { + InstanceType: "m1.large", + VCPU: 2, + MemoryMb: 7680, + GPU: 0, + Architecture: "amd64", + }, + "m1.medium": { + InstanceType: "m1.medium", + VCPU: 1, + MemoryMb: 3788, + GPU: 0, + Architecture: "amd64", + }, + "m1.small": { + InstanceType: "m1.small", + VCPU: 1, + MemoryMb: 1740, + GPU: 0, + Architecture: "amd64", + }, + "m1.xlarge": { + InstanceType: "m1.xlarge", + VCPU: 4, + MemoryMb: 15360, + GPU: 0, + Architecture: "amd64", + }, + "m2.2xlarge": { + InstanceType: "m2.2xlarge", + VCPU: 4, + MemoryMb: 35020, + GPU: 0, + Architecture: "amd64", + }, + "m2.4xlarge": { + InstanceType: "m2.4xlarge", + VCPU: 8, + MemoryMb: 70041, + GPU: 0, + Architecture: "amd64", + }, + "m2.xlarge": { + InstanceType: "m2.xlarge", + VCPU: 2, + MemoryMb: 17510, + GPU: 0, + Architecture: "amd64", + }, + "m3.2xlarge": { + InstanceType: "m3.2xlarge", + VCPU: 8, + MemoryMb: 30720, + GPU: 0, + Architecture: "amd64", + }, + "m3.large": { + InstanceType: "m3.large", + VCPU: 2, + MemoryMb: 7680, + GPU: 0, + Architecture: "amd64", + }, + "m3.medium": { + InstanceType: "m3.medium", + VCPU: 1, + MemoryMb: 3840, + GPU: 0, + Architecture: "amd64", + }, + "m3.xlarge": { + InstanceType: "m3.xlarge", + VCPU: 4, + MemoryMb: 15360, + GPU: 0, + Architecture: "amd64", + }, + "m4.10xlarge": { + InstanceType: "m4.10xlarge", + VCPU: 40, + MemoryMb: 163840, + GPU: 0, + Architecture: "amd64", + }, + "m4.16xlarge": { + InstanceType: "m4.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m4.2xlarge": { + InstanceType: "m4.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m4.4xlarge": { + InstanceType: "m4.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m4.large": { + InstanceType: "m4.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m4.xlarge": { + InstanceType: "m4.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5.12xlarge": { + InstanceType: "m5.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5.16xlarge": { + InstanceType: "m5.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5.24xlarge": { + InstanceType: "m5.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5.2xlarge": { + InstanceType: "m5.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5.4xlarge": { + InstanceType: "m5.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5.8xlarge": { + InstanceType: "m5.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5.large": { + InstanceType: "m5.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5.metal": { + InstanceType: "m5.metal", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5.xlarge": { + InstanceType: "m5.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5a.12xlarge": { + InstanceType: "m5a.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5a.16xlarge": { + InstanceType: "m5a.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5a.24xlarge": { + InstanceType: "m5a.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5a.2xlarge": { + InstanceType: "m5a.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5a.4xlarge": { + InstanceType: "m5a.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5a.8xlarge": { + InstanceType: "m5a.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5a.large": { + InstanceType: "m5a.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5a.xlarge": { + InstanceType: "m5a.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.12xlarge": { + InstanceType: "m5ad.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.16xlarge": { + InstanceType: "m5ad.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.24xlarge": { + InstanceType: "m5ad.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.2xlarge": { + InstanceType: "m5ad.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.4xlarge": { + InstanceType: "m5ad.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.8xlarge": { + InstanceType: "m5ad.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.large": { + InstanceType: "m5ad.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5ad.xlarge": { + InstanceType: "m5ad.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5d.12xlarge": { + InstanceType: "m5d.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5d.16xlarge": { + InstanceType: "m5d.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5d.24xlarge": { + InstanceType: "m5d.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5d.2xlarge": { + InstanceType: "m5d.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5d.4xlarge": { + InstanceType: "m5d.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5d.8xlarge": { + InstanceType: "m5d.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5d.large": { + InstanceType: "m5d.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5d.metal": { + InstanceType: "m5d.metal", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5d.xlarge": { + InstanceType: "m5d.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.12xlarge": { + InstanceType: "m5dn.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.16xlarge": { + InstanceType: "m5dn.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.24xlarge": { + InstanceType: "m5dn.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.2xlarge": { + InstanceType: "m5dn.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.4xlarge": { + InstanceType: "m5dn.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.8xlarge": { + InstanceType: "m5dn.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.large": { + InstanceType: "m5dn.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.metal": { + InstanceType: "m5dn.metal", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5dn.xlarge": { + InstanceType: "m5dn.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5n.12xlarge": { + InstanceType: "m5n.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5n.16xlarge": { + InstanceType: "m5n.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m5n.24xlarge": { + InstanceType: "m5n.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5n.2xlarge": { + InstanceType: "m5n.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5n.4xlarge": { + InstanceType: "m5n.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m5n.8xlarge": { + InstanceType: "m5n.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m5n.large": { + InstanceType: "m5n.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5n.metal": { + InstanceType: "m5n.metal", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m5n.xlarge": { + InstanceType: "m5n.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.12xlarge": { + InstanceType: "m5zn.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.2xlarge": { + InstanceType: "m5zn.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.3xlarge": { + InstanceType: "m5zn.3xlarge", + VCPU: 12, + MemoryMb: 49152, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.6xlarge": { + InstanceType: "m5zn.6xlarge", + VCPU: 24, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.large": { + InstanceType: "m5zn.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.metal": { + InstanceType: "m5zn.metal", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m5zn.xlarge": { + InstanceType: "m5zn.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m6a.12xlarge": { + InstanceType: "m6a.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m6a.16xlarge": { + InstanceType: "m6a.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m6a.24xlarge": { + InstanceType: "m6a.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m6a.2xlarge": { + InstanceType: "m6a.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m6a.32xlarge": { + InstanceType: "m6a.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6a.48xlarge": { + InstanceType: "m6a.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m6a.4xlarge": { + InstanceType: "m6a.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m6a.8xlarge": { + InstanceType: "m6a.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m6a.large": { + InstanceType: "m6a.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m6a.metal": { + InstanceType: "m6a.metal", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m6a.xlarge": { + InstanceType: "m6a.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m6g.12xlarge": { + InstanceType: "m6g.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "m6g.16xlarge": { + InstanceType: "m6g.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m6g.2xlarge": { + InstanceType: "m6g.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "m6g.4xlarge": { + InstanceType: "m6g.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "m6g.8xlarge": { + InstanceType: "m6g.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "m6g.large": { + InstanceType: "m6g.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "m6g.medium": { + InstanceType: "m6g.medium", + VCPU: 1, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "m6g.metal": { + InstanceType: "m6g.metal", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m6g.xlarge": { + InstanceType: "m6g.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.12xlarge": { + InstanceType: "m6gd.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.16xlarge": { + InstanceType: "m6gd.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.2xlarge": { + InstanceType: "m6gd.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.4xlarge": { + InstanceType: "m6gd.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.8xlarge": { + InstanceType: "m6gd.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.large": { + InstanceType: "m6gd.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.medium": { + InstanceType: "m6gd.medium", + VCPU: 1, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.metal": { + InstanceType: "m6gd.metal", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m6gd.xlarge": { + InstanceType: "m6gd.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "m6i.12xlarge": { + InstanceType: "m6i.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m6i.16xlarge": { + InstanceType: "m6i.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m6i.24xlarge": { + InstanceType: "m6i.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m6i.2xlarge": { + InstanceType: "m6i.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m6i.32xlarge": { + InstanceType: "m6i.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6i.4xlarge": { + InstanceType: "m6i.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m6i.8xlarge": { + InstanceType: "m6i.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m6i.large": { + InstanceType: "m6i.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m6i.metal": { + InstanceType: "m6i.metal", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6i.xlarge": { + InstanceType: "m6i.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m6id.12xlarge": { + InstanceType: "m6id.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m6id.16xlarge": { + InstanceType: "m6id.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m6id.24xlarge": { + InstanceType: "m6id.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m6id.2xlarge": { + InstanceType: "m6id.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m6id.32xlarge": { + InstanceType: "m6id.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6id.4xlarge": { + InstanceType: "m6id.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m6id.8xlarge": { + InstanceType: "m6id.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m6id.large": { + InstanceType: "m6id.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m6id.metal": { + InstanceType: "m6id.metal", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6id.xlarge": { + InstanceType: "m6id.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.12xlarge": { + InstanceType: "m6idn.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.16xlarge": { + InstanceType: "m6idn.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.24xlarge": { + InstanceType: "m6idn.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.2xlarge": { + InstanceType: "m6idn.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.32xlarge": { + InstanceType: "m6idn.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.4xlarge": { + InstanceType: "m6idn.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.8xlarge": { + InstanceType: "m6idn.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.large": { + InstanceType: "m6idn.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.metal": { + InstanceType: "m6idn.metal", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6idn.xlarge": { + InstanceType: "m6idn.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m6in.12xlarge": { + InstanceType: "m6in.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m6in.16xlarge": { + InstanceType: "m6in.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m6in.24xlarge": { + InstanceType: "m6in.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m6in.2xlarge": { + InstanceType: "m6in.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m6in.32xlarge": { + InstanceType: "m6in.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6in.4xlarge": { + InstanceType: "m6in.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m6in.8xlarge": { + InstanceType: "m6in.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m6in.large": { + InstanceType: "m6in.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m6in.metal": { + InstanceType: "m6in.metal", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m6in.xlarge": { + InstanceType: "m6in.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m7a.12xlarge": { + InstanceType: "m7a.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m7a.16xlarge": { + InstanceType: "m7a.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m7a.24xlarge": { + InstanceType: "m7a.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m7a.2xlarge": { + InstanceType: "m7a.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m7a.32xlarge": { + InstanceType: "m7a.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "m7a.48xlarge": { + InstanceType: "m7a.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m7a.4xlarge": { + InstanceType: "m7a.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m7a.8xlarge": { + InstanceType: "m7a.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m7a.large": { + InstanceType: "m7a.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m7a.medium": { + InstanceType: "m7a.medium", + VCPU: 1, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "m7a.metal-48xl": { + InstanceType: "m7a.metal-48xl", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m7a.xlarge": { + InstanceType: "m7a.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m7g.12xlarge": { + InstanceType: "m7g.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "m7g.16xlarge": { + InstanceType: "m7g.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m7g.2xlarge": { + InstanceType: "m7g.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "m7g.4xlarge": { + InstanceType: "m7g.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "m7g.8xlarge": { + InstanceType: "m7g.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "m7g.large": { + InstanceType: "m7g.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "m7g.medium": { + InstanceType: "m7g.medium", + VCPU: 1, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "m7g.metal": { + InstanceType: "m7g.metal", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m7g.xlarge": { + InstanceType: "m7g.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.12xlarge": { + InstanceType: "m7gd.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.16xlarge": { + InstanceType: "m7gd.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.2xlarge": { + InstanceType: "m7gd.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.4xlarge": { + InstanceType: "m7gd.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.8xlarge": { + InstanceType: "m7gd.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.large": { + InstanceType: "m7gd.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.medium": { + InstanceType: "m7gd.medium", + VCPU: 1, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "m7gd.xlarge": { + InstanceType: "m7gd.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "m7i-flex.2xlarge": { + InstanceType: "m7i-flex.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m7i-flex.4xlarge": { + InstanceType: "m7i-flex.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m7i-flex.8xlarge": { + InstanceType: "m7i-flex.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m7i-flex.large": { + InstanceType: "m7i-flex.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m7i-flex.xlarge": { + InstanceType: "m7i-flex.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "m7i.12xlarge": { + InstanceType: "m7i.12xlarge", + VCPU: 48, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "m7i.16xlarge": { + InstanceType: "m7i.16xlarge", + VCPU: 64, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "m7i.24xlarge": { + InstanceType: "m7i.24xlarge", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m7i.2xlarge": { + InstanceType: "m7i.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "m7i.48xlarge": { + InstanceType: "m7i.48xlarge", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m7i.4xlarge": { + InstanceType: "m7i.4xlarge", + VCPU: 16, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "m7i.8xlarge": { + InstanceType: "m7i.8xlarge", + VCPU: 32, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "m7i.large": { + InstanceType: "m7i.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "m7i.metal-24xl": { + InstanceType: "m7i.metal-24xl", + VCPU: 96, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "m7i.metal-48xl": { + InstanceType: "m7i.metal-48xl", + VCPU: 192, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "m7i.xlarge": { + InstanceType: "m7i.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "mac1.metal": { + InstanceType: "mac1.metal", + VCPU: 12, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "mac2-m2.metal": { + InstanceType: "mac2-m2.metal", + VCPU: 8, + MemoryMb: 24576, + GPU: 0, + Architecture: "amd64", + }, + "mac2.metal": { + InstanceType: "mac2.metal", + VCPU: 8, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "p2.16xlarge": { + InstanceType: "p2.16xlarge", + VCPU: 64, + MemoryMb: 749568, + GPU: 16, + Architecture: "amd64", + }, + "p2.8xlarge": { + InstanceType: "p2.8xlarge", + VCPU: 32, + MemoryMb: 499712, + GPU: 8, + Architecture: "amd64", + }, + "p2.xlarge": { + InstanceType: "p2.xlarge", + VCPU: 4, + MemoryMb: 62464, + GPU: 1, + Architecture: "amd64", + }, + "p3.16xlarge": { + InstanceType: "p3.16xlarge", + VCPU: 64, + MemoryMb: 499712, + GPU: 8, + Architecture: "amd64", + }, + "p3.2xlarge": { + InstanceType: "p3.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 1, + Architecture: "amd64", + }, + "p3.8xlarge": { + InstanceType: "p3.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 4, + Architecture: "amd64", + }, + "p3dn.24xlarge": { + InstanceType: "p3dn.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 8, + Architecture: "amd64", + }, + "p4d.24xlarge": { + InstanceType: "p4d.24xlarge", + VCPU: 96, + MemoryMb: 1179648, + GPU: 8, + Architecture: "amd64", + }, + "p4de.24xlarge": { + InstanceType: "p4de.24xlarge", + VCPU: 96, + MemoryMb: 1179648, + GPU: 8, + Architecture: "amd64", + }, + "p5.48xlarge": { + InstanceType: "p5.48xlarge", + VCPU: 192, + MemoryMb: 2097152, + GPU: 8, + Architecture: "amd64", + }, + "r3.2xlarge": { + InstanceType: "r3.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 0, + Architecture: "amd64", + }, + "r3.4xlarge": { + InstanceType: "r3.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "r3.8xlarge": { + InstanceType: "r3.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "r3.large": { + InstanceType: "r3.large", + VCPU: 2, + MemoryMb: 15360, + GPU: 0, + Architecture: "amd64", + }, + "r3.xlarge": { + InstanceType: "r3.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 0, + Architecture: "amd64", + }, + "r4.16xlarge": { + InstanceType: "r4.16xlarge", + VCPU: 64, + MemoryMb: 499712, + GPU: 0, + Architecture: "amd64", + }, + "r4.2xlarge": { + InstanceType: "r4.2xlarge", + VCPU: 8, + MemoryMb: 62464, + GPU: 0, + Architecture: "amd64", + }, + "r4.4xlarge": { + InstanceType: "r4.4xlarge", + VCPU: 16, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "r4.8xlarge": { + InstanceType: "r4.8xlarge", + VCPU: 32, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "r4.large": { + InstanceType: "r4.large", + VCPU: 2, + MemoryMb: 15616, + GPU: 0, + Architecture: "amd64", + }, + "r4.xlarge": { + InstanceType: "r4.xlarge", + VCPU: 4, + MemoryMb: 31232, + GPU: 0, + Architecture: "amd64", + }, + "r5.12xlarge": { + InstanceType: "r5.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5.16xlarge": { + InstanceType: "r5.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5.24xlarge": { + InstanceType: "r5.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5.2xlarge": { + InstanceType: "r5.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5.4xlarge": { + InstanceType: "r5.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5.8xlarge": { + InstanceType: "r5.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5.large": { + InstanceType: "r5.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5.metal": { + InstanceType: "r5.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5.xlarge": { + InstanceType: "r5.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5a.12xlarge": { + InstanceType: "r5a.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5a.16xlarge": { + InstanceType: "r5a.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5a.24xlarge": { + InstanceType: "r5a.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5a.2xlarge": { + InstanceType: "r5a.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5a.4xlarge": { + InstanceType: "r5a.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5a.8xlarge": { + InstanceType: "r5a.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5a.large": { + InstanceType: "r5a.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5a.xlarge": { + InstanceType: "r5a.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.12xlarge": { + InstanceType: "r5ad.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.16xlarge": { + InstanceType: "r5ad.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.24xlarge": { + InstanceType: "r5ad.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.2xlarge": { + InstanceType: "r5ad.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.4xlarge": { + InstanceType: "r5ad.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.8xlarge": { + InstanceType: "r5ad.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.large": { + InstanceType: "r5ad.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5ad.xlarge": { + InstanceType: "r5ad.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5b.12xlarge": { + InstanceType: "r5b.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5b.16xlarge": { + InstanceType: "r5b.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5b.24xlarge": { + InstanceType: "r5b.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5b.2xlarge": { + InstanceType: "r5b.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5b.4xlarge": { + InstanceType: "r5b.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5b.8xlarge": { + InstanceType: "r5b.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5b.large": { + InstanceType: "r5b.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5b.metal": { + InstanceType: "r5b.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5b.xlarge": { + InstanceType: "r5b.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5d.12xlarge": { + InstanceType: "r5d.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5d.16xlarge": { + InstanceType: "r5d.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5d.24xlarge": { + InstanceType: "r5d.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5d.2xlarge": { + InstanceType: "r5d.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5d.4xlarge": { + InstanceType: "r5d.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5d.8xlarge": { + InstanceType: "r5d.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5d.large": { + InstanceType: "r5d.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5d.metal": { + InstanceType: "r5d.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5d.xlarge": { + InstanceType: "r5d.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.12xlarge": { + InstanceType: "r5dn.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.16xlarge": { + InstanceType: "r5dn.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.24xlarge": { + InstanceType: "r5dn.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.2xlarge": { + InstanceType: "r5dn.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.4xlarge": { + InstanceType: "r5dn.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.8xlarge": { + InstanceType: "r5dn.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.large": { + InstanceType: "r5dn.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.metal": { + InstanceType: "r5dn.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5dn.xlarge": { + InstanceType: "r5dn.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r5n.12xlarge": { + InstanceType: "r5n.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r5n.16xlarge": { + InstanceType: "r5n.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r5n.24xlarge": { + InstanceType: "r5n.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5n.2xlarge": { + InstanceType: "r5n.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r5n.4xlarge": { + InstanceType: "r5n.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r5n.8xlarge": { + InstanceType: "r5n.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r5n.large": { + InstanceType: "r5n.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r5n.metal": { + InstanceType: "r5n.metal", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r5n.xlarge": { + InstanceType: "r5n.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r6a.12xlarge": { + InstanceType: "r6a.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r6a.16xlarge": { + InstanceType: "r6a.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r6a.24xlarge": { + InstanceType: "r6a.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r6a.2xlarge": { + InstanceType: "r6a.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r6a.32xlarge": { + InstanceType: "r6a.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6a.48xlarge": { + InstanceType: "r6a.48xlarge", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r6a.4xlarge": { + InstanceType: "r6a.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r6a.8xlarge": { + InstanceType: "r6a.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r6a.large": { + InstanceType: "r6a.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r6a.metal": { + InstanceType: "r6a.metal", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r6a.xlarge": { + InstanceType: "r6a.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r6g.12xlarge": { + InstanceType: "r6g.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "arm64", + }, + "r6g.16xlarge": { + InstanceType: "r6g.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r6g.2xlarge": { + InstanceType: "r6g.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "r6g.4xlarge": { + InstanceType: "r6g.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "r6g.8xlarge": { + InstanceType: "r6g.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "r6g.large": { + InstanceType: "r6g.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "r6g.medium": { + InstanceType: "r6g.medium", + VCPU: 1, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "r6g.metal": { + InstanceType: "r6g.metal", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r6g.xlarge": { + InstanceType: "r6g.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.12xlarge": { + InstanceType: "r6gd.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.16xlarge": { + InstanceType: "r6gd.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.2xlarge": { + InstanceType: "r6gd.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.4xlarge": { + InstanceType: "r6gd.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.8xlarge": { + InstanceType: "r6gd.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.large": { + InstanceType: "r6gd.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.medium": { + InstanceType: "r6gd.medium", + VCPU: 1, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.metal": { + InstanceType: "r6gd.metal", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r6gd.xlarge": { + InstanceType: "r6gd.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "r6i.12xlarge": { + InstanceType: "r6i.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r6i.16xlarge": { + InstanceType: "r6i.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r6i.24xlarge": { + InstanceType: "r6i.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r6i.2xlarge": { + InstanceType: "r6i.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r6i.32xlarge": { + InstanceType: "r6i.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6i.4xlarge": { + InstanceType: "r6i.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r6i.8xlarge": { + InstanceType: "r6i.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r6i.large": { + InstanceType: "r6i.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r6i.metal": { + InstanceType: "r6i.metal", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6i.xlarge": { + InstanceType: "r6i.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r6id.12xlarge": { + InstanceType: "r6id.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r6id.16xlarge": { + InstanceType: "r6id.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r6id.24xlarge": { + InstanceType: "r6id.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r6id.2xlarge": { + InstanceType: "r6id.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r6id.32xlarge": { + InstanceType: "r6id.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6id.4xlarge": { + InstanceType: "r6id.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r6id.8xlarge": { + InstanceType: "r6id.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r6id.large": { + InstanceType: "r6id.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r6id.metal": { + InstanceType: "r6id.metal", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6id.xlarge": { + InstanceType: "r6id.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.12xlarge": { + InstanceType: "r6idn.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.16xlarge": { + InstanceType: "r6idn.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.24xlarge": { + InstanceType: "r6idn.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.2xlarge": { + InstanceType: "r6idn.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.32xlarge": { + InstanceType: "r6idn.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.4xlarge": { + InstanceType: "r6idn.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.8xlarge": { + InstanceType: "r6idn.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.large": { + InstanceType: "r6idn.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.metal": { + InstanceType: "r6idn.metal", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6idn.xlarge": { + InstanceType: "r6idn.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r6in.12xlarge": { + InstanceType: "r6in.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r6in.16xlarge": { + InstanceType: "r6in.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r6in.24xlarge": { + InstanceType: "r6in.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r6in.2xlarge": { + InstanceType: "r6in.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r6in.32xlarge": { + InstanceType: "r6in.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6in.4xlarge": { + InstanceType: "r6in.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r6in.8xlarge": { + InstanceType: "r6in.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r6in.large": { + InstanceType: "r6in.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r6in.metal": { + InstanceType: "r6in.metal", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r6in.xlarge": { + InstanceType: "r6in.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r7a.12xlarge": { + InstanceType: "r7a.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r7a.16xlarge": { + InstanceType: "r7a.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r7a.24xlarge": { + InstanceType: "r7a.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r7a.2xlarge": { + InstanceType: "r7a.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r7a.32xlarge": { + InstanceType: "r7a.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r7a.48xlarge": { + InstanceType: "r7a.48xlarge", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r7a.4xlarge": { + InstanceType: "r7a.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r7a.8xlarge": { + InstanceType: "r7a.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r7a.large": { + InstanceType: "r7a.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r7a.medium": { + InstanceType: "r7a.medium", + VCPU: 1, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "r7a.metal-48xl": { + InstanceType: "r7a.metal-48xl", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r7a.xlarge": { + InstanceType: "r7a.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r7g.12xlarge": { + InstanceType: "r7g.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "arm64", + }, + "r7g.16xlarge": { + InstanceType: "r7g.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r7g.2xlarge": { + InstanceType: "r7g.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "r7g.4xlarge": { + InstanceType: "r7g.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "r7g.8xlarge": { + InstanceType: "r7g.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "r7g.large": { + InstanceType: "r7g.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "r7g.medium": { + InstanceType: "r7g.medium", + VCPU: 1, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "r7g.metal": { + InstanceType: "r7g.metal", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r7g.xlarge": { + InstanceType: "r7g.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.12xlarge": { + InstanceType: "r7gd.12xlarge", + VCPU: 48, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.16xlarge": { + InstanceType: "r7gd.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.2xlarge": { + InstanceType: "r7gd.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.4xlarge": { + InstanceType: "r7gd.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.8xlarge": { + InstanceType: "r7gd.8xlarge", + VCPU: 32, + MemoryMb: 196608, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.large": { + InstanceType: "r7gd.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.medium": { + InstanceType: "r7gd.medium", + VCPU: 1, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "r7gd.xlarge": { + InstanceType: "r7gd.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "r7i.12xlarge": { + InstanceType: "r7i.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r7i.16xlarge": { + InstanceType: "r7i.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r7i.24xlarge": { + InstanceType: "r7i.24xlarge", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r7i.2xlarge": { + InstanceType: "r7i.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r7i.48xlarge": { + InstanceType: "r7i.48xlarge", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r7i.4xlarge": { + InstanceType: "r7i.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r7i.8xlarge": { + InstanceType: "r7i.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r7i.large": { + InstanceType: "r7i.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r7i.metal-24xl": { + InstanceType: "r7i.metal-24xl", + VCPU: 96, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "r7i.metal-48xl": { + InstanceType: "r7i.metal-48xl", + VCPU: 192, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "r7i.xlarge": { + InstanceType: "r7i.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.12xlarge": { + InstanceType: "r7iz.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.16xlarge": { + InstanceType: "r7iz.16xlarge", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.2xlarge": { + InstanceType: "r7iz.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.32xlarge": { + InstanceType: "r7iz.32xlarge", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.4xlarge": { + InstanceType: "r7iz.4xlarge", + VCPU: 16, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.8xlarge": { + InstanceType: "r7iz.8xlarge", + VCPU: 32, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.large": { + InstanceType: "r7iz.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.metal-16xl": { + InstanceType: "r7iz.metal-16xl", + VCPU: 64, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.metal-32xl": { + InstanceType: "r7iz.metal-32xl", + VCPU: 128, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "r7iz.xlarge": { + InstanceType: "r7iz.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "t1.micro": { + InstanceType: "t1.micro", + VCPU: 1, + MemoryMb: 627, + GPU: 0, + Architecture: "amd64", + }, + "t2.2xlarge": { + InstanceType: "t2.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "t2.large": { + InstanceType: "t2.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "t2.medium": { + InstanceType: "t2.medium", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "t2.micro": { + InstanceType: "t2.micro", + VCPU: 1, + MemoryMb: 1024, + GPU: 0, + Architecture: "amd64", + }, + "t2.nano": { + InstanceType: "t2.nano", + VCPU: 1, + MemoryMb: 512, + GPU: 0, + Architecture: "amd64", + }, + "t2.small": { + InstanceType: "t2.small", + VCPU: 1, + MemoryMb: 2048, + GPU: 0, + Architecture: "amd64", + }, + "t2.xlarge": { + InstanceType: "t2.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "t3.2xlarge": { + InstanceType: "t3.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "t3.large": { + InstanceType: "t3.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "t3.medium": { + InstanceType: "t3.medium", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "t3.micro": { + InstanceType: "t3.micro", + VCPU: 2, + MemoryMb: 1024, + GPU: 0, + Architecture: "amd64", + }, + "t3.nano": { + InstanceType: "t3.nano", + VCPU: 2, + MemoryMb: 512, + GPU: 0, + Architecture: "amd64", + }, + "t3.small": { + InstanceType: "t3.small", + VCPU: 2, + MemoryMb: 2048, + GPU: 0, + Architecture: "amd64", + }, + "t3.xlarge": { + InstanceType: "t3.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "t3a.2xlarge": { + InstanceType: "t3a.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "t3a.large": { + InstanceType: "t3a.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "amd64", + }, + "t3a.medium": { + InstanceType: "t3a.medium", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "amd64", + }, + "t3a.micro": { + InstanceType: "t3a.micro", + VCPU: 2, + MemoryMb: 1024, + GPU: 0, + Architecture: "amd64", + }, + "t3a.nano": { + InstanceType: "t3a.nano", + VCPU: 2, + MemoryMb: 512, + GPU: 0, + Architecture: "amd64", + }, + "t3a.small": { + InstanceType: "t3a.small", + VCPU: 2, + MemoryMb: 2048, + GPU: 0, + Architecture: "amd64", + }, + "t3a.xlarge": { + InstanceType: "t3a.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "t4g.2xlarge": { + InstanceType: "t4g.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "t4g.large": { + InstanceType: "t4g.large", + VCPU: 2, + MemoryMb: 8192, + GPU: 0, + Architecture: "arm64", + }, + "t4g.medium": { + InstanceType: "t4g.medium", + VCPU: 2, + MemoryMb: 4096, + GPU: 0, + Architecture: "arm64", + }, + "t4g.micro": { + InstanceType: "t4g.micro", + VCPU: 2, + MemoryMb: 1024, + GPU: 0, + Architecture: "arm64", + }, + "t4g.nano": { + InstanceType: "t4g.nano", + VCPU: 2, + MemoryMb: 512, + GPU: 0, + Architecture: "arm64", + }, + "t4g.small": { + InstanceType: "t4g.small", + VCPU: 2, + MemoryMb: 2048, + GPU: 0, + Architecture: "arm64", + }, + "t4g.xlarge": { + InstanceType: "t4g.xlarge", + VCPU: 4, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "trn1.2xlarge": { + InstanceType: "trn1.2xlarge", + VCPU: 8, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, + "trn1.32xlarge": { + InstanceType: "trn1.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "trn1n.32xlarge": { + InstanceType: "trn1n.32xlarge", + VCPU: 128, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "u-12tb1.112xlarge": { + InstanceType: "u-12tb1.112xlarge", + VCPU: 448, + MemoryMb: 12582912, + GPU: 0, + Architecture: "amd64", + }, + "u-18tb1.112xlarge": { + InstanceType: "u-18tb1.112xlarge", + VCPU: 448, + MemoryMb: 18874368, + GPU: 0, + Architecture: "amd64", + }, + "u-24tb1.112xlarge": { + InstanceType: "u-24tb1.112xlarge", + VCPU: 448, + MemoryMb: 25165824, + GPU: 0, + Architecture: "amd64", + }, + "u-3tb1.56xlarge": { + InstanceType: "u-3tb1.56xlarge", + VCPU: 224, + MemoryMb: 3145728, + GPU: 0, + Architecture: "amd64", + }, + "u-6tb1.112xlarge": { + InstanceType: "u-6tb1.112xlarge", + VCPU: 448, + MemoryMb: 6291456, + GPU: 0, + Architecture: "amd64", + }, + "u-6tb1.56xlarge": { + InstanceType: "u-6tb1.56xlarge", + VCPU: 224, + MemoryMb: 6291456, + GPU: 0, + Architecture: "amd64", + }, + "u-9tb1.112xlarge": { + InstanceType: "u-9tb1.112xlarge", + VCPU: 448, + MemoryMb: 9437184, + GPU: 0, + Architecture: "amd64", + }, + "vt1.24xlarge": { + InstanceType: "vt1.24xlarge", + VCPU: 96, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "vt1.3xlarge": { + InstanceType: "vt1.3xlarge", + VCPU: 12, + MemoryMb: 24576, + GPU: 0, + Architecture: "amd64", + }, + "vt1.6xlarge": { + InstanceType: "vt1.6xlarge", + VCPU: 24, + MemoryMb: 49152, + GPU: 0, + Architecture: "amd64", + }, + "x1.16xlarge": { + InstanceType: "x1.16xlarge", + VCPU: 64, + MemoryMb: 999424, + GPU: 0, + Architecture: "amd64", + }, + "x1.32xlarge": { + InstanceType: "x1.32xlarge", + VCPU: 128, + MemoryMb: 1998848, + GPU: 0, + Architecture: "amd64", + }, + "x1e.16xlarge": { + InstanceType: "x1e.16xlarge", + VCPU: 64, + MemoryMb: 1998848, + GPU: 0, + Architecture: "amd64", + }, + "x1e.2xlarge": { + InstanceType: "x1e.2xlarge", + VCPU: 8, + MemoryMb: 249856, + GPU: 0, + Architecture: "amd64", + }, + "x1e.32xlarge": { + InstanceType: "x1e.32xlarge", + VCPU: 128, + MemoryMb: 3997696, + GPU: 0, + Architecture: "amd64", + }, + "x1e.4xlarge": { + InstanceType: "x1e.4xlarge", + VCPU: 16, + MemoryMb: 499712, + GPU: 0, + Architecture: "amd64", + }, + "x1e.8xlarge": { + InstanceType: "x1e.8xlarge", + VCPU: 32, + MemoryMb: 999424, + GPU: 0, + Architecture: "amd64", + }, + "x1e.xlarge": { + InstanceType: "x1e.xlarge", + VCPU: 4, + MemoryMb: 124928, + GPU: 0, + Architecture: "amd64", + }, + "x2gd.12xlarge": { + InstanceType: "x2gd.12xlarge", + VCPU: 48, + MemoryMb: 786432, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.16xlarge": { + InstanceType: "x2gd.16xlarge", + VCPU: 64, + MemoryMb: 1048576, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.2xlarge": { + InstanceType: "x2gd.2xlarge", + VCPU: 8, + MemoryMb: 131072, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.4xlarge": { + InstanceType: "x2gd.4xlarge", + VCPU: 16, + MemoryMb: 262144, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.8xlarge": { + InstanceType: "x2gd.8xlarge", + VCPU: 32, + MemoryMb: 524288, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.large": { + InstanceType: "x2gd.large", + VCPU: 2, + MemoryMb: 32768, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.medium": { + InstanceType: "x2gd.medium", + VCPU: 1, + MemoryMb: 16384, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.metal": { + InstanceType: "x2gd.metal", + VCPU: 64, + MemoryMb: 1048576, + GPU: 0, + Architecture: "arm64", + }, + "x2gd.xlarge": { + InstanceType: "x2gd.xlarge", + VCPU: 4, + MemoryMb: 65536, + GPU: 0, + Architecture: "arm64", + }, + "x2idn.16xlarge": { + InstanceType: "x2idn.16xlarge", + VCPU: 64, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "x2idn.24xlarge": { + InstanceType: "x2idn.24xlarge", + VCPU: 96, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "x2idn.32xlarge": { + InstanceType: "x2idn.32xlarge", + VCPU: 128, + MemoryMb: 2097152, + GPU: 0, + Architecture: "amd64", + }, + "x2idn.metal": { + InstanceType: "x2idn.metal", + VCPU: 128, + MemoryMb: 2097152, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.16xlarge": { + InstanceType: "x2iedn.16xlarge", + VCPU: 64, + MemoryMb: 2097152, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.24xlarge": { + InstanceType: "x2iedn.24xlarge", + VCPU: 96, + MemoryMb: 3145728, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.2xlarge": { + InstanceType: "x2iedn.2xlarge", + VCPU: 8, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.32xlarge": { + InstanceType: "x2iedn.32xlarge", + VCPU: 128, + MemoryMb: 4194304, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.4xlarge": { + InstanceType: "x2iedn.4xlarge", + VCPU: 16, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.8xlarge": { + InstanceType: "x2iedn.8xlarge", + VCPU: 32, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.metal": { + InstanceType: "x2iedn.metal", + VCPU: 128, + MemoryMb: 4194304, + GPU: 0, + Architecture: "amd64", + }, + "x2iedn.xlarge": { + InstanceType: "x2iedn.xlarge", + VCPU: 4, + MemoryMb: 131072, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.12xlarge": { + InstanceType: "x2iezn.12xlarge", + VCPU: 48, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.2xlarge": { + InstanceType: "x2iezn.2xlarge", + VCPU: 8, + MemoryMb: 262144, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.4xlarge": { + InstanceType: "x2iezn.4xlarge", + VCPU: 16, + MemoryMb: 524288, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.6xlarge": { + InstanceType: "x2iezn.6xlarge", + VCPU: 24, + MemoryMb: 786432, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.8xlarge": { + InstanceType: "x2iezn.8xlarge", + VCPU: 32, + MemoryMb: 1048576, + GPU: 0, + Architecture: "amd64", + }, + "x2iezn.metal": { + InstanceType: "x2iezn.metal", + VCPU: 48, + MemoryMb: 1572864, + GPU: 0, + Architecture: "amd64", + }, + "z1d.12xlarge": { + InstanceType: "z1d.12xlarge", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "z1d.2xlarge": { + InstanceType: "z1d.2xlarge", + VCPU: 8, + MemoryMb: 65536, + GPU: 0, + Architecture: "amd64", + }, + "z1d.3xlarge": { + InstanceType: "z1d.3xlarge", + VCPU: 12, + MemoryMb: 98304, + GPU: 0, + Architecture: "amd64", + }, + "z1d.6xlarge": { + InstanceType: "z1d.6xlarge", + VCPU: 24, + MemoryMb: 196608, + GPU: 0, + Architecture: "amd64", + }, + "z1d.large": { + InstanceType: "z1d.large", + VCPU: 2, + MemoryMb: 16384, + GPU: 0, + Architecture: "amd64", + }, + "z1d.metal": { + InstanceType: "z1d.metal", + VCPU: 48, + MemoryMb: 393216, + GPU: 0, + Architecture: "amd64", + }, + "z1d.xlarge": { + InstanceType: "z1d.xlarge", + VCPU: 4, + MemoryMb: 32768, + GPU: 0, + Architecture: "amd64", + }, +} diff --git a/pkg/cloudprovider/aws/manager.go b/pkg/cloudprovider/aws/manager.go new file mode 100644 index 0000000..389dbf1 --- /dev/null +++ b/pkg/cloudprovider/aws/manager.go @@ -0,0 +1,224 @@ +/* +Copyright 2016 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. +*/ + +//go:generate go run ec2_instance_types/gen.go -region $AWS_REGION + +package aws + +import ( + "errors" + "fmt" + "strings" + "time" + + apiv1 "k8s.io/api/core/v1" + "k8s.io/klog/v2" +) + +const ( + operationWaitTimeout = 5 * time.Second + operationPollInterval = 100 * time.Millisecond + maxRecordsReturnedByAPI = 100 + maxAsgNamesPerDescribe = 100 + refreshInterval = 1 * time.Minute + autoDiscovererTypeASG = "asg" + asgAutoDiscovererKeyTag = "tag" + optionsTagsPrefix = "k8s.io/cluster-autoscaler/node-template/autoscaling-options/" + labelAwsCSITopologyZone = "topology.ebs.csi.aws.com/zone" +) + +// AwsManager is handles aws communication and data caching. +type AwsManager struct { + awsService awsWrapper + asgCache *asgCache + lastRefresh time.Time + instanceTypes map[string]*InstanceType +} + +type asgTemplate struct { + InstanceType *InstanceType + Region string + Zone string + Tags []string +} + +// createAwsManagerInternal allows for custom objects to be passed in by tests +func createAWSManagerInternal( + awsService *awsWrapper, + instanceTypes map[string]*InstanceType, +) (*AwsManager, error) { + + cache, err := newASGCache(awsService, []string{}) + if err != nil { + return nil, err + } + + manager := &AwsManager{ + awsService: *awsService, + asgCache: cache, + instanceTypes: instanceTypes, + } + + if err := manager.forceRefresh(); err != nil { + return nil, err + } + + return manager, nil +} + +// Refresh is called before every main loop and can be used to dynamically update cloud provider state. +// In particular the list of node groups returned by NodeGroups can change as a result of CloudProvider.Refresh(). +func (m *AwsManager) Refresh() error { + if m.lastRefresh.Add(refreshInterval).After(time.Now()) { + return nil + } + return m.forceRefresh() +} + +func (m *AwsManager) forceRefresh() error { + if err := m.asgCache.regenerate(); err != nil { + klog.Errorf("Failed to regenerate ASG cache: %v", err) + return err + } + m.lastRefresh = time.Now() + klog.V(2).Infof("Refreshed ASG list, next refresh after %v", m.lastRefresh.Add(refreshInterval)) + return nil +} + +// GetAsgForInstance returns AsgConfig of the given Instance +func (m *AwsManager) GetAsgForInstance(instance AwsInstanceRef) *asg { + return m.asgCache.FindForInstance(instance) +} + +// Cleanup the ASG cache. +func (m *AwsManager) Cleanup() { + m.asgCache.Cleanup() +} + +func (m *AwsManager) getAsgs() map[AwsRef]*asg { + return m.asgCache.Get() +} + +func (m *AwsManager) getAutoscalingOptions(ref AwsRef) map[string]string { + return m.asgCache.GetAutoscalingOptions(ref) +} + +// SetAsgSize sets ASG size. +func (m *AwsManager) SetAsgSize(asg *asg, size int) error { + return m.asgCache.SetAsgSize(asg, size) +} + +// DeleteInstances deletes the given instances. All instances must be controlled by the same ASG. +func (m *AwsManager) DeleteInstances(instances []*AwsInstanceRef) error { + if err := m.asgCache.DeleteInstances(instances); err != nil { + return err + } + klog.V(2).Infof("DeleteInstances was called: scheduling an ASG list refresh for next main loop evaluation") + m.lastRefresh = time.Now().Add(-refreshInterval) + return nil +} + +// GetAsgNodes returns Asg nodes. +func (m *AwsManager) GetAsgNodes(ref AwsRef) ([]AwsInstanceRef, error) { + return m.asgCache.InstancesByAsg(ref) +} + +// GetInstanceStatus returns the status of ASG nodes +func (m *AwsManager) GetInstanceStatus(ref AwsInstanceRef) (*string, error) { + return m.asgCache.InstanceStatus(ref) +} + +func (m *AwsManager) getAsgTemplate(asg *asg) (*asgTemplate, error) { + if len(asg.AvailabilityZones) < 1 { + return nil, fmt.Errorf("unable to get first AvailabilityZone for ASG %q", asg.Name) + } + + az := asg.AvailabilityZones[0] + region := az[0 : len(az)-1] + + if len(asg.AvailabilityZones) > 1 { + klog.V(4).Infof("Found multiple availability zones for ASG %q; using %s for %s label\n", asg.Name, az, apiv1.LabelZoneFailureDomain) + } + + instanceTypeName, err := getInstanceTypeForAsg(m.asgCache, asg) + if err != nil { + return nil, err + } + + if t, ok := m.instanceTypes[instanceTypeName]; ok { + return &asgTemplate{ + InstanceType: t, + Region: region, + Zone: az, + }, nil + } + + return nil, fmt.Errorf("ASG %q uses the unknown EC2 instance type %q", asg.Name, instanceTypeName) +} + +func (m *AwsManager) updateCapacityWithRequirementsOverrides(capacity *apiv1.ResourceList, policy *mixedInstancesPolicy) error { + if policy == nil || len(policy.instanceTypesOverrides) > 0 { + return nil + } + + return nil +} + +// An asgAutoDiscoveryConfig specifies how to autodiscover AWS ASGs. +type asgAutoDiscoveryConfig struct { + // Tags to match on. + // Any ASG with all of the provided tag keys will be autoscaled. + Tags map[string]string +} + +func parseASGAutoDiscoverySpec(spec string) (asgAutoDiscoveryConfig, error) { + cfg := asgAutoDiscoveryConfig{} + + tokens := strings.SplitN(spec, ":", 2) + if len(tokens) != 2 { + return cfg, fmt.Errorf("invalid node group auto discovery spec specified via --node-group-auto-discovery: %s", spec) + } + discoverer := tokens[0] + if discoverer != autoDiscovererTypeASG { + return cfg, fmt.Errorf("unsupported discoverer specified: %s", discoverer) + } + param := tokens[1] + kv := strings.SplitN(param, "=", 2) + if len(kv) != 2 { + return cfg, fmt.Errorf("invalid key=value pair %s", kv) + } + k, v := kv[0], kv[1] + if k != asgAutoDiscovererKeyTag { + return cfg, fmt.Errorf("unsupported parameter key \"%s\" is specified for discoverer \"%s\". The only supported key is \"%s\"", k, discoverer, asgAutoDiscovererKeyTag) + } + if v == "" { + return cfg, errors.New("tag value not supplied") + } + p := strings.Split(v, ",") + if len(p) == 0 { + return cfg, fmt.Errorf("invalid ASG tag for auto discovery specified: ASG tag must not be empty") + } + cfg.Tags = make(map[string]string, len(p)) + for _, label := range p { + lp := strings.SplitN(label, "=", 2) + if len(lp) > 1 { + cfg.Tags[lp[0]] = lp[1] + continue + } + cfg.Tags[lp[0]] = "" + } + return cfg, nil +} diff --git a/pkg/cloudprovider/aws/wrapper.go b/pkg/cloudprovider/aws/wrapper.go new file mode 100644 index 0000000..c015846 --- /dev/null +++ b/pkg/cloudprovider/aws/wrapper.go @@ -0,0 +1,768 @@ +/* +Copyright 2016 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 aws + +import ( + "github.com/aws/aws-sdk-go/service/autoscaling" +) + +// autoScalingI is the interface abstracting specific API calls of the auto-scaling service provided by AWS SDK for use in CA +type autoScalingI interface { + DescribeAutoScalingGroupsPages(input *autoscaling.DescribeAutoScalingGroupsInput, fn func(*autoscaling.DescribeAutoScalingGroupsOutput, bool) bool) error + DescribeLaunchConfigurations(*autoscaling.DescribeLaunchConfigurationsInput) (*autoscaling.DescribeLaunchConfigurationsOutput, error) + DescribeScalingActivities(*autoscaling.DescribeScalingActivitiesInput) (*autoscaling.DescribeScalingActivitiesOutput, error) + SetDesiredCapacity(input *autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error) + TerminateInstanceInAutoScalingGroup(input *autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error) +} + +// awsWrapper provides several utility methods over the services provided by the AWS SDK +type awsWrapper struct { + autoScalingI +} + +func (m *awsWrapper) getInstanceTypesForAsgs(asgs []*asg) (map[string]string, error) { + return nil, nil +} + +func (m *awsWrapper) getAutoscalingGroupsByNames(names []string) ([]*autoscaling.Group, error) { + return nil, nil +} + +/* +func (m *awsWrapper) getManagedNodegroupInfo(nodegroupName string, clusterName string) ([]apiv1.Taint, map[string]string, map[string]string, error) { + params := &eks.DescribeNodegroupInput{ + ClusterName: &clusterName, + NodegroupName: &nodegroupName, + } + + r, err := m.DescribeNodegroup(params) + if err != nil { + return nil, nil, nil, err + } + + klog.V(6).Infof("DescribeNodegroup output : %+v\n", r) + + taints := make([]apiv1.Taint, 0) + labels := make(map[string]string) + tags := make(map[string]string) + + // Labels will include diskSize, amiType, capacityType, version + if r.Nodegroup.DiskSize != nil { + labels["diskSize"] = strconv.FormatInt(*r.Nodegroup.DiskSize, 10) + } + + if r.Nodegroup.AmiType != nil && len(*r.Nodegroup.AmiType) > 0 { + labels["amiType"] = *r.Nodegroup.AmiType + } + + if r.Nodegroup.CapacityType != nil && len(*r.Nodegroup.CapacityType) > 0 { + labels["capacityType"] = *r.Nodegroup.CapacityType + } + + if r.Nodegroup.Version != nil && len(*r.Nodegroup.Version) > 0 { + labels["k8sVersion"] = *r.Nodegroup.Version + } + + if r.Nodegroup.NodegroupName != nil && len(*r.Nodegroup.NodegroupName) > 0 { + labels["eks.amazonaws.com/nodegroup"] = *r.Nodegroup.NodegroupName + } + + if r.Nodegroup.Labels != nil && len(r.Nodegroup.Labels) > 0 { + labelsMap := r.Nodegroup.Labels + for k, v := range labelsMap { + if v != nil { + labels[k] = *v + } + } + } + + if r.Nodegroup.Tags != nil && len(r.Nodegroup.Tags) > 0 { + tagsMap := r.Nodegroup.Tags + for k, v := range tagsMap { + if v != nil { + tags[k] = *v + } + } + } + + if r.Nodegroup.Taints != nil && len(r.Nodegroup.Taints) > 0 { + taintList := r.Nodegroup.Taints + for _, taint := range taintList { + if taint != nil && taint.Effect != nil && taint.Key != nil && taint.Value != nil { + taints = append(taints, apiv1.Taint{ + Key: *taint.Key, + Value: *taint.Value, + Effect: apiv1.TaintEffect(*taint.Effect), + }) + } + } + } + + return taints, labels, tags, nil +} + +func (m *awsWrapper) getInstanceTypeByLaunchConfigNames(launchConfigToQuery []*string) (map[string]string, error) { + launchConfigurationsToInstanceType := map[string]string{} + + for i := 0; i < len(launchConfigToQuery); i += 50 { + end := i + 50 + + if end > len(launchConfigToQuery) { + end = len(launchConfigToQuery) + } + params := &autoscaling.DescribeLaunchConfigurationsInput{ + LaunchConfigurationNames: launchConfigToQuery[i:end], + MaxRecords: aws.Int64(50), + } + start := time.Now() + r, err := m.DescribeLaunchConfigurations(params) + observeAWSRequest("DescribeLaunchConfigurations", err, start) + if err != nil { + return nil, err + } + for _, lc := range r.LaunchConfigurations { + launchConfigurationsToInstanceType[*lc.LaunchConfigurationName] = *lc.InstanceType + } + } + return launchConfigurationsToInstanceType, nil +} + +func (m *awsWrapper) getAutoscalingGroupsByNames(names []string) ([]*autoscaling.Group, error) { + asgs := make([]*autoscaling.Group, 0) + if len(names) == 0 { + return asgs, nil + } + + // AWS only accepts up to 100 ASG names as input, describe them in batches + for i := 0; i < len(names); i += maxAsgNamesPerDescribe { + end := i + maxAsgNamesPerDescribe + + if end > len(names) { + end = len(names) + } + + input := &autoscaling.DescribeAutoScalingGroupsInput{ + AutoScalingGroupNames: aws.StringSlice(names[i:end]), + MaxRecords: aws.Int64(maxRecordsReturnedByAPI), + } + start := time.Now() + err := m.DescribeAutoScalingGroupsPages(input, func(output *autoscaling.DescribeAutoScalingGroupsOutput, _ bool) bool { + asgs = append(asgs, output.AutoScalingGroups...) + // We return true while we want to be called with the next page of + // results, if any. + return true + }) + observeAWSRequest("DescribeAutoScalingGroupsPages", err, start) + if err != nil { + return nil, err + } + } + + return asgs, nil +} + +func (m *awsWrapper) getAutoscalingGroupsByTags(tags map[string]string) ([]*autoscaling.Group, error) { + asgs := make([]*autoscaling.Group, 0) + if len(tags) == 0 { + return asgs, nil + } + + filters := make([]*autoscaling.Filter, 0) + for key, value := range tags { + if value != "" { + filters = append(filters, &autoscaling.Filter{ + Name: aws.String(fmt.Sprintf("tag:%s", key)), + Values: []*string{aws.String(value)}, + }) + } else { + filters = append(filters, &autoscaling.Filter{ + Name: aws.String("tag-key"), + Values: []*string{aws.String(key)}, + }) + } + } + + input := &autoscaling.DescribeAutoScalingGroupsInput{ + Filters: filters, + MaxRecords: aws.Int64(0), + } + + err := m.DescribeAutoScalingGroupsPages(input, func(output *autoscaling.DescribeAutoScalingGroupsOutput, _ bool) bool { + asgs = append(asgs, output.AutoScalingGroups...) + // We return true while we want to be called with the next page of + // results, if any. + return true + }) + + if err != nil { + return nil, err + } + + return asgs, nil +} + +func (m *awsWrapper) getInstanceTypeByLaunchTemplate(launchTemplate *launchTemplate) (string, error) { + templateData, err := m.getLaunchTemplateData(launchTemplate.name, launchTemplate.version) + if err != nil { + return "", err + } + + instanceType := "" + if templateData.InstanceType != nil { + instanceType = *templateData.InstanceType + } else if templateData.InstanceRequirements != nil && templateData.ImageId != nil { + requirementsRequest, err := m.getRequirementsRequestFromEC2(templateData.InstanceRequirements) + if err != nil { + return "", fmt.Errorf("unable to get instance requirements request") + } + instanceType, err = m.getInstanceTypeFromInstanceRequirements(*templateData.ImageId, requirementsRequest) + if err != nil { + return "", err + } + } + if len(instanceType) == 0 { + return "", fmt.Errorf("unable to find instance type using launch template") + } + + return instanceType, nil +} + +func (m *awsWrapper) getInstanceTypeFromRequirementsOverrides(policy *mixedInstancesPolicy) (string, error) { + if policy.launchTemplate == nil { + return "", fmt.Errorf("no launch template found for mixed instances policy") + } + + templateData, err := m.getLaunchTemplateData(policy.launchTemplate.name, policy.launchTemplate.version) + if err != nil { + return "", err + } + + requirements, err := m.getRequirementsRequestFromAutoscaling(policy.instanceRequirementsOverrides) + if err != nil { + return "", err + } + instanceType, err := m.getInstanceTypeFromInstanceRequirements(*templateData.ImageId, requirements) + if err != nil { + return "", err + } + + return instanceType, nil +} + +func (m *awsWrapper) getLaunchTemplateData(templateName string, templateVersion string) (*ec2.ResponseLaunchTemplateData, error) { + describeTemplateInput := &ec2.DescribeLaunchTemplateVersionsInput{ + LaunchTemplateName: aws.String(templateName), + Versions: []*string{aws.String(templateVersion)}, + } + + start := time.Now() + describeData, err := m.DescribeLaunchTemplateVersions(describeTemplateInput) + observeAWSRequest("DescribeLaunchTemplateVersions", err, start) + if err != nil { + return nil, err + } + if describeData == nil || len(describeData.LaunchTemplateVersions) == 0 { + return nil, fmt.Errorf("unable to find template versions for launch template %s", templateName) + } + if describeData.LaunchTemplateVersions[0].LaunchTemplateData == nil { + return nil, fmt.Errorf("no data found for launch template %s, version %s", templateName, templateVersion) + } + + return describeData.LaunchTemplateVersions[0].LaunchTemplateData, nil +} + +func (m *awsWrapper) getInstanceTypeFromInstanceRequirements(imageId string, requirementsRequest *ec2.InstanceRequirementsRequest) (string, error) { + describeImagesInput := &ec2.DescribeImagesInput{ + ImageIds: []*string{aws.String(imageId)}, + } + + start := time.Now() + describeImagesOutput, err := m.DescribeImages(describeImagesInput) + observeAWSRequest("DescribeImages", err, start) + if err != nil { + return "", err + } + + imageArchitectures := []*string{} + imageVirtualizationTypes := []*string{} + for _, image := range describeImagesOutput.Images { + imageArchitectures = append(imageArchitectures, image.Architecture) + imageVirtualizationTypes = append(imageVirtualizationTypes, image.VirtualizationType) + } + + requirementsInput := &ec2.GetInstanceTypesFromInstanceRequirementsInput{ + ArchitectureTypes: imageArchitectures, + InstanceRequirements: requirementsRequest, + VirtualizationTypes: imageVirtualizationTypes, + } + + start = time.Now() + var instanceTypes []string + err = m.GetInstanceTypesFromInstanceRequirementsPages(requirementsInput, func(page *ec2.GetInstanceTypesFromInstanceRequirementsOutput, isLastPage bool) bool { + for _, instanceType := range page.InstanceTypes { + instanceTypes = append(instanceTypes, *instanceType.InstanceType) + } + return !isLastPage + }) + observeAWSRequest("GetInstanceTypesFromInstanceRequirements", err, start) + if err != nil { + return "", fmt.Errorf("unable to get instance types from requirements: %w", err) + } + + if len(instanceTypes) == 0 { + return "", fmt.Errorf("no instance types found for requirements") + } + return instanceTypes[0], nil +} + +func (m *awsWrapper) getRequirementsRequestFromAutoscaling(requirements *autoscaling.InstanceRequirements) (*ec2.InstanceRequirementsRequest, error) { + requirementsRequest := ec2.InstanceRequirementsRequest{} + + // required instance requirements + requirementsRequest.MemoryMiB = &ec2.MemoryMiBRequest{ + Min: requirements.MemoryMiB.Min, + Max: requirements.MemoryMiB.Max, + } + + requirementsRequest.VCpuCount = &ec2.VCpuCountRangeRequest{ + Min: requirements.VCpuCount.Min, + Max: requirements.VCpuCount.Max, + } + + // optional instance requirements + if requirements.AcceleratorCount != nil { + requirementsRequest.AcceleratorCount = &ec2.AcceleratorCountRequest{ + Min: requirements.AcceleratorCount.Min, + Max: requirements.AcceleratorCount.Max, + } + } + + if requirements.AcceleratorManufacturers != nil { + requirementsRequest.AcceleratorManufacturers = requirements.AcceleratorManufacturers + } + + if requirements.AcceleratorNames != nil { + requirementsRequest.AcceleratorNames = requirements.AcceleratorNames + } + + if requirements.AcceleratorTotalMemoryMiB != nil { + requirementsRequest.AcceleratorTotalMemoryMiB = &ec2.AcceleratorTotalMemoryMiBRequest{ + Min: requirements.AcceleratorTotalMemoryMiB.Min, + Max: requirements.AcceleratorTotalMemoryMiB.Max, + } + } + + if requirements.AcceleratorTypes != nil { + requirementsRequest.AcceleratorTypes = requirements.AcceleratorTypes + } + + if requirements.BareMetal != nil { + requirementsRequest.BareMetal = requirements.BareMetal + } + + if requirements.BaselineEbsBandwidthMbps != nil { + requirementsRequest.BaselineEbsBandwidthMbps = &ec2.BaselineEbsBandwidthMbpsRequest{ + Min: requirements.BaselineEbsBandwidthMbps.Min, + Max: requirements.BaselineEbsBandwidthMbps.Max, + } + } + + if requirements.BurstablePerformance != nil { + requirementsRequest.BurstablePerformance = requirements.BurstablePerformance + } + + if requirements.CpuManufacturers != nil { + requirementsRequest.CpuManufacturers = requirements.CpuManufacturers + } + + if requirements.ExcludedInstanceTypes != nil { + requirementsRequest.ExcludedInstanceTypes = requirements.ExcludedInstanceTypes + } + + if requirements.InstanceGenerations != nil { + requirementsRequest.InstanceGenerations = requirements.InstanceGenerations + } + + if requirements.LocalStorage != nil { + requirementsRequest.LocalStorage = requirements.LocalStorage + } + + if requirements.LocalStorageTypes != nil { + requirementsRequest.LocalStorageTypes = requirements.LocalStorageTypes + } + + if requirements.MemoryGiBPerVCpu != nil { + requirementsRequest.MemoryGiBPerVCpu = &ec2.MemoryGiBPerVCpuRequest{ + Min: requirements.MemoryGiBPerVCpu.Min, + Max: requirements.MemoryGiBPerVCpu.Max, + } + } + + if requirements.NetworkInterfaceCount != nil { + requirementsRequest.NetworkInterfaceCount = &ec2.NetworkInterfaceCountRequest{ + Min: requirements.NetworkInterfaceCount.Min, + Max: requirements.NetworkInterfaceCount.Max, + } + } + + if requirements.OnDemandMaxPricePercentageOverLowestPrice != nil { + requirementsRequest.OnDemandMaxPricePercentageOverLowestPrice = requirements.OnDemandMaxPricePercentageOverLowestPrice + } + + if requirements.RequireHibernateSupport != nil { + requirementsRequest.RequireHibernateSupport = requirements.RequireHibernateSupport + } + + if requirements.SpotMaxPricePercentageOverLowestPrice != nil { + requirementsRequest.SpotMaxPricePercentageOverLowestPrice = requirements.SpotMaxPricePercentageOverLowestPrice + } + + if requirements.TotalLocalStorageGB != nil { + requirementsRequest.TotalLocalStorageGB = &ec2.TotalLocalStorageGBRequest{ + Min: requirements.TotalLocalStorageGB.Min, + Max: requirements.TotalLocalStorageGB.Max, + } + } + + return &requirementsRequest, nil +} + +func (m *awsWrapper) getRequirementsRequestFromEC2(requirements *ec2.InstanceRequirements) (*ec2.InstanceRequirementsRequest, error) { + requirementsRequest := ec2.InstanceRequirementsRequest{} + + // required instance requirements + requirementsRequest.MemoryMiB = &ec2.MemoryMiBRequest{ + Min: requirements.MemoryMiB.Min, + Max: requirements.MemoryMiB.Max, + } + + requirementsRequest.VCpuCount = &ec2.VCpuCountRangeRequest{ + Min: requirements.VCpuCount.Min, + Max: requirements.VCpuCount.Max, + } + + // optional instance requirements + if requirements.AcceleratorCount != nil { + requirementsRequest.AcceleratorCount = &ec2.AcceleratorCountRequest{ + Min: requirements.AcceleratorCount.Min, + Max: requirements.AcceleratorCount.Max, + } + } + + if requirements.AcceleratorManufacturers != nil { + requirementsRequest.AcceleratorManufacturers = requirements.AcceleratorManufacturers + } + + if requirements.AcceleratorNames != nil { + requirementsRequest.AcceleratorNames = requirements.AcceleratorNames + } + + if requirements.AcceleratorTotalMemoryMiB != nil { + requirementsRequest.AcceleratorTotalMemoryMiB = &ec2.AcceleratorTotalMemoryMiBRequest{ + Min: requirements.AcceleratorTotalMemoryMiB.Min, + Max: requirements.AcceleratorTotalMemoryMiB.Max, + } + } + + if requirements.AcceleratorTypes != nil { + requirementsRequest.AcceleratorTypes = requirements.AcceleratorTypes + } + + if requirements.BareMetal != nil { + requirementsRequest.BareMetal = requirements.BareMetal + } + + if requirements.BaselineEbsBandwidthMbps != nil { + requirementsRequest.BaselineEbsBandwidthMbps = &ec2.BaselineEbsBandwidthMbpsRequest{ + Min: requirements.BaselineEbsBandwidthMbps.Min, + Max: requirements.BaselineEbsBandwidthMbps.Max, + } + } + + if requirements.BurstablePerformance != nil { + requirementsRequest.BurstablePerformance = requirements.BurstablePerformance + } + + if requirements.CpuManufacturers != nil { + requirementsRequest.CpuManufacturers = requirements.CpuManufacturers + } + + if requirements.ExcludedInstanceTypes != nil { + requirementsRequest.ExcludedInstanceTypes = requirements.ExcludedInstanceTypes + } + + if requirements.InstanceGenerations != nil { + requirementsRequest.InstanceGenerations = requirements.InstanceGenerations + } + + if requirements.LocalStorage != nil { + requirementsRequest.LocalStorage = requirements.LocalStorage + } + + if requirements.LocalStorageTypes != nil { + requirementsRequest.LocalStorageTypes = requirements.LocalStorageTypes + } + + if requirements.MemoryGiBPerVCpu != nil { + requirementsRequest.MemoryGiBPerVCpu = &ec2.MemoryGiBPerVCpuRequest{ + Min: requirements.MemoryGiBPerVCpu.Min, + Max: requirements.MemoryGiBPerVCpu.Max, + } + } + + if requirements.NetworkInterfaceCount != nil { + requirementsRequest.NetworkInterfaceCount = &ec2.NetworkInterfaceCountRequest{ + Min: requirements.NetworkInterfaceCount.Min, + Max: requirements.NetworkInterfaceCount.Max, + } + } + + if requirements.OnDemandMaxPricePercentageOverLowestPrice != nil { + requirementsRequest.OnDemandMaxPricePercentageOverLowestPrice = requirements.OnDemandMaxPricePercentageOverLowestPrice + } + + if requirements.RequireHibernateSupport != nil { + requirementsRequest.RequireHibernateSupport = requirements.RequireHibernateSupport + } + + if requirements.SpotMaxPricePercentageOverLowestPrice != nil { + requirementsRequest.SpotMaxPricePercentageOverLowestPrice = requirements.SpotMaxPricePercentageOverLowestPrice + } + + if requirements.TotalLocalStorageGB != nil { + requirementsRequest.TotalLocalStorageGB = &ec2.TotalLocalStorageGBRequest{ + Min: requirements.TotalLocalStorageGB.Min, + Max: requirements.TotalLocalStorageGB.Max, + } + } + + return &requirementsRequest, nil +} + +func (m *awsWrapper) getEC2RequirementsFromAutoscaling(autoscalingRequirements *autoscaling.InstanceRequirements) (*ec2.InstanceRequirements, error) { + ec2Requirements := ec2.InstanceRequirements{} + + // required instance requirements + ec2Requirements.MemoryMiB = &ec2.MemoryMiB{ + Min: autoscalingRequirements.MemoryMiB.Min, + Max: autoscalingRequirements.MemoryMiB.Max, + } + + ec2Requirements.VCpuCount = &ec2.VCpuCountRange{ + Min: autoscalingRequirements.VCpuCount.Min, + Max: autoscalingRequirements.VCpuCount.Max, + } + + // optional instance requirements + if autoscalingRequirements.AcceleratorCount != nil { + ec2Requirements.AcceleratorCount = &ec2.AcceleratorCount{ + Min: autoscalingRequirements.AcceleratorCount.Min, + Max: autoscalingRequirements.AcceleratorCount.Max, + } + } + + if autoscalingRequirements.AcceleratorManufacturers != nil { + ec2Requirements.AcceleratorManufacturers = autoscalingRequirements.AcceleratorManufacturers + } + + if autoscalingRequirements.AcceleratorNames != nil { + ec2Requirements.AcceleratorNames = autoscalingRequirements.AcceleratorNames + } + + if autoscalingRequirements.AcceleratorTotalMemoryMiB != nil { + ec2Requirements.AcceleratorTotalMemoryMiB = &ec2.AcceleratorTotalMemoryMiB{ + Min: autoscalingRequirements.AcceleratorTotalMemoryMiB.Min, + Max: autoscalingRequirements.AcceleratorTotalMemoryMiB.Max, + } + } + + if autoscalingRequirements.AcceleratorTypes != nil { + ec2Requirements.AcceleratorTypes = autoscalingRequirements.AcceleratorTypes + } + + if autoscalingRequirements.BareMetal != nil { + ec2Requirements.BareMetal = autoscalingRequirements.BareMetal + } + + if autoscalingRequirements.BaselineEbsBandwidthMbps != nil { + ec2Requirements.BaselineEbsBandwidthMbps = &ec2.BaselineEbsBandwidthMbps{ + Min: autoscalingRequirements.BaselineEbsBandwidthMbps.Min, + Max: autoscalingRequirements.BaselineEbsBandwidthMbps.Max, + } + } + + if autoscalingRequirements.BurstablePerformance != nil { + ec2Requirements.BurstablePerformance = autoscalingRequirements.BurstablePerformance + } + + if autoscalingRequirements.CpuManufacturers != nil { + ec2Requirements.CpuManufacturers = autoscalingRequirements.CpuManufacturers + } + + if autoscalingRequirements.ExcludedInstanceTypes != nil { + ec2Requirements.ExcludedInstanceTypes = autoscalingRequirements.ExcludedInstanceTypes + } + + if autoscalingRequirements.InstanceGenerations != nil { + ec2Requirements.InstanceGenerations = autoscalingRequirements.InstanceGenerations + } + + if autoscalingRequirements.LocalStorage != nil { + ec2Requirements.LocalStorage = autoscalingRequirements.LocalStorage + } + + if autoscalingRequirements.LocalStorageTypes != nil { + ec2Requirements.LocalStorageTypes = autoscalingRequirements.LocalStorageTypes + } + + if autoscalingRequirements.MemoryGiBPerVCpu != nil { + ec2Requirements.MemoryGiBPerVCpu = &ec2.MemoryGiBPerVCpu{ + Min: autoscalingRequirements.MemoryGiBPerVCpu.Min, + Max: autoscalingRequirements.MemoryGiBPerVCpu.Max, + } + } + + if autoscalingRequirements.NetworkInterfaceCount != nil { + ec2Requirements.NetworkInterfaceCount = &ec2.NetworkInterfaceCount{ + Min: autoscalingRequirements.NetworkInterfaceCount.Min, + Max: autoscalingRequirements.NetworkInterfaceCount.Max, + } + } + + if autoscalingRequirements.OnDemandMaxPricePercentageOverLowestPrice != nil { + ec2Requirements.OnDemandMaxPricePercentageOverLowestPrice = autoscalingRequirements.OnDemandMaxPricePercentageOverLowestPrice + } + + if autoscalingRequirements.RequireHibernateSupport != nil { + ec2Requirements.RequireHibernateSupport = autoscalingRequirements.RequireHibernateSupport + } + + if autoscalingRequirements.SpotMaxPricePercentageOverLowestPrice != nil { + ec2Requirements.SpotMaxPricePercentageOverLowestPrice = autoscalingRequirements.SpotMaxPricePercentageOverLowestPrice + } + + if autoscalingRequirements.TotalLocalStorageGB != nil { + ec2Requirements.TotalLocalStorageGB = &ec2.TotalLocalStorageGB{ + Min: autoscalingRequirements.TotalLocalStorageGB.Min, + Max: autoscalingRequirements.TotalLocalStorageGB.Max, + } + } + + return &ec2Requirements, nil +} + +func (m *awsWrapper) getInstanceTypesForAsgs(asgs []*asg) (map[string]string, error) { + results := map[string]string{} + launchConfigsToQuery := map[string]string{} + launchTemplatesToQuery := map[string]*launchTemplate{} + mixedInstancesPoliciesToQuery := map[string]*mixedInstancesPolicy{} + + for _, asg := range asgs { + name := asg.AwsRef.Name + if asg.LaunchConfigurationName != "" { + launchConfigsToQuery[name] = asg.LaunchConfigurationName + } else if asg.LaunchTemplate != nil { + launchTemplatesToQuery[name] = asg.LaunchTemplate + } else if asg.MixedInstancesPolicy != nil { + if len(asg.MixedInstancesPolicy.instanceTypesOverrides) > 0 { + results[name] = asg.MixedInstancesPolicy.instanceTypesOverrides[0] + } else if asg.MixedInstancesPolicy.instanceRequirementsOverrides != nil { + mixedInstancesPoliciesToQuery[name] = asg.MixedInstancesPolicy + } else { + launchTemplatesToQuery[name] = asg.MixedInstancesPolicy.launchTemplate + } + } + } + + klog.V(4).Infof("%d launch configurations to query", len(launchConfigsToQuery)) + klog.V(4).Infof("%d launch templates to query", len(launchTemplatesToQuery)) + + // Query these all at once to minimize AWS API calls + launchConfigNames := make([]*string, 0, len(launchConfigsToQuery)) + for _, cfgName := range launchConfigsToQuery { + launchConfigNames = append(launchConfigNames, aws.String(cfgName)) + } + launchConfigs, err := m.getInstanceTypeByLaunchConfigNames(launchConfigNames) + if err != nil { + klog.Errorf("Failed to query %d launch configurations", len(launchConfigsToQuery)) + return nil, err + } + + for asgName, cfgName := range launchConfigsToQuery { + if instanceType, ok := launchConfigs[cfgName]; !ok || instanceType == "" { + klog.Warningf("Could not fetch %q launch configuration for ASG %q", cfgName, asgName) + continue + } + results[asgName] = launchConfigs[cfgName] + } + klog.V(4).Infof("Successfully queried %d launch configurations", len(launchConfigs)) + + // Have to query LaunchTemplates one-at-a-time, since there's no way to query pairs in bulk + for asgName, lt := range launchTemplatesToQuery { + instanceType, err := m.getInstanceTypeByLaunchTemplate(lt) + if err != nil { + klog.Errorf("Failed to query launch template %s: %v", lt.name, err) + continue + } + results[asgName] = instanceType + } + klog.V(4).Infof("Successfully queried %d launch templates", len(launchTemplatesToQuery)) + + // Have to match Instance Requirements one-at-a-time, since they are configured per asg and can't be queried in bulk + for asgName, policy := range mixedInstancesPoliciesToQuery { + instanceType, err := m.getInstanceTypeFromRequirementsOverrides(policy) + if err != nil { + klog.Errorf("Failed to query instance requirements for ASG %s: %v", asgName, err) + continue + } + results[asgName] = instanceType + } + klog.V(4).Infof("Successfully queried instance requirements for %d ASGs", len(mixedInstancesPoliciesToQuery)) + + return results, nil +} + +func buildLaunchTemplateFromSpec(ltSpec *autoscaling.LaunchTemplateSpecification) *launchTemplate { + // NOTE(jaypipes): The LaunchTemplateSpecification.Version is a pointer to + // string. When the pointer is nil, EC2 AutoScaling API considers the value + // to be "$Default", however aws.StringValue(ltSpec.Version) will return an + // empty string (which is not considered the same as "$Default" or a nil + // string pointer. So, in order to not pass an empty string as the version + // for the launch template when we communicate with the EC2 AutoScaling API + // using the information in the launchTemplate, we store the string + // "$Default" here when the ltSpec.Version is a nil pointer. + // + // See: + // + // https://github.com/kubernetes/autoscaler/issues/1728 + // https://github.com/aws/aws-sdk-go/blob/81fad3b797f4a9bd1b452a5733dd465eefef1060/service/autoscaling/api.go#L10666-L10671 + // + // A cleaner alternative might be to make launchTemplate.version a string + // pointer instead of a string, or even store the aws-sdk-go's + // LaunchTemplateSpecification structs directly. + var version string + if ltSpec.Version == nil { + version = "$Default" + } else { + version = aws.StringValue(ltSpec.Version) + } + return &launchTemplate{ + name: aws.StringValue(ltSpec.LaunchTemplateName), + version: version, + } +} +*/ diff --git a/pkg/vault/vault.go b/pkg/vault/vault.go new file mode 100644 index 0000000..62a1c4d --- /dev/null +++ b/pkg/vault/vault.go @@ -0,0 +1,31 @@ +package vault + +import ( + "context" + "fmt" + + "github.com/intelops/go-common/credentials" + log "github.com/sirupsen/logrus" +) + +const ( + credentialType = "generic" +) + +// GetGenericCredential entity - azsecret/azsecret +// +func GetGenericCredential(ctx context.Context, entity, credIdentifier string) (map[string]string, error) { + credReader, err := credentials.NewCredentialReader(ctx) + if err != nil { + log.Errorf("Failed while creating Credential Reader, error : %v", err) + return nil, fmt.Errorf("failed while creating Credential Reader, error : %v", err) + } + + cred, err := credReader.GetCredential(context.Background(), credentialType, entity, credIdentifier) + if err != nil { + log.Errorf("Failed while get credential, error : %v", err) + return nil, fmt.Errorf("failed while get credential, error : %v", err) + } + + return cred, nil +} From 85348a5a98dc9c58adc6e7d28f3285e98ab94fc4 Mon Sep 17 00:00:00 2001 From: binarybard42 Date: Sun, 5 May 2024 10:04:51 +0530 Subject: [PATCH 5/5] aws cloud provider for autoscaler --- pkg/cloudprovider/aws/autoscaling_group.go | 16 ---------------- pkg/cloudprovider/aws/aws_util.go | 16 ---------------- pkg/cloudprovider/aws/cloud_provider.go | 16 ---------------- pkg/cloudprovider/aws/manager.go | 16 ---------------- pkg/cloudprovider/aws/wrapper.go | 16 ---------------- 5 files changed, 80 deletions(-) diff --git a/pkg/cloudprovider/aws/autoscaling_group.go b/pkg/cloudprovider/aws/autoscaling_group.go index c50cac9..e75e626 100644 --- a/pkg/cloudprovider/aws/autoscaling_group.go +++ b/pkg/cloudprovider/aws/autoscaling_group.go @@ -1,19 +1,3 @@ -/* -Copyright 2016 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 aws import ( diff --git a/pkg/cloudprovider/aws/aws_util.go b/pkg/cloudprovider/aws/aws_util.go index 58cc85a..e02616a 100644 --- a/pkg/cloudprovider/aws/aws_util.go +++ b/pkg/cloudprovider/aws/aws_util.go @@ -1,19 +1,3 @@ -/* -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 aws import ( diff --git a/pkg/cloudprovider/aws/cloud_provider.go b/pkg/cloudprovider/aws/cloud_provider.go index 5e7d25f..f06623b 100644 --- a/pkg/cloudprovider/aws/cloud_provider.go +++ b/pkg/cloudprovider/aws/cloud_provider.go @@ -1,19 +1,3 @@ -/* -Copyright 2016 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 aws import ( diff --git a/pkg/cloudprovider/aws/manager.go b/pkg/cloudprovider/aws/manager.go index 389dbf1..8dc14a9 100644 --- a/pkg/cloudprovider/aws/manager.go +++ b/pkg/cloudprovider/aws/manager.go @@ -1,19 +1,3 @@ -/* -Copyright 2016 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. -*/ - //go:generate go run ec2_instance_types/gen.go -region $AWS_REGION package aws diff --git a/pkg/cloudprovider/aws/wrapper.go b/pkg/cloudprovider/aws/wrapper.go index c015846..13c2dd5 100644 --- a/pkg/cloudprovider/aws/wrapper.go +++ b/pkg/cloudprovider/aws/wrapper.go @@ -1,19 +1,3 @@ -/* -Copyright 2016 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 aws import (