File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
infrastructure/db-setup/src/main/java/com/amazon/aws Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
6565 .withBody ("DB Setup successful" );
6666 }
6767 }
68- } catch (SQLException | IOException sqlException ) {
68+ } catch (Exception sqlException ) {
6969 logger .error ("Error connection to the database:" + sqlException .getMessage ());
7070 return new APIGatewayProxyResponseEvent ()
7171 .withStatusCode (500 )
Original file line number Diff line number Diff line change @@ -19,7 +19,16 @@ cdk bootstrap
1919cdk deploy UnicornStoreInfrastructure --require-approval never --outputs-file target/output.json
2020
2121# Execute the DB Setup function to create the table
22- aws lambda invoke --function-name $( cat target/output.json | jq -r ' .UnicornStoreInfrastructure.DbSetupArn' ) /dev/stdout | cat;
22+ lambda_result=$( aws lambda invoke --function-name $( cat target/output.json | jq -r ' .UnicornStoreInfrastructure.DbSetupArn' ) /dev/stdout 2>&1 )
23+ # Extract the status code from the response payload
24+ lambda_status_code=$( echo " $lambda_result " | jq ' first(.. | objects | select(has("statusCode"))) | .statusCode' )
25+
26+ if [ " $lambda_status_code " == " 200" ]; then
27+ echo " DB Setup Lambda function executed successfully"
28+ else
29+ echo " DB Setup Lambda function execution failed"
30+ exit 1
31+ fi
2332
2433cd ~ /environment/aws-lambda-java-workshop/labs/unicorn-store
2534./setup-vpc-peering.sh
You can’t perform that action at this time.
0 commit comments