Last active
September 27, 2018 03:44
-
-
Save calum-github/d04a826dd249172b880bd22ad0b3539c to your computer and use it in GitHub Desktop.
Get a list of AWS AMI codes for CentOS 7 Linux
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 | |
# Get latest AMI codes for CentOS 7 from AWS | |
region="ap-southeast-2" | |
product_code="aw0evgkw8e5c1q413zgy5pjce" | |
aws ec2 describe-images \ | |
--region "$region" \ | |
--owners aws-marketplace \ | |
--filters Name=product-code,Values="$product_code" \ | |
--query 'Images[*].[CreationDate,Name,ImageId]' \ | |
--filters "Name=name,Values=CentOS Linux 7*" \ | |
--output table | sort -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the product code from CentOS from here:
https://wiki.centos.org/Cloud/AWS