Last active
August 29, 2015 14:05
-
-
Save pataiji/0760a445d23cccb4a52d to your computer and use it in GitHub Desktop.
最新のAmzon LinuxのAMI ID一覧を取得する
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 | |
REGIONS=( \ | |
"us-east-1" \ | |
"us-west-1" \ | |
"us-west-2" \ | |
"eu-west-1" \ | |
"sa-east-1" \ | |
"ap-southeast-1" \ | |
"ap-southeast-2" \ | |
"ap-northeast-1" | |
) | |
for (( I = 0; I < ${#REGIONS[@]}; ++I )) | |
do | |
printf "${REGIONS[$I]}\t" | |
aws ec2 describe-images \ | |
--owners amazon \ | |
--filters "Name=architecture,Values=x86_64" \ | |
"Name=virtualization-type,Values=hvm" \ | |
"Name=image-type,Values=machine" \ | |
"Name=owner-alias,Values=amazon" \ | |
"Name=name,Values=amzn-*" \ | |
"Name=root-device-type,Values=ebs" \ | |
"Name=block-device-mapping.volume-type,Values=gp2" \ | |
--output text \ | |
--query Images[].[Name,ImageId] \ | |
--region ${REGIONS[$I]} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment