Get the latest Ubuntu 12.04 official AMI using aws-cli with query option
aws --region ap-southeast-2 ec2 describe-images --owners 099720109477 \
--filters Name=root-device-type,Values=ebs \
Name=architecture,Values=x86_64 \
Name=name,Values='*hvm-ssd/ubuntu-precise-12.04*' --query 'sort_by(Images, &Name)[-1].ImageId' --output text
Written by Bruce Wang
Related protips
1 Response
Thanks. Here is my modification to find Ubuntu 16.04
```
for region in us-east-1 us-east-2 us-west-1 us-west-2 eu-west-1 eu-west-2 eu-central-1 ap-northeast-1 ap-southeast-1 ap-southeast-2 ca-central-1
do
ami=aws --region $region ec2 describe-images \
--filters Name=root-device-type,Values=ebs \
Name=architecture,Values=x86_64 \
Name=virtualization-type,Values=hvm \
Name=name,Values=*ubuntu-xenial-16.04-amd64-server-20161214 \
--query 'Images[*].{ID:ImageId}' --output text
echo $region, $ami
done
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#