ami

aws cli search for latest ami

This simple oneliner gets you the latest ami in a given region for a specific search term. # get the latest ecs-optimized amazon ami in eu-west-1 aws ec2 describe-images --region eu-west-1 --owners amazon --filters "Name=name,Values=*amazon-ecs-optimized" "Name=architecture,Values=x86_64" "Name=architecture,Values=x86_64" --query 'sort_by(Images, &CreationDate)[-1].ImageId' So lets break it down to give you what you need to get your favorite ami. # Get the full ami list for name search term "*amazon-ecs-optimized" aws ec2 describe-images --region eu-west-1 --owners amazon --filters "Name=name,Values=*amazon-ecs-optimized" "Name=architecture,Values=x86_64" # this is searching for just the name, you could of course replace or expand this with other atributes like: aws ec2 describe-images --region eu-west-1 --owners amazon --filters "Name=name,Values=*amazon-ecs-optimized" "Name=architecture,Values=x86_64" "Name=block-device-mapping.