Skip to content

Backup / restore Opensearch configuartion

0

Hi all,

we have 3 Opensearch instances (D/Q/P) and we'd like to get a copy of the conf (tenants, roles, etc..) from D and promote it to Q/P. So far the only way I've found to get a copy of the cong is creating a full snapshot (data+conf) sharing it with the other account and, finally, restoring. But we are not interested in the data, we just want the conf (tenants, roles, etc...) .

From opensearch docs, and using the API, there are ways to GET the conf (tenant, roles...), but then it needs to be converted so it can be used for the POST call to recreate the conf.

Is there any other way to get the conf in a format that can be later on used to be restored?

Thanks!

asked 2 months ago80 views
2 Answers
0
Accepted Answer

You don't need snapshots for this. The Security Plugin REST API already returns configuration in a format that can be restored directly — no conversion step required.

How it works

When you GET from any Security Plugin endpoint (e.g., /_plugins/_security/api/roles), the response is a JSON object where each key is the resource name and the value is the resource body. That value is exactly what the corresponding PUT endpoint expects.

So the workflow is simply:

  1. GET each security endpoint (roles, rolesmapping, tenants, actiongroups, internalusers) and save the JSON
  2. For each object in the response, PUT the body to the same endpoint on the target domain

No transformation, no intermediate format, no snapshots.

What to filter out

Each domain has its own system and reserved objects that must not be restored:

  • Users: skip admin, kibanaserver — these are domain-specific
  • Roles: skip anything prefixed with security_ and any role where reserved: true
  • Tenants / Action Groups: skip any where reserved: true

Attempting to restore reserved objects will fail with "Role is reserved" errors.

Important caveats

  • Passwords are not exportable. The GET response contains hashes, not plaintext. After restoring users, you'll need to reset their passwords on the target domain.
  • PUT is idempotent. Running the restore multiple times is safe — it overwrites existing objects.
  • Cross-account works fine. This approach only needs curl/HTTP access to both endpoints. No S3 bucket, no IAM snapshot role, no SigV4 authentication needed.

Bottom line

For config-only promotion across D/Q/P environments, the REST API approach is the right one. The GET output doesn't need conversion — just filter out reserved/system objects and PUT the rest. No snapshots involved.

Related

AWS
answered 20 days ago
  • Thanks Diego.

0

Based on the available information about OpenSearch snapshots and restore operations, there are a few important points to consider for your configuration backup needs:

When working with snapshots in OpenSearch, you have some control over what gets restored through specific parameters. During a restore operation, you can use the include_global_state parameter to determine whether to restore the cluster state, which includes configuration elements. This gives you the ability to selectively restore configuration without necessarily restoring all the data.

However, the snapshot-restore approach is primarily designed as a comprehensive backup mechanism that captures index data, index metadata, and cluster metadata together. While you can control certain aspects of what gets restored, the snapshot process itself creates a point-in-time backup of the entire state.

For your specific use case of promoting only configuration elements (tenants, roles, etc.) across environments without the data, the snapshot-restore mechanism may not be the most efficient approach since snapshots are inherently tied to capturing both data and configuration together.

The API-based approach you mentioned (using GET to retrieve configuration and POST to recreate it) is actually a valid method for configuration management, though it does require transformation of the data format. This approach gives you more granular control over exactly which configuration elements you want to migrate between environments.

Unfortunately, based on the available documentation, there isn't a built-in "configuration-only" snapshot feature that would allow you to extract just the configuration in a directly restorable format separate from the data. You would need to either work with the full snapshot mechanism or continue using the API-based approach with the necessary data transformation steps.
Sources
1. Building from a snapshot - AWS Prescriptive Guidance
Backing up collections using snapshots - Amazon OpenSearch Service

answered 2 months ago
EXPERT
reviewed 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.