Skip to content

Instantly share code, notes, and snippets.

@sebsto
Last active October 30, 2023 22:08
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 sebsto/62c66d17d097a87a480723cc86d6ee17 to your computer and use it in GitHub Desktop.
Save sebsto/62c66d17d097a87a480723cc86d6ee17 to your computer and use it in GitHub Desktop.
AWS Amazon EC2 Mac : find macOS AMI IDs
# list all the AMIs for a major macOS version
REGION=us-east-1
MACOS_VERSION=14
aws ec2 describe-images \
--region $REGION \
--filters Name=name,Values="amzn-ec2-macos-$MACOS_VERSION*" \
--owners amazon \
--query 'Images[*].[Architecture,Description,ImageId]' \
--output text
# list the most recent AMI for a major macOS version.
aws ec2 describe-images \
--region $REGION \
--filters "Name=architecture,Values=arm64_mac" "Name=name,Values=amzn-ec2-macos-$MACOS_VERSION.*-arm64" \
--owners amazon \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment