Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAM run without rebuild

I have started to use AWS SAM for python. When testing my functions locally I run:

sam build --use-container
sam local start-api 
You can now browse to the above endpoints to invoke your functions. You do **not** need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically.
sam local invoke ...

Then, if I make changes to the code it is not reflected without rebuilding when I invoke my function again. Is there any trick that I am missing here? This prompt is not clear to me.

like image 619
a-dawg Avatar asked Sep 20 '25 08:09

a-dawg


1 Answers

According to https://github.com/aws/aws-sam-cli/issues/920 & https://github.com/aws/aws-sam-cli/issues/901, you are expected to have two consoles/terminals open. One where you run sam local start-api and leave it alone. And another where you run sam build repeatedly (whenever you need to update).

If you find this > slightly annoying,

  • see https://github.com/aws/aws-sam-cli/issues/901#issuecomment-650629408
  • upvote https://github.com/aws/aws-sam-cli/issues/921
like image 115
petey Avatar answered Sep 21 '25 22:09

petey