Skip to content

Instantly share code, notes, and snippets.

@arpat
Last active April 28, 2020 19:11
Show Gist options
  • Save arpat/4f93f97a58c51258dae35b93b388082a to your computer and use it in GitHub Desktop.
Save arpat/4f93f97a58c51258dae35b93b388082a to your computer and use it in GitHub Desktop.
List the ten latest ubuntu public images (AMI's) on AWS
# List the ten latest ubuntu public images on AWS
# Output similar to:
# 2017-09-26T16:18:51.000Z ubuntu/images/hvm-ssd/ubuntu-zesty-17.04-amd64-server-20170922 hvm True ami-5cc00825
# 2017-09-21T21:20:20.000Z ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170919 hvm True ami-17d11e6e
# 2017-09-19T10:54:43.000Z ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20170918 hvm True ami-e872bf91
# 2017-09-05T13:12:32.000Z ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20170831 hvm True ami-01589c78
# ...etc
aws ec2 describe-images \
--filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu* \
--query 'Images[*].[CreationDate,Name,VirtualizationType,Public,ImageId]' \
--output text | sort -k1 -r | head -n10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment