Skip to content

Commit

Permalink
Use AWS_REGION env variable as priority before falling back to profil…
Browse files Browse the repository at this point in the history
…e configuration
  • Loading branch information
bklein1 committed Dec 13, 2021
1 parent dbdd203 commit 27010da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,15 @@ then

IMAGES=( BBBgreenlightImage BBBScaleliteNginxImage BBBScaleliteApiImage BBBScalelitePollerImage BBBScaleliteImporterImage )

if [[ -z "${AWS_REGION}" ]]; then
REGION=$(aws configure get region --profile=$BBBPROFILE)
echo "Using default region ${REGION} from profile ${BBBPROFILE}"
else
REGION=${AWS_REGION}
echo "Using region ${REGION} from AWS_REGION environment variable"
fi

ACCOUNTID=$(aws sts get-caller-identity --query Account --output text --profile=$BBBPROFILE)
REGION=$(aws configure get region --profile=$BBBPROFILE)
REGISTRY=$ACCOUNTID.dkr.ecr.$REGION.amazonaws.com
SCALEILITEREGISTRY=$ACCOUNTID.dkr.ecr.$REGION.amazonaws.com/$SCALEILITEREGISTRY
GREENLIGHTREGISTRY=$ACCOUNTID.dkr.ecr.$REGION.amazonaws.com/$GREENLIGHTREGISTRY
Expand Down Expand Up @@ -167,4 +174,4 @@ aws cloudformation deploy --profile=$BBBPROFILE --stack-name $BBBSTACK \
echo "##################################################"
echo "Deployment finished"

exit 0
exit 0

0 comments on commit 27010da

Please sign in to comment.