AWS SAM

Serverless Application Model

  • Like CloudFormation but much easier and more friendly
    • Generate complex CloudFormation from simple SAM YAML file
  • Use YAML
  • Supports anything from CloudFormation: (Outputs, Mappings, Parameters, Resources, ...)
  • Only 2 commands to deploy to AWS
  • Use CodeDeploy to deploy lambda functions
  • Have functionality to run AWS Lambda, API Gateway, DynamoDB locally

Recipe

  • Use the transform header to indicate that it's SAM template. CloudFormation will know that you're using a Sam Template
    • AWS::Serverless-2016-10-31
  • Write code
    • AWS::Serverless::Function
    • AWS::Serverless::Api
    • AWS::Serverless::SimpleTable
  • Package & Deploy
    • aws cloudformation package or sam package
    • aws cloudformation deploy or sam deploy

Pasted image 20221016122240.png