-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.sh
executable file
·32 lines (25 loc) · 758 Bytes
/
setup.sh
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
28
29
30
31
32
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# Setup the Lambda code
cd globalserverless/lambdacode/
npm install
zip -r Archive.zip .
rm -rf node_modules/
rm event.json
rm exports.js
rm package-lock.json
rm package.json
# Deploy stacks
cd ../../globalserverless
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install -e .
cdk bootstrap
cdk deploy GlobalServerlessPrimaryStack
STREAMARN=$(aws dynamodbstreams list-streams --region ap-southeast-2 --table-name GlobalDDBTableForAppSync --limit 1 | grep -oP '(?<="StreamArn": ")[^"]*')
cdk deploy GlobalServerlessSecondaryStack --parameters globalStreamARN=$STREAMARN
deactivate
# Finish
echo "Code Setup Completed"