Deprecated LocalStack CLI
Introduction
Section titled “Introduction”The LocalStack Command Line Interface (CLI) is the original Python tool for starting, managing, and configuring the LocalStack container. It works with the Azure emulator, as long as you point it at the Azure image.
Installation
Section titled “Installation”pip install localstacklocalstack --versionRecent versions of the CLI print a deprecation warning before each command and then continue with it.
For the other installation options, such as pre-built binaries, see Installation in the AWS docs.
Start the Azure emulator
Section titled “Start the Azure emulator”The CLI starts the AWS emulator image unless you tell it otherwise, so set IMAGE_NAME to the Azure image.
Export it rather than setting it for a single command, so that every localstack command in your shell session uses the same image:
export LOCALSTACK_AUTH_TOKEN="<your-auth-token>"export IMAGE_NAME=localstack/localstack-azure:latestlocalstack start -dlocalstack wait -t 120The CLI runs the emulator in a container named localstack-main.
Confirm that it is up and licensed:
curl -s http://localhost:4566/_localstack/health{"edition": "azure-alpha", "license": true}"edition": "azure-alpha" confirms that you are talking to the Azure emulator.
Environment variables
Section titled “Environment variables”The CLI forwards the LocalStack configuration variables it knows from your shell to the container. These are the ones that matter for Azure:
| Variable | Value | Why |
|---|---|---|
IMAGE_NAME |
localstack/localstack-azure:latest |
Selects the Azure image. Required, because the CLI defaults to the AWS image. |
LOCALSTACK_AUTH_TOKEN |
Your auth token | Required. The emulator doesn’t start without a valid license. |
MSSQL_ACCEPT_EULA |
Y |
Accepts the Microsoft SQL Server EULA, which Azure SQL Database needs. |
LS_AZURE_PORTAL |
1 |
Enables the Azure Portal Emulator. |
DEBUG / LS_LOG |
1 / debug |
Turns on verbose emulator logs. |
You can also pass a variable to the container with -e:
localstack start -d -e LS_AZURE_PORTAL=1Lifecycle
Section titled “Lifecycle”localstack status # show the container statuslocalstack logs # print the emulator logs, add -f to follow themlocalstack restart # restart LocalStack inside the running container, keeping your resourceslocalstack stop # stop and remove the containerRun localstack --help for the full list of commands and flags.
Related
Section titled “Related”- lstk: the recommended way to run the Azure emulator.
- Azure Portal Emulator: the portal that
LS_AZURE_PORTALenables.