Regarding OpenSearch GUI

Hello,

I would like to access OpenSearch launched from LocalStack using a GUI.
Is it possible to access the OpenSearch index from the LocalStack Resource Browser?
If setting up the GUI is required, are there any methods to utilize OpenSearch Dashboards?

Hi @enom!
Could you maybe explain a bit what you mean by that?
Do you mean setting up an OpenSearch Dashboard instance to visualize data in an OpenSearch Domain within LocalStack?

The OpenSearch Dashboard is a separate component available as a Docker container, so maybe we could just craft a Docker command which connects an OpenSearch Dashboard to the OpenSearch Instance in LocalStack?
How are you starting and configuring LocalStack? Do you use Docker-Compose? Or the official LocalStack CLI?

Thanks!

1 Like

@ alexrashed
Thanks for watchin my post.

As you mentioned, I would like to set up an OpenSearch Dashboard instance to visualize data within an OpenSearch domain in LocalStack. However, this might not be an issue with LocalStack but rather with my code.

I believe it should be possible to establish a connection between OpenSearch within LocalStack and OpenSearch Dashboards.

I want to do like this,

.devcontainer.json

{
	"name": "PoC",
	"dockerComposeFile": "./docker-compose.yml",
	"service": "devcontainer",
	"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
	"features": {
		"ghcr.io/devcontainers/features/aws-cli:1": {},
		"ghcr.io/devcontainers/features/github-cli:1": {},
		"ghcr.io/devcontainers/features/node:1": {},
		"ghcr.io/devcontainers-contrib/features/amplify-cli:2": {},
		"ghcr.io/devcontainers-contrib/features/aws-cdk:2": {},
		"ghcr.io/devcontainers-contrib/features/vue-cli:2": {},
		"ghcr.io/devcontainers-contrib/features/localstack:2": {},
		"ghcr.io/devcontainers/features/docker-in-docker:2": {}
	},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	"forwardPorts": [5601]
}

docker-compose

version: '3.8'
services:
  devcontainer:
    image: mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye
    volumes:
      - ../..:/workspaces
    command: sleep infinity
    ports:
      - 3000:3000
      - 4566:4566
    networks:
      - devcontainer-network

  opensearch-dashboards:
    image: opensearchproject/opensearch-dashboards:latest
    container_name: opensearch-dashboards
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      OPENSEARCH_HOSTS: http://my-domain.us-east-1.opensearch.localhost.localstack.cloud:4566
    networks:
      - devcontainer-network

networks:
  devcontainer-network:

Ah, that’s an interesting setup, I wasn’t ware of the community driven devcontainers feature!
We do have a guide on how to setup networking between different containers: Accessing LocalStack via the endpoint URL | Docs

The most important thing is that *.localhost.localstack.cloud resolves to localhost by default, so you have to make sure that the container uses the DNS in LocalStack to resolve its own IP in the Docker network correctly…

Let me know if this helps.

1 Like

hi @alexrashed,

just following up with your suggestion of:

The OpenSearch Dashboard is a separate component available as a Docker container, so maybe we could just craft a Docker command which connects an OpenSearch Dashboard to the OpenSearch Instance in LocalStack?

could you provide some ideas how to do so?

i wanted to obtain similar result. i’m using docker.

Hi @danngyn!
I gave it a try and added a short section to our docs: OpenSearch Service | Docs
Let me know if this works for you!

1 Like

thanks @alexrashed it works.

tho this approach requires using security plugin which is another pending issue on OS side, not related to localstack.

another question if you have the time: is it also possible set this up in k8s? i’ve been trying with minikube, deployed a opensearch-dashboard with dns configs for pod/service but didn’t get any positive results.