-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreset-lab.sh
More file actions
executable file
·27 lines (21 loc) · 1 KB
/
reset-lab.sh
File metadata and controls
executable file
·27 lines (21 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Load Variables
. ./load-variables.sh
# Delete DynamoDB tables
aws dynamodb delete-table --table-name decks-master
aws dynamodb delete-table --table-name scores-master
sleep 5
# Install Lambda dependencies
cd backend/src
npm install
cd ../..
# Package and Deploy SAM Template
sam package --template-file backend/template.yaml --s3-bucket $SAMBUCKET --output-template-file backend/packaged.yaml --region $REGION
sam deploy --template-file backend/packaged.yaml --stack-name $STACK --capabilities CAPABILITY_NAMED_IAM --region $REGION
rm -f backend/packaged.yaml
# API Gateway Deploy
RESTAPI=$(aws cloudformation describe-stacks --stack-name $STACK --query 'Stacks[0].Outputs[?OutputKey==`APIBaseURL`].OutputValue' --output text)
DEPID=$(aws apigateway create-deployment --rest-api-id $RESTAPI --stage-name Prod --query "id" --output text)
aws apigateway update-stage --rest-api-id $RESTAPI --stage-name Prod --patch-operations op='replace',path='/deploymentId',value=$DEPID
# Deploy the app
./deploy-app.sh