Created
September 28, 2017 13:33
-
-
Save loivis/04c791ee37813af0fd863942713bbc8f to your computer and use it in GitHub Desktop.
This file contains 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 | |
# latest ubuntu 16.04 ami | |
aws ec2 describe-images --owners "099720109477" --filters Name="root-device-type",Values="ebs" \ | |
Name=architecture,Values=x86_64 Name=name,Values='ubuntu/images/hvm-ssd/ubuntu-xenial-16.04*' \ | |
--query 'sort_by(Images, &CreationDate)[-3:].[ImageId, CreationDate, Name]' --output=text | |
aws ec2 describe-images --owners "099720109477" --filters Name="root-device-type",Values="ebs" \ | |
Name=architecture,Values=x86_64 Name=name,Values='ubuntu/images/hvm-ssd/ubuntu-xenial-16.04*' \ | |
--query 'sort_by(Images, &CreationDate)[-1].ImageId' --output=text | |
# latest centos 7 ami | |
aws ec2 describe-images --filter Name='name',Values='CentOS Linux 7 x86_64 HVM EBS 1704*' Name='product-code',Values='aw0evgkw8e5c1q413zgy5pjce' \ | |
--query 'Images[].[ImageId, CreationDate, Name]' --output text | |
aws ec2 describe-images --filter Name='name',Values='CentOS Linux 7 x86_64 HVM EBS 1704*' Name='product-code',Values='aw0evgkw8e5c1q413zgy5pjce' \ | |
--query 'Images[].ImageId' --output text | |
# latest amazon ecs-optimized ami | |
aws ec2 describe-images --owners "amazon" --filter Name='name',Values='*amazon-ecs-optimized' \ | |
--query 'sort_by(Images, &CreationDate)[-3:].[ImageId, CreationDate, Name]' --output text | |
aws ec2 describe-images --owners "amazon" --filter Name='name',Values='*amazon-ecs-optimized' \ | |
--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