sam build && concurrently "nodemon --on-change-only --ext ts --exec sam build" "sam local start-api"
Requires npm i -g nodemon concurrently
It runs nodemon and sam local start-api in the background simultaneously. The trick is to have the build available before creating docker image, so it's done beforehand and nodemon does it only after changes (using --on-change-only flag).