- lambda-code : contains the source code for the six lambda functions, with each sub-directory containing the function itself, a unit-test file, a Makefile containing build instructions and a requirements.txt containing the libraries to be
pip install
ed - template.yaml : contains the SAM template to build and launch the six lambda functions as well an an IAM role
- buildspec.yaml : contains instructions for AWS CodeBuild to build the functions. This is required to create a pipeline
- Clone and navigate to the repository
- Build the functions:
This pulls in the required packages and native libraries and creates the deployment packages in .aws-sam/build. It also runs the unit tests. Note the --use-container argument is necessary because the native libraries must be pulled in using a docker image resembling the runtime environment of AWS Lambda
sam build --use-container
- Deploy the stack:
The CAPABILITY_NAMED_IAM capability is needed to deploy any SAM stack or CloudFormation stack that creates IAM roles
sam deploy --guided --template-file .aws-sam/build/template.yaml --capabilities CAPABILITY_NAMED_IAM
(Clicking the "deploy" button on the Serverless Application Repository is equivalent to cloning and running the commands above)