> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect OpenSearch with Basic Auth – StackOne Hub

> Link a OpenSearch account in the StackOne Hub using Basic Auth. End-user guide to authorize the integration and start using OpenSearch actions.

> [!WARNING]
>
> OpenSearch clusters run on many platforms — self-hosted, AWS OpenSearch Service (Managed), Aiven, Bonsai, and others. The credential path differs per platform; the sections below cover the most common ones. The cluster must serve a TLS certificate signed by a Certificate Authority (public or internal) that the calling environment trusts — self-signed certificates cause connection failures at account-creation time.

## Identify your OpenSearch endpoint URL

StackOne calls the OpenSearch REST data plane over HTTPS. The endpoint is the fully-qualified URL of your cluster's REST API — the URL format depends on how OpenSearch is hosted.

**1. Copy the endpoint URL from your platform**

Use the pattern that matches your deployment.

<ul>
  <li>**Self-hosted / on-premise** — an HTTPS URL to your cluster's REST port (default `9200`).</li>
  <li>**AWS OpenSearch Service (Managed)** — the domain endpoint shown on the [Amazon OpenSearch Service console](https://console.aws.amazon.com/aos/home/); host ends in `.es.amazonaws.com`.</li>
  <li>**Aiven for OpenSearch** — the service URI shown on the service **Overview** page in the [Aiven Console](https://console.aiven.io/); host ends in `.aivencloud.com` on a service-specific port.</li>
  <li>**Bonsai** — copy the connection URL from the cluster's **Credentials** tab in the [Bonsai app](https://app.bonsai.io/). Paste only the host+port portion here (host ends in `.bonsaisearch.net`, on port `443`); put the username and password in the credential fields below.</li>
  <li>The URL must use HTTPS — the Security Plugin requires TLS.</li>
  <li>No trailing slash.</li>
</ul>

## Create the integration credentials for your platform

Basic authentication uses a username and password issued by the cluster's OpenSearch Security Plugin. Follow the path that matches your hosting platform, and prefer a scoped integration user over a shared admin account.

**1. Create an internal user in Dashboards (self-hosted)**

Sign in to OpenSearch Dashboards as an admin, then:

<ul>
  <li>Choose **Security**, **Internal Users**, and **Create internal user**.</li>
  <li>Provide a **Username** (e.g. `stackone-integration`) and **Password**. The Security plugin automatically hashes the password and stores it in the `.opendistro_security` index.</li>
  <li>Optionally set **Backend roles** and **Attributes**.</li>
  <li>Choose **Submit**.</li>
  <li>See [Defining users and roles](https://docs.opensearch.org/latest/security/access-control/users-roles/) in the OpenSearch documentation.</li>
</ul>

**2. Enable fine-grained access control (AWS OpenSearch Service)**

On AWS OpenSearch Service, HTTP basic authentication requires **fine-grained access control (FGAC)** with the internal user database enabled. If FGAC is already enabled with the internal user database, sign in to the domain's Dashboards URL (typically the domain endpoint suffixed with `/_dashboards`) as the master user and follow the self-hosted path above. If FGAC is not yet enabled:

<ul>
  <li>Open the [Amazon OpenSearch Service console](https://console.aws.amazon.com/aos/home/), select your domain, and choose **Actions** > **Edit security configuration**.</li>
  <li>Select **Enable fine-grained access control**.</li>
  <li>Choose **Create master user** and specify a username and password.</li>
  <li>Choose **Save changes**. The change triggers a blue/green deployment.</li>
  <li>Once the domain returns to `Active`, sign in to the Dashboards URL with the master credentials and use the standard **Security** > **Internal Users** flow above to create the scoped integration user.</li>
  <li>Reference: [Fine-grained access control in Amazon OpenSearch Service](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/fgac.html).</li>
</ul>

**3. Enable OpenSearch Security and create an admin (Aiven for OpenSearch)**

Aiven services start without OpenSearch Security enabled. To use basic auth against the Security plugin's internal user database, first enable it on the service:

<ul>
  <li>In the [Aiven Console](https://console.aiven.io/), open your OpenSearch service and click **Users** in the sidebar.</li>
  <li>Click **Enable OpenSearch Security**.</li>
  <li>Review the confirmation window, select the acknowledgement checkbox, and click **Continue**.</li>
  <li>Enter a password for the default admin user, then click **Enable OpenSearch Security** to activate.</li>
  <li>Once enabled, further user management moves into the OpenSearch Dashboards UI — sign in as admin and use **Security** > **Internal Users** > **Create internal user** to add the scoped integration user.</li>
  <li>Note: enabling OpenSearch Security cannot be reversed without Aiven support. Reference: [OpenSearch Security in Aiven for OpenSearch](https://aiven.io/docs/products/opensearch/concepts/os-security).</li>
</ul>

**4. Copy the cluster credentials from the Bonsai app**

Bonsai does not expose the Security plugin UI; each cluster comes with its own credentials pair.

<ul>
  <li>In the [Bonsai app](https://app.bonsai.io/), open your cluster and go to the **Credentials** tab.</li>
  <li>Copy the **User** and **Password** values.</li>
  <li>Bonsai clusters ship with cluster-scoped credentials — rotate them via the same page if compromised.</li>
</ul>

## Grant least-privilege permissions

Basic authentication grants the permissions of the mapped role. Map the integration user to the narrowest role that covers the actions this connector needs.

**1. Grant the user a role in Dashboards**

In OpenSearch Dashboards:

<ul>
  <li>Choose **Security**, **Roles**, and select the role you want to assign.</li>
  <li>Choose the **Mapped users** tab and **Manage mapping**.</li>
  <li>Specify the integration username (or a backend role it holds) and choose **Map**.</li>
  <li>Predefined role reference: `readall_and_monitor` grants search on all indexes plus monitoring — a reasonable minimum for read-heavy connector actions. `all_access` grants full cluster access but is not least-privilege.</li>
  <li>Reference: [Predefined roles](https://docs.opensearch.org/latest/security/access-control/users-roles/#predefined-roles).</li>
</ul>

## Verify the credentials

The connection test calls `GET /_cluster/health`. Match the error to a fix:

**1. Verify with a manual health check**

Run the same call StackOne runs, then interpret the response.

<ul>
  <li>**401 Unauthorized** — username or password wrong. Verify with a call to `/_plugins/_security/authinfo` on the same endpoint using the credentials.</li>
  <li>**403 Forbidden** — user authenticates but the mapped role is missing a permission. The response body names the missing permission — grant it via a role and re-map.</li>
  <li>**Certificate error / unable to verify** — cluster is serving a certificate the caller can't validate. Use a properly-signed certificate or publish the internal CA root to the calling environment.</li>
  <li>**Connection refused / timeout** — the cluster URL or port is unreachable. Check firewall rules, security groups, and VPC/VPN reachability from StackOne's egress.</li>
</ul>

## Enter credentials in StackOne Hub

Paste the values below into StackOne Hub to connect the account.

**1. Fill in the connection fields**

Copy each value from the platform you configured above.

<ul>
  <li>**OpenSearch Endpoint URL** — the HTTPS endpoint from step 1.</li>
  <li>**Username** — the internal / master / cluster user you created.</li>
  <li>**Password** — the password you set for that user.</li>
  <li>**OpenSearch Dashboards URL** — optional. Only required if you plan to sync dashboards, visualisations, or index patterns via the `dashboards_*` actions. Self-hosted Dashboards runs on port `5601` by default; AWS OpenSearch Service exposes it as the domain endpoint suffixed with `/_dashboards`. Leave blank for core datasync workflows.</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.