Merge pull request #345 from crawford/ami

Clean up AKI lists and bump to 1.04
This commit is contained in:
Alex Crawford 2014-10-31 20:39:05 -07:00
commit edae8bb5e0
4 changed files with 26 additions and 41 deletions

View File

@ -5,24 +5,11 @@
# mad props to Eric Hammond for the initial script
# https://github.com/alestic/alestic-hardy-ebs/blob/master/bin/alestic-hardy-ebs-build-ami
# AKI ids from:
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
# we need pv-grub-hd00 x86_64
# Set pipefail along with -e in hopes that we catch more errors
set -e -o pipefail
declare -A AKI
AKI["us-east-1"]=aki-b4aa75dd
AKI["us-west-1"]=aki-eb7e26ae
AKI["us-west-2"]=aki-f837bac8
AKI["eu-west-1"]=aki-8b655dff
AKI["eu-central-1"]=aki-184c7a05
AKI["ap-southeast-1"]=aki-fa1354a8
AKI["ap-southeast-2"]=aki-3d990e07
AKI["ap-northeast-1"]=aki-40992841
AKI["sa-east-1"]=aki-c88f51d5
# AKI["gov-west-1"]=aki-75a4c056
DIR=$(dirname $0)
source $DIR/regions.sh
readonly COREOS_EPOCH=1372636800
VERSION="master"
@ -110,7 +97,7 @@ description="CoreOS $GROUP $VERSION"
zoneurl=http://instance-data/latest/meta-data/placement/availability-zone
zone=$(curl --fail -s $zoneurl)
region=$(echo $zone | sed 's/.$//')
akiid=${AKI[$region]}
akiid=${ALL_AKIS[$region]}
if [ -z "$akiid" ]; then
echo "$0: Can't identify AKI, using region: $region" >&2

View File

@ -12,17 +12,8 @@
# Set pipefail along with -e in hopes that we catch more errors
set -e -o pipefail
declare -A AKI
AKI["us-east-1"]=aki-b4aa75dd
AKI["us-west-1"]=aki-eb7e26ae
AKI["us-west-2"]=aki-f837bac8
AKI["eu-west-1"]=aki-8b655dff
AKI["eu-central-1"]=aki-184c7a05
AKI["ap-southeast-1"]=aki-fa1354a8
AKI["ap-southeast-2"]=aki-3d990e07
AKI["ap-northeast-1"]=aki-40992841
AKI["sa-east-1"]=aki-c88f51d5
# AKI["gov-west-1"]=aki-75a4c056
DIR=$(dirname $0)
source $DIR/regions.sh
USAGE="Usage: $0 -a ami-id
-a ami-id ID of the AMI to be coppied.
@ -42,7 +33,7 @@ GROUP="alpha"
REGIONS=()
add_region() {
if [[ -z "${AKI[$1]}" ]]; then
if [[ -z "${ALL_REGIONS[$1]}" ]]; then
echo "Invalid region '$1'" >&2;
exit 1
fi
@ -105,7 +96,7 @@ else
fi
if [[ ${#REGIONS[@]} -eq 0 ]]; then
REGIONS=( "${!AKI[@]}" )
REGIONS=( "${ALL_REGIONS[@]}" )
fi
# The name has a limited set of allowed characterrs

View File

@ -3,17 +3,8 @@
# Set pipefail along with -e in hopes that we catch more errors
set -e -o pipefail
REGIONS=(
us-east-1
us-west-1
us-west-2
eu-west-1
eu-central-1
ap-southeast-1
ap-southeast-2
ap-northeast-1
sa-east-1
)
DIR=$(dirname $0)
source $DIR/regions.sh
USAGE="Usage: $0 -V 100.0.0
-V VERSION Find AMI by CoreOS version. (required)
@ -63,7 +54,7 @@ fi
search_name=$(clean_version "CoreOS-$GROUP-$VER")
declare -A AMIS HVM_AMIS
for r in "${REGIONS[@]}"; do
for r in "${ALL_REGIONS[@]}"; do
AMI=$(ec2-describe-images --region=${r} -F name="${search_name}" \
| grep -m1 ^IMAGE | cut -f2) || true
if [[ -z "$AMI" ]]; then

16
oem/ami/regions.sh Normal file
View File

@ -0,0 +1,16 @@
# AKI ids from:
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
# These are pv-grub-hd0_1.04-x86_64
declare -A ALL_AKIS
ALL_AKIS["us-east-1"]=aki-919dcaf8
ALL_AKIS["us-west-1"]=aki-880531cd
ALL_AKIS["us-west-2"]=aki-fc8f11cc
ALL_AKIS["eu-west-1"]=aki-52a34525
ALL_AKIS["eu-central-1"]=aki-184c7a05
ALL_AKIS["ap-southeast-1"]=aki-503e7402
ALL_AKIS["ap-southeast-2"]=aki-c362fff9
ALL_AKIS["ap-northeast-1"]=aki-176bf516
ALL_AKIS["sa-east-1"]=aki-5553f448
ALL_REGIONS=( "${!ALL_AKIS[@]}" )