9

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
...
Ant-nrd
  • 186
  • 2
  • 6
  • 1
    did this ever get resolved? I'm having the same issue and banging my head against the proverbial wall – xgadam Jun 29 '20 at 22:29
  • It seems the solution is to just not use the new edge service yet (as of v0.11.3). There are a lot of issues getting services to route to the correct place. For example https://github.com/localstack/localstack/issues/2329 – Terence Jul 31 '20 at 22:27
  • My team is moving to localstack using 4566 for all services, need to sort out this issue asap. Anyone have any leads? – ChristoKiwi Dec 09 '20 at 22:19
  • 1
    It seems like 4566 is used to access the AWS console, using the cli, but the services run on different ports, Elasticsearch Services being on port 4571. – Thierry J. Apr 08 '21 at 02:44

1 Answers1

1

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
Jess Chen
  • 3,136
  • 1
  • 26
  • 35