-
-
Save drmikecrowe/e4760beddcc26b30285db48f4e0f386a to your computer and use it in GitHub Desktop.
Script to find and print the latest stable, Ubuntu version
This file contains 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 | |
# prints latest, stable, HVM, EBS GP2 backed AMIs for major OSs | |
UBUNTU=099720109477 | |
REGIONS="us-east-1 us-east-2 us-west-1 us-west-2" | |
for REGION in $REGIONS; do | |
echo -n "$REGION: " | |
aws ec2 describe-images --region=$REGION --owners $UBUNTU --filters 'Name=name,Values=*hvm-ssd*16.04*' --query 'Images[*].[ImageId,CreationDate,Name]' --output text | sort -k2 -r | head -n 1 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output: