Created
December 13, 2016 21:05
-
-
Save jfoy/d1117947bd3df28da67eadcdeac1da26 to your computer and use it in GitHub Desktop.
Utility script to grab info about the current CoreOS release
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 | |
# Default to us-east-1 region | |
region=${1:-"us-east-1"} | |
# CoreOS channel ["stable" | "beta" | "alpha"] | |
channel=${2:-"stable"} | |
# AWS AMI disk backing ["pv" | "hvm"] | |
disk=hvm | |
ami_id=$(curl --silent --location http://$channel.release.core-os.net/amd64-usr/current/coreos_production_ami_all.json | grep -A 2 $region | grep $disk | cut -d"\"" -f4) | |
[ -z "$ami_id" ] && echo "FAIL: region $region not found or doesn't include a $channel, $disk backed CoreOS AMI" && exit 1 | |
build=$(curl --silent --location http://stable.release.core-os.net/amd64-usr/current/version.txt | grep COREOS_VERSION= | sed -e 's|^COREOS_VERSION=||') | |
echo "channel,region,build,disk,id,ami,url" | |
echo "$channel,$region,$build,$disk,$ami_id,https://console.aws.amazon.com/ec2/home?region=$region#launchAmi=$ami_id" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment