Skip to content

Introducing the `sam build` command 馃懛

Compare
Choose a tag to compare
@sanathkr sanathkr released this 19 Nov 21:39
· 2803 commits to master since this release
3f9c638

What's New

You can now use the sam build command to compile deployment packages for AWS Lambda functions written in Python 2.7 and 3.6. If you write code that uses python packages, such as a graphics library for image processing, you need to create a deployment package that will work on the Amazon Linux AMI. The sam build command allows you to easily create deployment artifacts that target AWS Lambda's execution environment, so the functions you build locally will run in a similar environment in the cloud.

The sam build command iterates through the functions in your application, looks for a manifest file (such as requirements.txt) that contains dependencies, and automatically creates deployment artifacts that you can deploy to Lambda using the sam package and sam deploy commands. If your functions depend on packages that have natively compiled programs, you can also use the sam build command with the --use-container flag. This flag builds your functions in a Lambda-like environment locally so they are in the correct format when you deploy them to the cloud.

As part of this release, we have also updated the sam local invoke and sam package commands to work on built artifacts to streamline the build -> test -> package -> deploy workflow. For example, you can execute sam local invoke right after executing sam build and sam local invoke will use the built artifacts. This makes it easier to operate on the template and source code without dealing with intermediate templates.

Changelog

fix: Attempt to recover/invoke function when docker connectivity is poor (#764)
feat: Implementation of "sam build" CLI command (#766)
feat: "sam package" defaults to built template (#775)
feat: Adding a sam --info command (#776)