Deploying a Lambda
Breaking down what AWS SAM does
Published: Tuesday, Oct 10, 2023 Last modified: Saturday, Nov 1, 2025
AWS SAM has a guided deployment mode, which is also triggered by --resolve-s3, which abstracts:
- sam build
 - sam package
 - sam deploy
 
sam sync also effectively does the same as the above.
sam build
sam build parses the template.yaml, builds the code and creates a .aws-sam directory with the artifacts and exports template.yaml.
sam package
sam package takes the template.yaml and uploads the artifacts to S3 into a zip file.
sam deploy
sam deploy takes the template.yaml and creates a CloudFormation stack. It also replaces the CodeUri with the S3 location.