Linux/UNIX one-liners
By Лука Билановић | February 18, 2022
One (and few) liners. My personal external memory :)
get average price of AWS g4ad.xlarge instance per region Link to heading
get average price of AWS g4ad.xlarge instance using aws-cli and linux tools in all regions that are offering this instance and sort it by price ascending
for region in us-east-1 us-east-2 us-west-2 eu-west-1 eu-west-2 eu-central-1 ca-central-1 ap-northeast-1; do
echo -n "$region";
echo -n -e '\t';
aws ec2 describe-spot-price-history --instance-types g4ad.xlarge --region $region --product-description "Linux/UNIX" --output text | awk '{print $5}' | awk '{ total += $1; count++ } END { print total/count }';
done | sort -k2