Building a SAM Application
In this lesson, you will learn how to build a SAM application.
We'll cover the following
Step 1: Build
Most modern software programming languages make it easy to reference third-party libraries and packages. For example, Node.js comes with NPM, a package manager that installs the libraries listed in the package.json
project manifest. Python works with pip
. Java has maven
. In order for Lambda functions to start as quickly as possible, you need to install and bundle dependencies before uploading it to AWS. CloudFormation doesn’t know how to do that. However, the SAM command line tools know how to install and bundle dependencies for many common package managers. For compiled languages, such as Java and Go, SAM knows how to turn source files into executable code.
To prepare the function source for uploading to AWS, execute the following command in the main project directory (app
). This will be the one that contains the CloudFormation template (template.yaml
):
sam build
Note: Please add “C.UTF-8” in the LANG and LC_ALL field in the below terminal.
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy