Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active November 14, 2022 12:13
Show Gist options
  • Save gdamjan/09bf59445a6ef3c4c99933c2c0374560 to your computer and use it in GitHub Desktop.
Save gdamjan/09bf59445a6ef3c4c99933c2c0374560 to your computer and use it in GitHub Desktop.
Get the AMI id of the latest official Debian/Fedora/Ubuntu images (hvm-x86_64-gp2) | awscli
# Debian 10
aws ec2 describe-images \
--region us-east-1 \
--owners 136693071363 \
--filters 'Name=name,Values=debian-10-amd64-*' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId,Name,CreationDate]' \
--output text
##
# additional filters:
# 'Name=name,Values=debian-stretch-*'
# 'Name=architecture,Values=x86_64'
# 'Name=virtualization-type,Values=hvm'
#
# Debian 9 (old owner)
aws ec2 describe-images \
--region us-east-1 \
--owners 379101102735 \
--filters 'Name=name,Values=debian-stretch-hvm-x86_64-gp2-*' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId,Name,CreationDate]' \
--output text
# Ubuntu:
aws ec2 describe-images \
--region us-east-1 \
--owners 099720109477 \
--filters 'Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId,Name,CreationDate]' \
--output text
# Fedora
aws ec2 describe-images \
--region us-east-1 \
--owners 125523088429 \
--filters 'Name=name,Values=Fedora-Cloud-Base-30-*x86_64-hvm-*-gp2-*' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId,Name,CreationDate]' \
--output text
@gdamjan
Copy link
Author

gdamjan commented Sep 6, 2019

the new AWS account for Debian will be 136693071363 from late 2019 on

@r8or0pz
Copy link

r8or0pz commented Nov 14, 2022

I think credentials are required for these accounts, otherwise you'd get an error

@gdamjan
Copy link
Author

gdamjan commented Nov 14, 2022

I think credentials are required for these accounts, otherwise you'd get an error

for which accounts? those are public images.

for aws ec2 api calls you do need basic aws credentials, true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment