File tree Expand file tree Collapse file tree
tuts/145-aws-globalaccelerator-gs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22WORK_DIR=$( mktemp -d) ; exec > >( tee -a " $WORK_DIR /ga.log" ) 2>&1
3- export AWS_DEFAULT_REGION=us-west-2; echo " Region: us-west-2 (Global Accelerator)"
3+ REGION=us-west-2 # Global Accelerator requires us-west-2
4+ export AWS_DEFAULT_REGION=" $REGION " ; export AWS_REGION=" $REGION " ; echo " Region: $REGION (Global Accelerator)"
45RANDOM_ID=$( cat /dev/urandom | tr -dc ' a-z0-9' | fold -w 8 | head -n 1) ; GA_NAME=" tut-ga-${RANDOM_ID} "
56handle_error () { echo " ERROR on line $1 " ; trap - ERR; cleanup; exit 1; }; trap ' handle_error $LINENO' ERR
67cleanup () { echo " " ; echo " Cleaning up..." ; [ -n " $GA_ARN " ] && { aws globalaccelerator update-accelerator --accelerator-arn " $GA_ARN " --no-enabled 2> /dev/null; sleep 5; aws globalaccelerator delete-accelerator --accelerator-arn " $GA_ARN " 2> /dev/null && echo " Deleted accelerator" ; }; rm -rf " $WORK_DIR " ; echo " Done." ; }
You can’t perform that action at this time.
0 commit comments