retail-demo-store
retail-demo-store copied to clipboard
Script repitition when staging lambda artifacts
Currently every lambda function has an identical stage.sh
file in ach lambda directly, as the number of lambda functions grows this will become much harder to maintain if it ever needs to be changed. We should consolidate the staging in a single script. This will probably involve changing the bundle.sh
scripts to all create an output folder name that is common to all lambda functions such as dist
rather than the current pattern which is to use a unique name for each function. For example:
# we change this
echo "Building Lambda deployment package"
zip ${PACKAGE_FILE} ${LAMBDA_SOURCE}
zip -gr ${PACKAGE_FILE} pinpoint-templates
# to this
echo "Building Lambda deployment package"
zip ${PACKAGE_FILE} ${LAMBDA_SOURCE}
zip -gr ${PACKAGE_FILE} dist
Agree that this will be a growing maintenance issue over time as the number of Lambdas grow. Other options that have been considered are moving to sam package
or aws cloudformation package
.
So, I looked into SAM and unfortunately you can't use it with nested templates, see this issue: https://github.com/aws/aws-sam-cli/issues/1213. Btw, if you're interested, in my fork I've created a skeleton of how to do API Gateway backed microservices that uses some of the serverless transforms without needing the SAM CLI: https://github.com/svozza/retail-demo-store/pull/5.