Last active
August 29, 2015 14:24
-
-
Save cgswong/263f1a731a5ca4b2e8f7 to your computer and use it in GitHub Desktop.
Get AWS AMI ID for CoreOS channels
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 | |
| # CoreOS channel ["stable" | "beta" | "alpha"] | |
| channel=${1:-"alpha"} | |
| # AWS AMI disk backing ["pv" | "hvm"] | |
| disk=hvm | |
| # Use default us-east-1 region | |
| region=${2:-"us-east-1"} | |
| 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 | |
| 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