LocalStack 63,725 's new CLI, lstk 37 (github.com/localstack/lstk (https://github.com/localstack/lstk 37 ), Apache 2.0, 1.2.0 here, from npm 2,036 install -g @localstack/lstk or its release binaries), manages the emulator and proxies aws, cdk, terraform and sam with the endpoint, test credentials and region preset. Starting an emulator with it requires a LocalStack account; with --endpoint-url it targets one already running, which works with the pinned 4.13.1 image and no login:
export PATH=~/v5-ch7/tools/lstk:$PATH
lstk --version
URL=$(lstk --endpoint-url http://localhost:31566 sam list stack-outputs \
--stack-name booknest-sam --output json | jq -r '.[0].OutputValue')
echo "$URL"
API=${URL#https://}; API=${API%%.*}
curl -s "localhost:31566/_aws/execute-api/$API/Prod/books/3"; echolstk 1.2.0
https://qwxpa6lyid.execute-api.localhost.localstack.cloud:4566/Prod
{"genre":"Cooking","id":3,"title":"Salt and Saffron","author":"Priya Nair","price":24}The output URL uses LocalStack's execute-api host name and its internal port 4566; on this machine the same API answers through the gateway path /_aws/execute-api/<id>/Prod on port 31566. The older wrapper, samlocal (pip 21,050 install aws-sam-cli-local, 1.70.1), does the same by rewriting the endpoint, and plain sam with AWS_ENDPOINT_URL, as in SAM CLI, needs neither. On AWS 24 (not run here), sam deploy --guided asks for these settings once and saves them to samconfig.toml.