Skip to content

Instantly share code, notes, and snippets.

@quadespresso
Last active May 20, 2022 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quadespresso/2ee5533270103caf789eaf645a07baee to your computer and use it in GitHub Desktop.
Save quadespresso/2ee5533270103caf789eaf645a07baee to your computer and use it in GitHub Desktop.
Get the list of Rocky Linux AMI names in all regions
#!/bin/bash
for r in $(aws ec2 describe-regions | jq '.Regions[].RegionName' -r) ; do
echo "===================="
echo "==== $r ===="
# Rocky Linux owner ID 792107900819
aws --region $r ec2 describe-images \
--owners 792107900819 \
| jq '.Images[].Name' -r \
| cut -f2 -d/ \
| sort -u
done
====================
==== eu-north-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-south-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== eu-west-3 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== eu-west-2 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== eu-west-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-northeast-3 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-northeast-2 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-northeast-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== sa-east-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ca-central-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-southeast-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== ap-southeast-2 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== eu-central-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== us-east-1 ====
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
Rocky-8-ec2-8.6-20220515.0.aarch64
Rocky-8-ec2-8.6-20220515.0.x86_64
====================
==== us-east-2 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
Rocky-8-ec2-8.5-20220515.0.aarch64
====================
==== us-west-1 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64
====================
==== us-west-2 ====
Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64
Rocky-8-ec2-8.5-20211114.2.x86_64

For Rocky Linux 8.5, all AMI's in all regions follow the naming convention Rocky-8-ec2-8.5-YYYYMMDD.N.ARCH.

Rocky Linux 8.6 doesn't quite follow this. Or rather, it appears to have started out that way in us-east-1, with partial success in us-east-2.

That is, us-east-1 has these 8.6 AMI's:

Rocky-8-ec2-8.6-20220515.0.aarch64
Rocky-8-ec2-8.6-20220515.0.x86_64

and us-east-2 has this slight variation:

Copy of ami-0746c2106d76fa617 from us-east-1
Rocky-8-ec2-8.5-20211114.1.aarch64

All of the other regions show these:

Copy of ami-0746c2106d76fa617 from us-east-1
Copy of ami-09e5024730b047901 from us-east-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment