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.
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.
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)