This example shows how to build a modular AWS Lambda project using SAM (Serverless Application Model) with nested stacks and a shared layer. This helps keep your project clean and organized by separating logic and shared dependencies.


How It Works

  • layer.yaml creates a shared Lambda Layer that contains Node.js packages (like axios).
  • order.yaml and log.yaml are two Lambda functions that use this shared layer.
  • The root template (template.yaml):
    • Creates the layer stack.
    • Passes the layer reference to the other stacks as a parameter.

sam build
sam deploy --guided

Project Repository: https://github.com/OmarMakled/sam-nested-layer