0

I'm looking for the recommended local development workflow for a project that uses multiple, independent AWS SAM applications within a single monorepo.

Setup:

  1. Layers Stack: one SAM application dedicated entirely to shared Lambda Layers. This stack defines and deploys a CommonLayer, SpecificLayer, etc.
  2. Function Stacks: multiple other SAM applications for microservices. These applications define Lambda functions.
  3. Dependency: The function stacks are dependent on the layers stack. I link them during deployment by passing the full, version-specific ARN of a layer as a CloudFormation parameter (e.g., sam deploy --parameter-overrides CommonLayerVersionArn=...). This process works perfectly in our CI/CD pipeline.

What I Am Trying to Achieve (Local Development):

I want to establish a fast, iterative local development feedback loop using sam watch. My goal is to run two sam watch processes concurrently:

  • One sam watch for the layers application.
  • Another sam watch for a function application.

My expectation is that when I save a change to a file inside the CommonLayer, the layer's sam watch would sync it, and the function's sam watch would immediately pick up this new layer version, allowing me to test the change instantly.

The Question:

The observed behavior is that while the layer is updated (creating a new layer version), the function application is unaware of this change and continues to use the old layer version it was originally deployed with. I understand this is likely because updating a layer ARN is a configuration change, which sam sync is designed to skip for speed.

What is the recommended best practice for achieving a fast development feedback loop when working on Lambda Layers and the functions that consume them in this multi-stack SAM setup?

Am I supposed to use custom scripts to automate the deploy layer -> fetch new ARN -> deploy function cycle locally, or is there a more integrated sam feature or workflow I am missing?

Thank you for any insights or solutions you can share.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.