Last active
April 3, 2024 08:55
-
-
Save ziwon/9479f6113e37843d10717d6762f17eea to your computer and use it in GitHub Desktop.
Get the number of pods per running instance type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export AWS_PROFILE=default | |
aws ec2 describe-instances --region ap-northeast-2 \ | |
| jq '.Reservations[] | .Instances[] | {type: .InstanceType, tag: .Tags[] | select(.Key=="Name").Value}' \ | |
| jq -s '.' \ | |
| jq 'sort_by(.type) | group_by(.type)[] | { | |
type: .[0].type, | |
name: map(.tag)} | "\( .type ): \( .name | join(", ") )"' | tr -d \" | awk -F '' '{if (NF > 110) {print substr($0, 0, 110)".."} else print $0}' \ | |
| xargs -I {} bash -c 'T="{}"; curl -s -L https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/files/eni-max-pods.txt | grep ${T%:*}; printf "> ${T#*:}\n";'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment