Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit b451d49

Browse files
authored
add instructions on how to connect opensearch dashboards (#1208)
1 parent cc78821 commit b451d49

File tree

1 file changed

+46
-0
lines changed
  • content/en/user-guide/aws/opensearch

1 file changed

+46
-0
lines changed

content/en/user-guide/aws/opensearch/index.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,52 @@ The following output will be visible on your terminal:
203203

204204
It's important to note that any unauthorized requests will yield an HTTP response with a status code of 401 (`Unauthorized`).
205205

206+
## OpenSearch Dashboards
207+
208+
[OpenSearch Dashboards](https://opensearch.org/docs/latest/dashboards/) is a great tool to analyze and visualize the data in your OpenSearch domain.
209+
And you can directly use the official OpenSearch Dashboards Docker image to analyze data in your OpenSearch domain within LocalStack!
210+
211+
When using OpenSearch Dashboards with LocalStack, you need to make sure to:
212+
- Enable the [advanced security options]({{< ref "#advanced-security-options" >}}) and set a username and a password.
213+
This is required by OpenSearch Dashboards.
214+
- Ensure that the OpenSearch Dashboards Docker container uses the LocalStack DNS.
215+
You can find more information on how to connect your Docker container to Localstack in our [Network Troubleshooting guide]({{< ref "references/network-troubleshooting/endpoint-url/#from-your-container" >}}).
216+
217+
First, you need to make sure to start LocalStack in a specific Docker network:
218+
{{< command >}}
219+
$ localstack start --network ls
220+
{{< /command >}}
221+
222+
Now you can provision a new OpenSearch domain.
223+
Make sure to enable the [advanced security options]({{< ref "#advanced-security-options" >}}):
224+
225+
{{< command >}}
226+
$ awslocal opensearch create-domain --cli-input-json file://./opensearch_domain.json
227+
{{< /command >}}
228+
229+
Now you can start another container for OpenSearch Dashboards, which is configured such that:
230+
- The port for OpenSearch Dashboards is mapped (`5601`).
231+
- The container is in the same network as LocalStack.
232+
- The container uses the LocalStack DNS.
233+
- The OpenSearch Domain is set.
234+
- The OpenSearch credentials are set.
235+
- The version of OpenSearch Dashboards is the same as the OpenSearch domain.
236+
237+
{{< command >}}
238+
docker inspect localstack-main | \
239+
jq -r '.[0].NetworkSettings.Networks | to_entries | .[].value.IPAddress'
240+
# prints 172.22.0.2
241+
242+
docker run --rm -p 5601:5601 \
243+
--network ls \
244+
--dns 172.22.0.2 \
245+
-e "OPENSEARCH_HOSTS=http://secure-domain.us-east-1.opensearch.localhost.localstack.cloud:4566" \
246+
-e "OPENSEARCH_USERNAME=admin" -e "OPENSEARCH_PASSWORD=really-secure-passwordAa!1" \
247+
opensearchproject/opensearch-dashboards:2.11.0
248+
{{< /command >}}
249+
250+
Once the container is running, you can reach OpenSearch Dashboards at `http://localhost:5601` and you can log in with your OpenSearch domain credentials.
251+
206252
## Custom OpenSearch backends
207253

208254
LocalStack employs an asynchronous approach to download OpenSearch the first time you create an OpenSearch cluster. Consequently, you'll receive a prompt response from LocalStack initially, followed by the setup of your local OpenSearch cluster once the download and installation are completed.

0 commit comments

Comments
 (0)