Packaging the Node.js Application

Since we want every new serverless project to be as a boilerplate, The first thing we have to do is to package our application into a ZIP file and upload it to a S3 bucket which used as source for every new AWS CodeCommit repository created.

Package the application

cd ~/environment/aws-serverless-application-catalog-workshop/sam/nodejs
rm -rf node_modules/
zip -r ~/environment/sample.zip *

Create an unique S3 bucket

Create a S3 bucket choosing an unique name for your bucket. e.g: serverless-wksp-sample-firstname-lastname

aws s3 mb s3://serverless-wksp-sample-<FIRSTNAME-LASTNAME>

Go to your S3 console and confirm your bucket has been created.

Bucket

Upload the ZIP file to S3

cd ~/environment
aws s3 cp sample.zip s3://<your-bucket>/sam/nodejs/sample.zip

Go to your S3 console and confirm your upload has been completed successfully.

Bucket

We are using the /sam/nodejs/ directory structure to allow our teams to grow this strategy in the future to other frameworks and approaches besides AWS SAM (e.g. Kubernetes microservices) and other languages besides Node.js.