Skip to content

Instantly share code, notes, and snippets.

@pwaller
Created March 30, 2015 16:41
Show Gist options
  • Save pwaller/f80063a253a9106cccbd to your computer and use it in GitHub Desktop.
Save pwaller/f80063a253a9106cccbd to your computer and use it in GitHub Desktop.
Determine the latest CoreOS AMI available
#!/bin/sh
COREOS_CHANNEL=stable
BASE=http://$COREOS_CHANNEL.release.core-os.net/amd64-usr
AWS_REGION=eu-west-1
COREOS_VERSION=$(curl -s $BASE/current/version.txt | sed -n 's/COREOS_VERSION=//p')
parse_ami() {
jq -r ".amis | map(select(.name == \"$AWS_REGION\")) | .[].hvm"
}
AMI=$(curl -s $BASE/$COREOS_VERSION/coreos_production_ami_all.json | parse_ami)
cat <<EOF
# Corresponds to CoreOS $COREOS_VERSION
ami: $AMI
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment