I am using docker to run Localstack and image 0.11.1
.
I turned on es
service and exposed port 4566
- as according to the doc (https://github.com/localstack/localstack):
Starting with version 0.11.0, all APIs are exposed via a single edge service, which is accessible on http://localhost:4566 by default
I could successfully use AWS CLI to list domain names and create ones:
aws --endpoint-url=http://localhost:4566 es list-domain-names
aws --endpoint-url=http://localhost:4566 es create-elasticsearch-domain --domain-name my-domain --elasticsearch-version 7.4
But when I tried to index document
curl -XPUT http://localhost:4566/my-domain/_doc/1 -d '{"hello": "World"}' -H 'Content-Type: application/json'
it returned {"status": "running"}
reponse to me and I saw the message in logs:
INFO:localstack.services.edge: Unable to find forwarding rule for host "localhost:4566", path "/my-domain/_doc/1", target header "", auth header ""
Then I added port 4571
to exposed ports by configuring it in docker-compose.yml and tried the same, but using http://localhost:4571/my-domain/_doc/1 url this time to index document.
curl -XPUT http://localhost:4571/my-domain/_doc/1 -d '{"hello": "World"}' -H 'Content-Type: application/json'
It worked.
I don't understand - according to the doc I should only use port 4566
but it does not work.
Am I missing something?
My docker-compose.yml with both ports exposed:
...
localstack:
container_name: "localstack"
image: localstack/localstack:0.11.1
privileged: true
ports:
- "4566:4566"
- "4571:4571"
environment:
- SERVICES=es
- START_WEB=0
- LAMBDA_REMOTE_DOCKER=0
- DATA_DIR=/tmp/localstack/data
...
The external service port range is a set of pre-defined ports (by default 4510-4559 ). LocalStack will chose a free port within this range when starting an external service.
Running LocalStack outside of Docker LocalStack is a standalone application and can be run outside of Docker but it doesn't support every operating system.
LocalStack is a cloud service emulator that runs in a single container on your laptop or in your CI environment. With LocalStack, you can run your AWS applications or Lambdas entirely on your local machine without connecting to a remote cloud provider!
Add a description, image, and links to the localstack-ui topic page so that developers can more easily learn about it.
From here, you can see this table:
Parameter | Description | Default |
---|---|---|
service.edgePort |
Port number for Localstack edge service | 4566 |
service.esPort |
Port number for Localstack elasticsearch service | 4571 |
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With