File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# Version 3-working: Uses existing users since AWS CLI version doesn't support user creation
66
77# Set AWS region explicitly to avoid cross-region issues
8- AWS_REGION=" us-east-1" # Change this to your preferred region
8+ AWS_REGION=" ${AWS_DEFAULT_REGION :- us-east-1} " # Uses configured region or defaults to us-east-1
99export AWS_DEFAULT_REGION=" $AWS_REGION "
1010
1111# Initialize log file
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ LOG_FILE="qbusiness-anonymous-app-creation.log"
1111echo " Starting script execution at $( date) " > " $LOG_FILE "
1212
1313# Set region to a supported region for Amazon Q Business
14- AWS_REGION=" us-east-1"
14+ AWS_REGION=" ${AWS_DEFAULT_REGION :- us-east-1} "
1515echo " Using AWS region: $AWS_REGION " | tee -a " $LOG_FILE "
1616
1717# Function to log commands and their outputs
@@ -181,7 +181,7 @@ check_error "$VERIFY_OUTPUT" $? "Failed to verify application creation"
181181
182182# Check if application status is ACTIVE using jq for safer JSON parsing
183183if command -v jq & > /dev/null; then
184- APP_STATUS=$( echo " $VERIFY_OUTPUT " | jq -r ' .application. status' )
184+ APP_STATUS=$( echo " $VERIFY_OUTPUT " | jq -r ' .status' )
185185else
186186 APP_STATUS=$( echo " $VERIFY_OUTPUT " | grep -o ' "status": "[^"]*' | cut -d' "' -f4)
187187fi
You can’t perform that action at this time.
0 commit comments