All Collections
Configuration
Create EC2 and Setup Elasticsearch
Create EC2 and Setup Elasticsearch
Updated over a week ago

For reference, please click the following link to create an AWS account and configure User.

Step 1

Please click on Launch Instances to create an EC2 instance first.

Step 2

Enter the instance name and select Amazon Linux server.

Step 3

Please select the instance type of t3.xlarge from the drop-down menu.

Step 4

Click the Create new key pair text.

Step 5

Display the Create key pair popup, type the name of the key pair, and press the Create key pair button. Please leave all other settings alone.

Step 6

No other configuration is required, so please click the Launch instance button and create the instance.

Step 7

For confirmation that your instance was successfully created, please check the list of instances.

Step 8

The next step is to click the instance ID to open a new page that displays all of the instance information. Next, select the Security tab, and then click the name of the Security groups within the tab.

Step 9

Add some new rules, as per the below image, and click the Save rules button.

Step 10

To allocate an elastic IP and associate it with an AWS instance, do the following:

  • Click the Elastic IPs link in the EC2 Dashboard, and then click the Allocate Elastic IP address button.

  • Next, choose your region and click the Allocate button.

  • Follow the below image to set the elastic IP name, and then click the Associate this Elastic IP address button.

  • Choose your desired EC2 instance from the drop-down list of running instances and click Associate.

  • Please ensure that you check and verify the Elastic IPs that are set on your EC2 instance.

Step 11

Next, we connect the EC2 instance and set up Elasticsearch. Please refer to the image below and follow the instructions.

Step 12

That’s done. Let’s first install Java. Elasticsearch uses Java, so installing it is mandatory. In your terminal, run:

sudo yum install java-1.8.0 -y

Next, we install the latest Elasticsearch. In your terminal, run step by step all commands:

curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.11.4-darwin-x86_64.tar.gz

curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.11.4-darwin-x86_64.tar.gz.sha512 | shasum -a 512 -c -

sha512sum -c elasticsearch-8.11.4-linux-x86_64.tar.gz.sha512

tar -xzf elasticsearch-8.11.4-linux-x86_64.tar.gz

sudo systemctl daemon-reload

cd elasticsearch-8.11.4/

Step 13

Run Elasticsearch from the command line:

./bin/elasticsearch

Step 14

The elasticsearch.yml file needs to be configured. To navigate the.yml file and make changes, use the command below and make changes as per the attached images.

cd config
sudo vi elasticsearch.yml

Step 15

Run from the command line:

sudo sysctl -w vm.max_map_count=262144

Step 16

Return to the Elasticsearch path and launch Elasticsearch with the following command.

elasticsearch-8.11.4/ 
./bin/elasticsearch

Step 17

Please share the password for the Elastic user as per the attached image.

Step 18

It is correct to see the below image result, which shows that Elasticsearch is running. Click on the below URL, modify the IPV4 address (use your instance IPV4 address), and then enter your username and password.

Step 19

Please follow the image and use the command "ctr + c" to stop Elasticsearch. Then, run:

nohup ./bin/elasticsearch

to run it in the background. Elasticsearch will continue to run in the background even if you close the command prompt.

Step 20

First, create a new user with "superuser" role and ensure that you pass basic auth in the Auth tab by entering a username and password.

Step 21

Finally, share the Elastic IP address for your Elasticsearch and the superuser username and password.

Example:

Username: test1

Password: *******

Did this answer your question?