From ce9c625d93c8cdfcce18da38ff54dd3e84074b60 Mon Sep 17 00:00:00 2001 From: HamishDrewry <Hamish.Drewry@gmail.com> Date: Thu, 24 May 2018 13:39:23 +0100 Subject: [PATCH] Add files via upload The region was hard coded. Have made changes so that the standard environment variable AWS_DEFAULT_REGION is used. If this variable is not set, then the AWS default region for the profile is used. If the default region is not set, the user is invited to key in the region. --- aws/createResources.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aws/createResources.sh b/aws/createResources.sh index 6561da6..c0c7475 100755 --- a/aws/createResources.sh +++ b/aws/createResources.sh @@ -9,12 +9,28 @@ echo -n "Enter the name for your resources (must be all lowercase with no spaces read ROOT_NAME BUCKET_NAME=cognitosample-$(echo "$ROOT_NAME" | tr '[:upper:]' '[:lower:]') + TABLE_NAME=LoginTrail$ROOT_NAME ROLE_NAME_PREFIX=$ROOT_NAME POOL_NAME=$ROOT_NAME IDENTITY_POOL_NAME=$ROOT_NAME -REGION=us-east-2 + +if [ "$AWS_DEFAULT_REGION" = "" ] +then + REGION="$(aws configure get default.region)" + if [ "$REGION" = "" ] + then + echo -n "Enter the region for your resources and press [ENTER]: " + read REGION + else + echo "AWS default region used: $REGION" + fi +else + REGION="$AWS_DEFAULT_REGION" + echo "Environment variable AWS_DEFAULT_REGION used to set region to $REGION" +fi + EB_INSTANCE_TYPE=t2.small EB_PLATFORM=node.js CURR_DIR=$( cd $(dirname $0) ; pwd -P )