Created
May 22, 2018 02:48
-
-
Save jwdeane/2f6df088ba916f1ca7ffd2cb0b6944e7 to your computer and use it in GitHub Desktop.
Get latest AWS EC2 Linux AMI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Assumes AWS CLI installed and configured with default region. | |
# To query an alternate region add the --region parameter, e.g. | |
# --region us-west-2 | |
aws ec2 describe-images \ | |
--owners amazon \ | |
--filters "Name=name,Values=amzn-ami-hvm*ebs" \ | |
--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