AWS SAM CLI Adds BuildKit Support for AWS Lambda Functions Packaged as Container Images

AWS has updated the SAM CLI to support BuildKit for developers who package their Lambda functions as container images. BuildKit is a modern build engine for Docker that introduces advanced features such as parallelized build stages and more efficient caching mechanisms. By leveraging these capabilities, developers can significantly reduce the time required to build and iterate on serverless applications during the development lifecycle. This integration allows for a more streamlined workflow when managing complex container environments for serverless workloads. Using BuildKit enables more sophisticated build-time optimizations that were previously difficult to achieve with the standard Docker build process. It also provides better handling of secrets and SSH forwarding during the image construction phase. Engineers can enable this feature through the SAM CLI configuration or environment variables, allowing for seamless integration into existing CI/CD pipelines. This update specifically targets the build phase of the SAM workflow for container-based deployments. Users should ensure their local Docker environment or build runners support BuildKit to take full advantage of these performance improvements. Detailed implementation steps and compatibility requirements are available in the official AWS documentation for the SAM CLI.
Related tools
Recommended tools for this topic
These picks prioritize high-intent tools relevant to this topic. Some links may include partner or affiliate tracking.
High-value hosting and deployment path for frontend and cloud readers.
View VercelStrong cloud alternative for startups and developer-led infrastructure decisions.
View DigitalOceanA strong security and edge platform match across CDN, Zero Trust, and app protection.
View CloudflareComparison
| Aspect | Before / Alternative | After / This |
|---|---|---|
| Build Execution | Sequential processing of build stages | Parallelized execution of independent build stages |
| Caching Mechanism | Basic layer-based caching | Efficient, granular caching for faster rebuilds |
| Output Management | Standard console output during image creation | High-concurrency progress tracking with detailed logs |
| Build Performance | Higher latency during complex image construction | Reduced build times via concurrent processing |
Action Checklist
- Update AWS SAM CLI to the latest version Ensure your local environment meets the minimum version requirements for BuildKit support
- Enable BuildKit in your Docker configuration Set the DOCKER_BUILDKIT environment variable to 1
- Modify the sam build command to utilize the new engine Check for any new CLI flags specifically for container image builds
- Test existing Dockerfiles for compatibility Verify that advanced BuildKit syntax does not conflict with existing SAM templates
- Update CI/CD pipeline environment variables Ensure build runners have the necessary Docker engine versions and configurations
Source: AWS What's New
This page summarizes the original source. Check the source for full details.


