commit 9c7252821a3e0c6936e8d3f51611f6a66339acab Author: Steve Smith Date: Fri Mar 22 14:20:29 2019 +1100 DCD-224: Add a helper script and local inventory. diff --git a/bin/scan-latest-amis b/bin/scan-latest-amis new file mode 100755 index 0000000..f45743d --- /dev/null +++ b/bin/scan-latest-amis @@ -0,0 +1,14 @@ +#!/bin/bash + +# Quick script to extract the latest version of the target Linux 2 AMI. + +REGIONS="ap-northeast-1 ap-northeast-2 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-north-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2" + +for REGION in $REGIONS; do + ami=`aws --region "${REGION}" ec2 describe-images \ + --owners amazon \ + --filters Name=virtualization-type,Values=hvm Name=description,Values="Amazon Linux 2 AMI 2.0.* x86_64 HVM gp2" \ + --query 'sort_by(Images, &CreationDate)[-1].ImageId' \ + --output text` + echo "${REGION}: $ami" +done diff --git a/inv/localhost b/inv/localhost new file mode 100644 index 0000000..df8b5f6 --- /dev/null +++ b/inv/localhost @@ -0,0 +1,2 @@ +[all] +localhost ansible_connection=local