github.com/keithballdotnet/deis@v1.0.1-0.20141111034523-a4511c46a6ce/contrib/ec2/provision-ec2-cluster.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Usage: ./provision-ec2-cluster.sh
     4  #
     5  
     6  set -e
     7  
     8  THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
     9  CONTRIB_DIR=$(dirname $THIS_DIR)
    10  
    11  source $CONTRIB_DIR/utils.sh
    12  
    13  # check for EC2 API tools in $PATH
    14  if ! which aws > /dev/null; then
    15    echo_red 'Please install the AWS command-line tool and ensure it is in your $PATH.'
    16    exit 1
    17  fi
    18  
    19  if [ -z "$DEIS_NUM_INSTANCES" ]; then
    20      DEIS_NUM_INSTANCES=3
    21  fi
    22  
    23  # make sure we have all VPC info
    24  if [ -n "$VPC_ID" ]; then
    25    if [ -z "$VPC_SUBNETS" ] || [ -z "$VPC_ZONES" ]; then
    26      echo_red 'To provision Deis in a VPC, you must also specify VPC_SUBNETS and VPC_ZONES.'
    27      exit 1
    28    fi
    29  fi
    30  
    31  # check that the CoreOS user-data file is valid
    32  $CONTRIB_DIR/util/check-user-data.sh
    33  
    34  # create an EC2 cloudformation stack based on CoreOS's default template
    35  aws cloudformation create-stack \
    36      --template-body "$(./gen-json.py)" \
    37      --stack-name deis \
    38      --parameters "$(<cloudformation.json)"
    39  
    40  echo_green "Your Deis cluster has successfully deployed to AWS CloudFormation."
    41  echo_green "Please continue to follow the instructions in the README."