github.com/arkadijs/deis@v1.5.1/contrib/ec2/update-ec2-cluster.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Usage: ./update-ec2-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 EC2 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  # check that the CoreOS user-data file is valid
    27  $CONTRIB_DIR/util/check-user-data.sh
    28  
    29  # update the deis EC2 cloudformation
    30  aws cloudformation update-stack \
    31      --template-body "$($THIS_DIR/gen-json.py)" \
    32      --stack-name $NAME \
    33      --parameters "$(<$THIS_DIR/cloudformation.json)"
    34  
    35  echo_green "Your Deis cluster on AWS CloudFormation has been successfully updated."