github.com/technosophos/deis@v1.7.1-0.20150915173815-f9005256004b/contrib/aws/update-aws-cluster.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Usage: ./update-aws-cluster.sh [name] 4 # The [name] is the CloudFormation stack name, and defaults to 'deis' 5 6 if [ -z "$1" ] 7 then 8 NAME=deis 9 else 10 NAME=$1 11 fi 12 13 set -e 14 15 THIS_DIR=$(cd $(dirname $0); pwd) # absolute path 16 CONTRIB_DIR=$(dirname $THIS_DIR) 17 18 source $CONTRIB_DIR/utils.sh 19 20 # check for AWS API tools in $PATH 21 if ! which aws > /dev/null; then 22 echo_red 'Please install the AWS command-line tool and ensure it is in your $PATH.' 23 exit 1 24 fi 25 26 if [ ! -z "$AWS_CLI_PROFILE" ]; then 27 EXTRA_AWS_CLI_ARGS+="--profile $AWS_CLI_PROFILE" 28 fi 29 30 # check that the CoreOS user-data file is valid 31 $CONTRIB_DIR/util/check-user-data.sh 32 33 # update the AWS CloudFormation stack 34 aws cloudformation update-stack \ 35 --template-body "$($THIS_DIR/gen-json.py --channel $COREOS_CHANNEL --version $COREOS_VERSION)" \ 36 --stack-name $NAME \ 37 --parameters "$(<$THIS_DIR/cloudformation.json)" \ 38 $EXTRA_AWS_CLI_ARGS 39 40 echo_green "Your Deis cluster on AWS CloudFormation has been successfully updated."