Search code examples
lambdaaws-sam-cli

sam local start-api cannot be accessed from outside


I am using aws sam local to developer few lambdas/nanoservices

I start the lambda container with:

sudo sam local start-api --docker-network db-pros

where db-pros is the database container

when I go to 127.0.0.1:3000/lambda-name everything works fine however when I try to connect from the test device (Android phone which is connected to WiFi) I cannot.

Tried to use the IP (both Ethernet and docker0) from ifconfig and I still can't connect.

I do not know if it's possible and if yes how.


Solution

  • Use sam local start-api --host 0.0.0.0 instead.