How to Configure Opensearch IAM Authentication

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up opensearch iam authentication by linking cloud roles to internal cluster roles. Then your apps sign each web request with temporary cloud keys. Most teams start by attaching a broad policy to the cluster domain. That quick setup lets engineers and services log in from the cloud network. Yet broad roles often grant every user full read and write power. One bad query can wipe out an index or leak customer records. How opensearch iam authentication works in practice Cloud search clust

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up opensearch iam authentication by linking cloud roles to internal cluster roles. Then your apps sign each web request with temporary cloud keys. Most teams start by attaching a broad policy to the cluster domain. That quick setup lets engineers and services log in from the cloud network. Yet broad roles often grant every user full read and write power. One bad query can wipe out an index or leak customer records.

How opensearch iam authentication works in practice

Cloud search clusters rely on two distinct rule systems that work together. The outer layer checks the cloud identity of the caller first. The inner layer uses the search engine security plugin for data rules. When an app sends a search request, it signs the message payload. It uses standard cloud signature methods and short-lived keys from its role. The cluster receives the signed request and checks the cloud identity first.

If the cloud policy allows entry, the request moves inside the cluster. Next, the internal security engine reads the role name from the request. You must map this cloud role to an internal search role ahead of time. The internal role holds the actual rules for indices, documents, and fields. This role mapping step links your cloud account to your search data. Without this link, valid cloud users still get a permission error inside the cluster.

Setting up role mappings for users and apps

Start by turning on fine-grained access control in your cluster settings. Designate a master user or an admin role to manage the setup. Next, create specific cloud roles for your apps and your engineering team. Grant those roles permission to send HTTP requests to the cluster endpoint. Do not give full admin rights in the cloud policy itself. Keep the outer policy small and let the inner cluster handle data rules.

Now log in to the search dashboard with your admin account. Open the security section and create a new internal role for readers. Limit this role to read actions on specific index names only. Then open the role mapping tab for that new reader role. Paste the exact cloud role identifier into the backend role field. Any app or user with that cloud role now gets read rights. Repeat this flow to build separate roles for writers and on-call engineers.

Service-to-Service Authentication + AWS IAM Policies: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native role mapping solves and where it falls short

Native role mapping stops you from sharing static passwords across your team. Apps use automatic cloud keys that rotate on their own schedule. You can revoke access fast by removing a user from a cloud role. Internal cluster roles also let you block access to whole indices. This setup solves basic login control for automated services and backend workers.

Still, static role mappings only decide who can enter the cluster. They do not inspect what individual requests do once the user logs in. An engineer with a support role might run a heavy wildcard query. That single request can spike memory use and crash the whole cluster. Also, index roles apply the same way during normal work and emergencies. Teams end up granting broad daily rights just in case an outage happens. Also, native field rules require strict upkeep whenever data schemas change. If a new log field contains phone numbers or emails, old rules miss it. The cluster returns those raw fields in search results to every reader.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Why do my signed requests still return a permission error?

The cloud policy lets you reach the cluster, but internal mapping is missing. You must add your cloud role identifier as a backend role inside the cluster.

Should I use resource policies or internal security roles for data access?

Use resource policies only to control network entry to the cluster domain. Use internal security roles to control read and write actions on specific indices.

How do local engineers run queries when cloud auth is active?

Engineers must assume a valid cloud role in their local terminal first. Then they use a local signing tool to sign each query they send.

The query runs. The emails stay hidden.