Run AWS SAM Local on another port


I’ve been successful in running AWS SAM Local on my machine on port 3000 with this command:

The documentation says there’s a flag -d that runs the server in debug mode on a different port. I need to run this on port 8080. So I tried this:

And the server still starts up on 3000:

Does anyone know what I’m doing wrong here? Thanks!


The -d (--debug-port) option refers to the port that you would connect a debugger to, not the port that the application listens on.

So sam local start-api -d 8080 translates to “Start the application on the default port, and allow me to connect a debugger to port 8080”.

To have the application listen on a different port, use the -p (--port) option.

You can of course use both. For example,

means “Start the application on port 8080, and allow me to connect a debugger on port 5858”.

Leave a Reply