DCD-224: Add a helper script and local inventory.

This commit is contained in:
Steve Smith
2019-03-22 14:20:29 +11:00
commit 9c7252821a
2 changed files with 16 additions and 0 deletions

14
bin/scan-latest-amis Executable file
View File

@@ -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

2
inv/localhost Normal file
View File

@@ -0,0 +1,2 @@
[all]
localhost ansible_connection=local