-
Notifications
You must be signed in to change notification settings - Fork 5
/
update-stack.sh
executable file
·30 lines (23 loc) · 1021 Bytes
/
update-stack.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
#!/bin/sh
# This script will build the cdk for the provided project and then call update-stack with the AWS Cli.
# It will fail if the stack does not already exist, in this case use create-stack
# Usage: ./update-stack.sh [project name]
# eg. ./update-stack.sh discount-api
# Exit if any of these commands fail
set -e
if [ $# -lt 1 ]; then
echo "please provide the project name as an argument, eg. ./update-stack.sh discount-api"
exit 2
fi
PROJECT_NAME="$1"
echo "Updating stack $PROJECT_NAME"
pnpm --filter cdk test-update && pnpm --filter cdk package
aws cloudformation update-stack \
--capabilities '["CAPABILITY_AUTO_EXPAND", "CAPABILITY_NAMED_IAM", "CAPABILITY_IAM"]' \
--stack-name "support-CODE-$PROJECT_NAME" \
--template-body "file://cdk/cdk.out/$PROJECT_NAME-CODE.template.json" \
--profile membership \
--region eu-west-1 \
> /dev/null
echo -e "\nStack update has been started, check progress in the AWS console.";
echo -e "https://eu-west-1.console.aws.amazon.com/cloudformation/home";