-
Notifications
You must be signed in to change notification settings - Fork 0
/
colladmin-lambda-config.sh
executable file
·56 lines (44 loc) · 1.38 KB
/
colladmin-lambda-config.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
DEPLOY_ENV=${1:-dev}
EXIT_ON_DIE=true
source ~/.profile.d/uc3-aws-util.sh
# Check that the SSM_ROOT_PATH has been initialized
check_ssm_root
# Assume deploy runs from DEV
# Set ENV based on deploy env
SSM_DEPLOY_PATH=${SSM_ROOT_PATH//dev/${DEPLOY_ENV}}
# Get the ECR image to publish
AWS_ACCOUNT_ID=`aws sts get-caller-identity| jq -r .Account` || die "AWS Account Not Found"
FUNCTNAME=uc3-mrt-colladmin-lambda
# Get the ARN for the lambda to publish
LAMBDA_ARN_BASE=arn:aws:lambda:${AWS_REGION}:${AWS_ACCOUNT_ID}:function:uc3-mrt-colladmin-img
LAMBDA_ARN=${LAMBDA_ARN_BASE}-${DEPLOY_ENV}
if [ "${DEPLOY_ENV}" == "prd" ]
then
REP=
FORMENV=production
elif [ "${DEPLOY_ENV}" == "stg" ]
then
REP=-${DEPLOY_ENV}
FORMENV=stage
else
REP=-${DEPLOY_ENV}
FORMENV=docker
fi
ADMIN_ALB_URL=`get_ssm_value_by_name admintool/api-path`
ADMIN_ALB_URL=${ADMIN_ALB_URL//-dev/${REP}}
COLLADMIN_ALB_URL=`get_ssm_value_by_name colladmin/api-path`
COLLADMIN_ALB_URL=${COLLADMIN_ALB_URL//-dev/${REP}}
VARS="SSM_ROOT_PATH=${SSM_DEPLOY_PATH}"
VARS="${VARS},ADMIN_ALB_URL=${ADMIN_ALB_URL}"
VARS="${VARS},COLLADMIN_ALB_URL=${COLLADMIN_ALB_URL}"
VARS="${VARS},FORMENV=${FORMENV}"
aws lambda update-function-configuration \
--function-name ${LAMBDA_ARN} \
--region us-west-2 \
--output text \
--timeout 180 \
--memory-size 1024 \
--no-cli-pager \
--environment "Variables={${VARS}}"
date