Amazon OpenSearch Service is a managed AWS service that deploys, operates, and scales OpenSearch clusters, handling node provisioning, snapshots, patching, and access control through AWS Identity and Access Management (IAM). OpenSearch is the distributed search and analytics engine built on Apache Lucene that powers it, well suited for log analytics, application monitoring, security analytics, and full-text search, and it ships with OpenSearch Dashboards for exploring and visualizing data. This guide deploys OpenSearch as a self-hosted alternative: it prepares the host, secures the cluster with your own certificates and users, deploys a three-node cluster with Dashboards using Docker Compose, verifies the deployment, schedules snapshots to S3-compatible object storage, and outlines how to migrate from Amazon OpenSearch Service. By the end, you'll have a secured three-node OpenSearch cluster with Dashboards served over HTTPS, scheduled snapshots, and a clear migration path off the managed service.
Understanding the Architecture
Amazon OpenSearch Service wraps the OpenSearch engine with managed infrastructure and AWS-native access control. The most important mappings to a self-hosted cluster:
| Amazon OpenSearch Service | Self-Hosted OpenSearch |
|---|---|
| Managed domain | OpenSearch cluster (the nodes serving the REST API) |
| Query DSL, mappings, analyzers | Unchanged |
| IAM policies + SigV4 request signing | Security plugin (basic auth, certificates, SAML, OpenID Connect) |
| VPC-only endpoint | Your own network boundary and reverse proxy |
| UltraWarm and cold storage tiers | No managed equivalent |
| Automated snapshots to Amazon S3 | Snapshot Management policy writing to an S3-compatible repository |
| Index State Management (ISM) | ISM plugin (same) |
| Amazon CloudWatch metrics | Cluster APIs and the Alerting plugin |
| Multi-AZ with Standby | Node placement and replica count you choose |
| Managed upgrades and maintenance windows | Upgrades you perform, on the release you choose |
| OpenSearch Dashboards | OpenSearch Dashboards (same) |
Prerequisites
- An Ubuntu 24.04 server (at least 4 CPU cores and 8 GB of RAM) accessed as a non-root user with sudo privileges
- Docker and Docker Compose installed
- An S3-compatible object storage bucket for snapshots, with its hostname, access key, and secret key
- A domain name you can point at the server for Dashboards
Prepare the Host
OpenSearch memory-maps its index files and locks its Java heap in memory, so disable swap and raise the memory map limit on the host before the containers start.
1. Disable memory paging and swapping on the host:
$ sudo swapoff -a
2. Comment out any swap entries in the file systems table so swap stays disabled after a reboot:
$ sudo sed -i '/ swap / s/^/#/' /etc/fstab
3. Open the sysctl configuration file to raise vm.max_map_count:
$ sudo nano /etc/sysctl.conf
4. Add the following line, or change the value if the key exists:
vm.max_map_count=262144
Save and close the file.
5. Reload the kernel parameters:
$ sudo sysctl -p
6. Verify that the kernel applied the change:
$ cat /proc/sys/vm/max_map_count
The output returns the value 262144.
Set Up the Directory Structure, Configuration, and Environment Variables
The project directory holds the environment file, the security configuration, the certificates, and the Docker Compose file.
1. Create the project directory with subdirectories for certificates and the keystore:
$ mkdir -p ~/opensearch/certs ~/opensearch/keystore
2. Navigate to the project directory:
$ cd ~/opensearch
3. Create the environment file:
$ nano .env
4. Add the following configuration:
# OpenSearch release
OPENSEARCH_VERSION=3.10.0
# Password OpenSearch Dashboards uses to connect to the cluster
DASHBOARDS_SERVER_PASSWORD='DASHBOARDS_SERVER_PASSWORD'
# Domain and TLS
DASHBOARDS_DOMAIN=DASHBOARDS_DOMAIN_NAME
LETSENCRYPT_EMAIL=EMAIL_ADDRESS
Replace:
-
DASHBOARDS_SERVER_PASSWORDwith a strong password for the internalkibanaserveruser. Keep the single quotation marks so that Docker Compose does not interpret a$character in the password as a variable. -
DASHBOARDS_DOMAIN_NAMEwith your domain name, for exampledashboards.example.com. -
EMAIL_ADDRESSwith your email address for Let's Encrypt notifications.
Save and close the file.
5. Restrict access to the environment file to your user, because it contains a password:
$ chmod 600 .env
Configure Cluster Security
The OpenSearch image ships a demo security configuration with known certificates and default users. This deployment disables that demo setup and replaces it with a private certificate authority, node and administrator certificates, and internal users whose passwords only you know. Each node presents its node certificate to identify itself and encrypt traffic between nodes and on the REST API. The administrator certificate is a client certificate that authorizes changes to the security configuration.
1. Create a script that generates the certificate authority and the certificates:
$ nano generate-certs.sh
2. Add the following content:
#!/bin/bash
set -e
cd ~/opensearch/certs
# Root certificate authority
openssl genrsa -out root-ca-key.pem 2048
openssl req -new -x509 -sha256 -key root-ca-key.pem -subj "/O=EXAMPLE/CN=opensearch-root-ca" \
-out root-ca.pem -days 730 \
-addext 'basicConstraints = critical, CA:TRUE, pathlen:0' \
-addext 'keyUsage = critical, keyCertSign, cRLSign' \
-addext 'authorityKeyIdentifier = keyid'
# Administrator certificate
openssl genrsa -out admin-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in admin-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out admin-key.pem
openssl req -new -key admin-key.pem -subj "/O=EXAMPLE/CN=admin" -out admin.csr
openssl x509 -req -in admin.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out admin.pem -days 730
# Node certificates
for NODE in opensearch-node1 opensearch-node2 opensearch-node3; do
openssl genrsa -out ${NODE}-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in ${NODE}-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out ${NODE}-key.pem
openssl req -new -key ${NODE}-key.pem -subj "/O=EXAMPLE/CN=${NODE}" -out ${NODE}.csr
echo "subjectAltName=DNS:${NODE},DNS:localhost,IP:127.0.0.1" > ${NODE}.ext
openssl x509 -req -in ${NODE}.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out ${NODE}.pem -days 730 -extfile ${NODE}.ext
done
# Clean up intermediate files
rm -f *-temp.pem *.csr *.ext
Save and close the file. The script follows the OpenSearch self-signed certificate procedure:
-
root-ca.pem: The certificate authority that every node and client trusts. Keeproot-ca-key.pemprivate, because anyone with it can issue certificates the cluster accepts. -
admin.pem: The administrator certificate. Its distinguished name (DN)CN=admin,O=EXAMPLEis the only identity allowed to load the security configuration. -
opensearch-node1.pemtoopensearch-node3.pem: One certificate per node, with subject alternative names that match the container name andlocalhost. -
-days 730: A two-year validity period. Renew the certificates before they expire.
3. Run the script:
$ bash generate-certs.sh
The certs directory now contains root-ca.pem, admin.pem, admin-key.pem, and a certificate and key for each of the three nodes.
4. Restrict access to the private keys so only the file owner can read them:
$ chmod 600 certs/*-key.pem
5. Give ownership of the certs directory to the user ID 1000 that OpenSearch runs as inside the container:
$ sudo chown -R 1000:1000 certs
6. Create the OpenSearch node configuration file:
$ nano opensearch.yml
7. Add the following configuration:
cluster.name: opensearch-cluster
network.host: 0.0.0.0
# TLS between nodes
plugins.security.ssl.transport.pemcert_filepath: node.pem
plugins.security.ssl.transport.pemkey_filepath: node-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.transport.enforce_hostname_verification: false
# TLS on the REST API
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: node.pem
plugins.security.ssl.http.pemkey_filepath: node-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
# Certificate identities
plugins.security.authcz.admin_dn:
- 'CN=admin,O=EXAMPLE'
plugins.security.nodes_dn:
- 'CN=opensearch-node1,O=EXAMPLE'
- 'CN=opensearch-node2,O=EXAMPLE'
- 'CN=opensearch-node3,O=EXAMPLE'
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]
# S3-compatible snapshot repository client
s3.client.default.endpoint: OBJECT_STORAGE_HOSTNAME
s3.client.default.region: us-east-1
Replace OBJECT_STORAGE_HOSTNAME with the hostname of your S3-compatible object storage. Save and close the file.
-
node.pemandnode-key.pem: Generic file names that Docker Compose maps to each node's own certificate, so all three nodes share this file. -
plugins.security.ssl.transport.enforce_hostname_verification: Turns off hostname checks between nodes, because containers reach each other by IP address. Nodes still have to present a certificate signed by your certificate authority with a DN listed inplugins.security.nodes_dn. -
plugins.security.restapi.roles_enabled: Lets users mapped to theall_accessorsecurity_rest_api_accessrole manage users, roles, and role mappings through the Security REST API. -
s3.client.default.region: Required by therepository-s3plugin. For storage outside AWS, the value has no effect.
8. Generate a password hash for the admin user:
$ docker run --rm opensearchproject/opensearch:3.10.0 /usr/share/opensearch/plugins/opensearch-security/tools/hash.sh -p 'ADMIN_PASSWORD'
Replace ADMIN_PASSWORD with a strong password for the cluster administrator. The last line of the output is the bcrypt hash of the password. Copy it.
9. Generate a password hash for the kibanaserver user, using the same password you set as DASHBOARDS_SERVER_PASSWORD in the .env file:
$ docker run --rm opensearchproject/opensearch:3.10.0 /usr/share/opensearch/plugins/opensearch-security/tools/hash.sh -p 'DASHBOARDS_SERVER_PASSWORD'
10. Create the internal users file:
$ nano internal_users.yml
11. Add the following configuration:
_meta:
type: "internalusers"
config_version: 2
admin:
hash: "ADMIN_PASSWORD_HASH"
reserved: true
backend_roles:
- "admin"
description: "Cluster administrator"
kibanaserver:
hash: "DASHBOARDS_SERVER_PASSWORD_HASH"
reserved: true
description: "OpenSearch Dashboards server user"
Replace:
-
ADMIN_PASSWORD_HASHwith the hash generated for theadminuser. -
DASHBOARDS_SERVER_PASSWORD_HASHwith the hash generated for thekibanaserveruser.
Save and close the file. The file defines only these two users, which removes the demo users that ship with the image. The default role mappings grant all_access to the admin backend role and the kibana_server role to the kibanaserver user.
Build the OpenSearch Image with the S3 Repository Plugin
Snapshots to S3-compatible storage require the S3 repository plugin, which the stock OpenSearch image does not include. A short Dockerfile adds the plugin, and a separate keystore file holds the object storage credentials so they never become part of an image layer.
1. Create the Dockerfile:
$ nano Dockerfile
2. Add the following content:
ARG OPENSEARCH_VERSION
FROM opensearchproject/opensearch:${OPENSEARCH_VERSION}
RUN /usr/share/opensearch/bin/opensearch-plugin install --batch repository-s3
Save and close the file.
3. Build the image:
$ docker build --build-arg OPENSEARCH_VERSION=3.10.0 -t opensearch-s3:3.10.0 .
The build output ends with a line that names the image opensearch-s3:3.10.0. The version in this command, in the hash.sh and keystore commands, and in OPENSEARCH_VERSION in the .env file must match, because Docker Compose runs opensearch-s3:${OPENSEARCH_VERSION} and the Dashboards image uses the same variable.
4. Give ownership of the keystore directory to the user ID that OpenSearch runs as:
$ sudo chown 1000:1000 keystore
5. Create the keystore and add the object storage credentials. The command prompts for each value without echoing it:
$ docker run --rm -it -v "$HOME/opensearch/keystore:/keystore" opensearch-s3:3.10.0 bash -c \
"/usr/share/opensearch/bin/opensearch-keystore create && \
/usr/share/opensearch/bin/opensearch-keystore add s3.client.default.access_key && \
/usr/share/opensearch/bin/opensearch-keystore add s3.client.default.secret_key && \
cp /usr/share/opensearch/config/opensearch.keystore /keystore/"
Enter your object storage access key and secret key when prompted.
6. Verify that the keystore file exists:
$ sudo ls -l keystore/opensearch.keystore
The output lists the opensearch.keystore file owned by user ID 1000.
Deploy OpenSearch with Docker Compose
This stack uses Docker Compose to run a three-node OpenSearch cluster alongside OpenSearch Dashboards. Traefik acts as a reverse proxy that provides HTTPS access to Dashboards, and persistent volumes retain data across container restarts. Three cluster-manager-eligible nodes keep a quorum to elect a cluster manager if one node process stops. All three nodes run on one server, so this layout does not survive the loss of the server itself. For production high availability, run each node on a separate server connected through a private network.
Docker publishes container ports with its own firewall rules, which bypass Uncomplicated Firewall (UFW). The Compose file therefore binds the OpenSearch REST API to the loopback interface and publishes only the Traefik ports to the internet.
1. Create a DNS A record for your Dashboards domain, such as dashboards.example.com, that points to the public IP address of the server.
2. Allow inbound HTTP traffic through the firewall. Traefik uses this port to redirect visitors to HTTPS:
$ sudo ufw allow 80/tcp
3. Allow inbound HTTPS traffic through the firewall. Traefik serves Dashboards and completes the Let's Encrypt challenge on this port:
$ sudo ufw allow 443/tcp
4. Verify that UFW applied the firewall rules:
$ sudo ufw status
The output lists ports 80/tcp and 443/tcp with the ALLOW action.
5. Create the Docker Compose file:
$ nano docker-compose.yml
6. Add the following configuration:
services:
traefik:
image: "traefik:v3.7.19"
container_name: "traefik"
restart: unless-stopped
command:
- "--log.level=INFO"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
- "--certificatesresolvers.myresolver.acme.email=${LETSENCRYPT_EMAIL}"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- opensearch-net
opensearch-node1:
image: opensearch-s3:${OPENSEARCH_VERSION}
container_name: opensearch-node1
restart: unless-stopped
environment:
- node.name=opensearch-node1
- discovery.seed_hosts=opensearch-node1,opensearch-node2,opensearch-node3
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2,opensearch-node3
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- DISABLE_INSTALL_DEMO_CONFIG=true
- AWS_EC2_METADATA_DISABLED=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data1:/usr/share/opensearch/data
- ./opensearch.yml:/usr/share/opensearch/config/opensearch.yml:ro
- ./internal_users.yml:/usr/share/opensearch/config/opensearch-security/internal_users.yml:ro
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem:ro
- ./certs/opensearch-node1.pem:/usr/share/opensearch/config/node.pem:ro
- ./certs/opensearch-node1-key.pem:/usr/share/opensearch/config/node-key.pem:ro
- ./certs/admin.pem:/usr/share/opensearch/config/admin.pem:ro
- ./certs/admin-key.pem:/usr/share/opensearch/config/admin-key.pem:ro
- ./keystore/opensearch.keystore:/usr/share/opensearch/config/opensearch.keystore
ports:
- "127.0.0.1:9200:9200"
networks:
- opensearch-net
opensearch-node2:
image: opensearch-s3:${OPENSEARCH_VERSION}
container_name: opensearch-node2
restart: unless-stopped
environment:
- node.name=opensearch-node2
- discovery.seed_hosts=opensearch-node1,opensearch-node2,opensearch-node3
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2,opensearch-node3
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- DISABLE_INSTALL_DEMO_CONFIG=true
- AWS_EC2_METADATA_DISABLED=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data2:/usr/share/opensearch/data
- ./opensearch.yml:/usr/share/opensearch/config/opensearch.yml:ro
- ./internal_users.yml:/usr/share/opensearch/config/opensearch-security/internal_users.yml:ro
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem:ro
- ./certs/opensearch-node2.pem:/usr/share/opensearch/config/node.pem:ro
- ./certs/opensearch-node2-key.pem:/usr/share/opensearch/config/node-key.pem:ro
- ./keystore/opensearch.keystore:/usr/share/opensearch/config/opensearch.keystore
networks:
- opensearch-net
opensearch-node3:
image: opensearch-s3:${OPENSEARCH_VERSION}
container_name: opensearch-node3
restart: unless-stopped
environment:
- node.name=opensearch-node3
- discovery.seed_hosts=opensearch-node1,opensearch-node2,opensearch-node3
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2,opensearch-node3
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- DISABLE_INSTALL_DEMO_CONFIG=true
- AWS_EC2_METADATA_DISABLED=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data3:/usr/share/opensearch/data
- ./opensearch.yml:/usr/share/opensearch/config/opensearch.yml:ro
- ./internal_users.yml:/usr/share/opensearch/config/opensearch-security/internal_users.yml:ro
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem:ro
- ./certs/opensearch-node3.pem:/usr/share/opensearch/config/node.pem:ro
- ./certs/opensearch-node3-key.pem:/usr/share/opensearch/config/node-key.pem:ro
- ./keystore/opensearch.keystore:/usr/share/opensearch/config/opensearch.keystore
networks:
- opensearch-net
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:${OPENSEARCH_VERSION}
container_name: opensearch-dashboards
restart: unless-stopped
environment:
- 'OPENSEARCH_HOSTS=["https://opensearch-node1:9200","https://opensearch-node2:9200","https://opensearch-node3:9200"]'
- OPENSEARCH_USERNAME=kibanaserver
- OPENSEARCH_PASSWORD=${DASHBOARDS_SERVER_PASSWORD}
- OPENSEARCH_SSL_VERIFICATIONMODE=full
- OPENSEARCH_SSL_CERTIFICATEAUTHORITIES=/usr/share/opensearch-dashboards/config/root-ca.pem
volumes:
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/root-ca.pem:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboards.rule=Host(`${DASHBOARDS_DOMAIN}`)"
- "traefik.http.routers.dashboards.entrypoints=websecure"
- "traefik.http.routers.dashboards.tls.certresolver=myresolver"
- "traefik.http.services.dashboards.loadbalancer.server.port=5601"
depends_on:
- opensearch-node1
- opensearch-node2
- opensearch-node3
networks:
- opensearch-net
volumes:
opensearch-data1:
opensearch-data2:
opensearch-data3:
networks:
opensearch-net:
Save and close the file.
-
discovery.seed_hostsandcluster.initial_cluster_manager_nodes: List all three nodes so the cluster can form on first boot and elect a cluster manager by majority. -
bootstrap.memory_lock=true: Combined with thememlockulimit, prevents the Java heap from swapping to disk. -
OPENSEARCH_JAVA_OPTS: Sets a fixed 1 GB heap per node, sized for three nodes and Dashboards on an 8 GB server. Aim for about half the memory available to each node, and keep the heap at or below 32 GB. When you move each node to its own server, raise-Xmsand-Xmxtogether. -
DISABLE_INSTALL_DEMO_CONFIG=true: Stops the image from installing the demo certificates and users. -
AWS_EC2_METADATA_DISABLED=true: Stops therepository-s3plugin from querying the AWS instance metadata service, which does not exist outside AWS. -
127.0.0.1:9200:9200: Publishes the REST API ofopensearch-node1on the loopback interface only, so other hosts cannot reach it. -
admin.pemandadmin-key.pem: Mounted onopensearch-node1only, because that is where you run the security administration tool. -
OPENSEARCH_SSL_VERIFICATIONMODE=full: Makes Dashboards verify each node's certificate and hostname against your certificate authority.
7. Start the stack in detached mode:
$ docker compose up -d
8. Verify that the containers are running:
$ docker compose ps -a
The output displays running containers for traefik, opensearch-node1, opensearch-node2, opensearch-node3, and opensearch-dashboards.
Initialize the Security Plugin
With the demo configuration disabled, the Security plugin starts uninitialized, without users or roles, and rejects every request until you load the configuration files into the cluster. The securityadmin.sh tool loads the files and authenticates with the administrator certificate. Run it again whenever you change a file in the security configuration directory.
1. Load the security configuration into the cluster:
$ docker compose exec opensearch-node1 /usr/share/opensearch/plugins/opensearch-security/tools/securityadmin.sh \
-cd /usr/share/opensearch/config/opensearch-security/ \
-icl -nhnv \
-cacert /usr/share/opensearch/config/root-ca.pem \
-cert /usr/share/opensearch/config/admin.pem \
-key /usr/share/opensearch/config/admin-key.pem
-
-cd: The directory that holdsinternal_users.yml,roles.yml,roles_mapping.yml, and the other security configuration files. -
-icl: Ignores the cluster name check. -
-nhnv: Skips hostname verification for the connection tolocalhost. -
-cacert,-cert, and-key: The certificate authority, the administrator certificate, and its private key.
The output ends with Done with success.
2. Verify that the admin user can authenticate:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' https://localhost:9200/_plugins/_security/authinfo?pretty
Replace ADMIN_PASSWORD with the password you hashed for the admin user. The output returns JSON with "user_name" : "admin" and all_access in the roles list.
Verify the Deployment
The following checks confirm that the three-node cluster is healthy, accepts documents, returns indexed data, and that the REST API is not reachable from other hosts. In this and the following commands, replace ADMIN_PASSWORD with the password of the admin user.
1. Verify cluster health:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' "https://localhost:9200/_cluster/health?pretty"
The output returns JSON with "status" : "green" and "number_of_nodes" : 3.
2. Index a test document:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' -X POST "https://localhost:9200/test-index/_doc" \
-H "Content-Type: application/json" \
-d '{"message": "hello opensearch"}'
The output returns JSON with "_index":"test-index", "result":"created", and "_shards":{"total":2,"successful":2,"failed":0}.
3. Query the document back:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' "https://localhost:9200/test-index/_search?pretty"
The output returns your document in the hits array, with _source showing "message" : "hello opensearch".
4. From your workstation or another machine, confirm that the REST API port is closed to the internet:
$ nc -zv SERVER_IP 9200
Replace SERVER_IP with the public IP address of the server. The output reports that the connection was refused or timed out.
5. Open Dashboards:
Open a web browser, navigate to your Dashboards domain such as https://dashboards.example.com, and sign in with the username admin and the password you set for the admin user.
Schedule Snapshots to Object Storage
Amazon OpenSearch Service takes automated snapshots for you. On a self-hosted cluster, you register a snapshot repository and create a Snapshot Management policy that takes and prunes snapshots on a schedule. The repository uses the S3 repository plugin and the keystore credentials to write to your bucket.
1. Register the snapshot repository:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' -X PUT "https://localhost:9200/_snapshot/object_storage_repo" \
-H "Content-Type: application/json" \
-d '{
"type": "s3",
"settings": {
"bucket": "BUCKET_NAME",
"base_path": "opensearch/snapshots"
}
}'
Replace BUCKET_NAME with the name of your bucket. OpenSearch verifies that every node can write to the bucket during registration. The output returns {"acknowledged":true}.
2. Create a Snapshot Management policy that takes a snapshot every day and keeps up to 30 days of snapshots:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' -X POST "https://localhost:9200/_plugins/_sm/policies/daily_snapshots" \
-H "Content-Type: application/json" \
-d '{
"description": "Daily snapshot of all indices",
"creation": {
"schedule": { "cron": { "expression": "0 2 * * *", "timezone": "UTC" } },
"time_limit": "1h"
},
"deletion": {
"schedule": { "cron": { "expression": "0 3 * * *", "timezone": "UTC" } },
"condition": { "max_age": "30d", "max_count": 30, "min_count": 7 },
"time_limit": "1h"
},
"snapshot_config": {
"indices": "*,-.opendistro_security",
"repository": "object_storage_repo",
"ignore_unavailable": "true",
"include_global_state": "false",
"partial": "true"
}
}'
-
creation.schedule: Takes a snapshot at 02:00 UTC every day. -
deletion.condition: Deletes snapshots older than 30 days or beyond the 30 most recent, while always keeping at least 7. -
indices: Includes all indices except the Security plugin index. Its configuration comes from the security files in the project directory, so keep a copy of those files with your backups.
The output returns JSON with "_id":"daily_snapshots-sm-policy".
3. Check the policy status:
$ curl --cacert certs/root-ca.pem -u 'admin:ADMIN_PASSWORD' "https://localhost:9200/_plugins/_sm/policies/daily_snapshots/_explain?pretty"
The output shows the policy as enabled, with the next creation time in the creation section. After the first scheduled run, list the stored snapshots with GET _snapshot/object_storage_repo/_all to confirm that a snapshot reached the bucket.
Migrate from Amazon OpenSearch Service
Migrating is a data and access-control migration rather than an application rewrite, because both sides speak the same REST API.
Choose a migration path:
-
Snapshot and restore: Automated snapshots on Amazon OpenSearch Service are for recovery only. Register a manual snapshot repository in an S3 bucket in your AWS account (this requires an IAM role the service can assume and a SigV4-signed registration request), take a manual snapshot, copy the files to your own bucket with a tool such as rclone, register that location on the self-hosted cluster as a repository with
"readonly": true, and restore it. Indices must have been created by OpenSearch 2.x or later to restore on 3.x. Exclude.opendistro_securityand.kibana*from the restore and setinclude_global_statetofalseso the new cluster's users, roles, and saved objects are not overwritten. -
Reindex from remote: Have the destination cluster pull documents with
POST /_reindexusingsource.remote.hostpointed at the Amazon OpenSearch Service endpoint. Add the source host and port toreindex.remote.allowlistinopensearch.ymland restart the nodes. The source domain needs fine-grained access control with an internal user, and the self-hosted server must be able to reach the domain endpoint. - OpenSearch Migration Assistant: Runs on a Kubernetes cluster you provide and backfills documents from a snapshot. It does not migrate ISM policies or the security configuration, so recreate those separately.
Migrate indices, data, and applications:
- Copy index templates, mappings, and settings unchanged, but confirm shard and replica counts suit the node count of the new cluster.
- Recreate ISM and Snapshot Management policies on the new cluster, because none of the migration paths copies them reliably.
- Compare document counts per index between source and destination with
GET /INDEX_NAME/_countafter the transfer completes. - Change the application's endpoint to your self-hosted cluster, replace AWS SigV4 request signing with basic auth, mutual TLS, or SSO, and configure clients to trust
root-ca.peminstead of turning off certificate verification. For remote applications, bind port9200to the server's private network address instead of127.0.0.1, and do not expose it on the public interface.
Things to take care with:
- Storage tiers: UltraWarm and cold indices become regular hot indices. Use ISM to delete aged data and keep long-term copies in object storage snapshots.
- Disk sizing: Size the disk for primary data multiplied by one plus the replica count, plus headroom for merges. By default, OpenSearch stops allocating new shards to a node at 85% disk use and blocks writes at 95%.
- Availability: Recreate Multi-AZ-style availability by placing nodes on separate servers and setting replica counts accordingly.
- Operations: Snapshots and version upgrades become your responsibility. Test a restore and each upgrade before applying it.
- Access control: Fine-grained access control uses the same Security plugin, but anything tied to IAM must be rebuilt as internal users, certificates, or SSO group mappings.
- Cutover: Keep the source domain serving traffic, validate document counts and query results on the new cluster, then redirect traffic and decommission the old domain.
Next Steps
Your secured three-node cluster is running with Dashboards over HTTPS and daily snapshots to object storage. From here you can:
- Move each node onto its own server over a private network for real high availability
- Create least-privilege roles and users for applications, or integrate SAML or OpenID Connect single sign-on
- Add ISM retention policies and Alerting monitors for lifecycle and cluster health
- Test a snapshot restore into a scratch cluster to validate your backup process
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)