What you need for installing OpenSearch on EC2
The new Terraform module will deploy by default 5 EC2 instances, 3 EBS, and 5 route-53 records. The EC2 instances will host 3 data nodes, 1 master node and 1 OpenSearch dashboard.
You can choose whether to deploy the cluster in one of your existing VPCs or create a new VPC to deploy the cluster in.
Note that in order for the module to succeed, you must have a route-53 resource that connects to your VPC. This is needed for the node discovery.
These are the variables you will need to set and update in order to deploy the cluster in the root folder on main.tf file:
cluster_name = "opensearch-cluster" key_name = <your .pem key for connection to the EC2’s> create_vpc = <true if you want to create a new vpc, false if you want to use your own> vpc_id = subnet_id = <your security group ID> route53_zone = <your route53 zone ID> route53_domain = <domain name (dom.com)> Path_to_data = <path to your Opensearch data disk>
If you want you can also change more variables as you wish in modules/opensearch/variables but we recommend keeping some of these variables at their default settings, including:
- Ami = Centos7, should be kept that way because the installation script adjusted to this OS.
- Instance_type = if you want to change it, please keep the ec2’s with at least 8 GB ram.
Here you can also change the architecture of your environment and add more nodes, just keep in mind that you will always need at least 1 data node, 1 master and 1 dashboard. If you choose to add more nodes, do not forget to add those hosts to the OpenSearch conf file on source/conf_setup (see more details on README.md file).
The variables we recommend changing are:
- Key_name
- Create_vpc
- Vpc_id
- Subnet_id
- Reoute53_zone
- Route53_domain
How to deploy your new OpenSearch cluster
After setting all the variables, run the following 3 commands in the root main.tf directory to deploy the cluster:
terraform init terraform plan terraform apply
Follow the execution output and wait a few minutes for the cluster to appear. This is the the message you’ll see confirming that the cluster has been created:
Apply complete! Resources: 10 added, 0 changed, 0 destroyed.
It will take more or less 10 minutes for the cluster to finish its initialization process & bootstrap checks and become available for use.
To check that the cluster is up, running, and available, you can run the following command and wait for a 200-ok response.
curl -XGET https://master-opensearch.domain.com:9200 -u 'admin:admin' --insecure
That’s it! Your cluster is up and running. In order to access OpenSearch Dashboards you can go in your browser to dashboard-opensearch.<yourdomain>.com:5601/ and connect with admin:admin.
If you have any questions, you can follow the Terraform module in the github repo – see here. Feel free to open a ticket or a Pull Request if you want to contribute, and stay tuned – the Opster team is working on some very cool and valuable OpenSearch additions, coming soon!
Additional notes
Elasticsearch and OpenSearch are both powerful search and analytics engines, but Elasticsearch has several key advantages. Elasticsearch boasts a more mature and feature-rich development history, translating to a better user experience, more features, and continuous optimizations. Our testing has consistently shown that Elasticsearch delivers faster performance while using fewer compute resources than OpenSearch. Additionally, Elasticsearch’s comprehensive documentation and active community forums provide invaluable resources for troubleshooting and further optimization. Elastic, the company behind Elasticsearch, offers dedicated support, ensuring enterprise-grade reliability and performance. These factors collectively make Elasticsearch a more versatile, efficient, and dependable choice for organizations requiring sophisticated search and analytics capabilities.