Deploy a MeiliSearch Instance on AWS
Using our MeiliSearch AMI (opens new window), MeiliSearch can be deployed on AWS in just a few minutes.
The following how-to guide
will walk you through every step to deploy MeiliSearch in an AWS EC2 instance. If you have any issues with our AWS image, please create an issue in this repository (opens new window).
Table of Contents:
Part 1: Deploy an out-of-the-box MeiliSearch instance
1. Launch an instance from the AWS console
After logging into your AWS Console (opens new window), navigate to the Compute service. Then go to EC2, and finally open your Instances console.
In the top-right corner, click on the Launch instances button to start the process of configuring your MeiliSearch instance.
2. Select ‘MeiliSearch’ AMI from ‘Community AMIs’
You will now select which AMI or system Image to use to run your instance. Type “meilisearch” in the searchbar and select the Community AMIs tab on the left sidebar.
Click on Select (right side of the screen) to confirm your choice.
3. Size and specs
Select the specifications of the server you want MeiliSearch to run on.
We recommend prioritizing memory allocation for better MeiliSearch performance.
Note that the free tier is sufficient for tests or prototypes, but not recommended for large datasets.
Once you’ve made your choice, click on Next: Configure instance details to continue.
4. Instance details
Here you can specify details of your Instance (opens new window). Since this section is not required to run MeiliSearch, we won’t cover it in this guide.
Simply click on Next: Add Storage to keep going.
5. Storage
Choose the storage device and size for your MeiliSearch instance.
The amount of storage space required can vary drastically depending on the data you plan to index. In this example, we will use 25 GiB, which is more than enough for most small datasets (< 1 million documents).
When you’re ready, click on Next: Add Tags to continue.
6. Tags
Tags are used to identify your resources in AWS. They are not required by MeiliSearch.
Click on Next: Configure Security Groups.
7. Security Groups: Networking and connectivity
For your MeiliSearch instance to communicate with the outside world, it is very important to allow SSH connections, HTTP, and HTTPS traffic.
- Click on Add rule and select HTTP from the drop-down menu. This will open the HTTP port (80).
- Click on Add rule and select HTTPS from the drop-down menu. This will open the HTTPS port (443).
By default, opened ports accept inbound traffic from any origin. If you prefer to restrict the IP adresses that are allowed to request your MeiliSearch instance, go to the Source column and select the Custom option.
You can also use an existing security group, if preferred.
Once your configuration looks similar to the above image, click on Review and Launch.
8. Set and Download Key Pair
Once you have reviewed your instance configuration, there is one last step before you can launch your Instance.
Click on Launch and a pop-up window will ask you to select a key pair. This key pair is very important as it will be your private key to access the instance via SSH, which is required to configure your MeiliSearch instance in a production environment.
If you have an existing Key Pair, you can use that. Otherwise, select the option Create a new key pair and give it a name. Then, click on Download Key Pair and store this file somewhere safe.
Once you’ve downloaded your key pair (and only then), click on Launch Instances, then on View Instances.
9. Enjoy your MeiliSearch instance running on AWS!
Your instance may take a minute or two to get up and running (see the Instance state column).
Once the instance is ready, use your web browser to navigate to the Public IPv4 address or the Public IPv4 DNS. You should see the MeiliSearch web interface.
Your MeiliSearch instance is now ready to use!
Keep in mind that your MeiliSearch instance is currently running in a development environment, which is unsafe for production usage. If you want to set up a production environment, continue to the next section.
Otherwise, if you want to get started creating indexes and adding documents, don’t hesitate to check out our learning resources, API Reference, or getting started guide.
And of course, enjoy!
Part 2: Configure production settings
Configuring your MeiliSearch instance in a production environment is not just straightforward—it’s completely automated. Simply establish an SSH connection with your instance, and a script will guide you through the process.
1. Make your domain name point to your Instance IP
If you want to use your own domain name (or sub-domain), add an A record
in your domain name provider account. Otherwise, you can skip this step.
Your domain name should now be linked to your MeiliSearch instance. Run a health check to verify that your instance is running and your DNS is well configured:
curl -v http://<your-domain-name>/health
The server should answer with a 204 No content
status code as shown in the example below:
...
< HTTP/1.1 204 No Content
...
2. Set API KEY and SSL (HTTPS)
Meilisearch is currently running in a development environment. You haven’t set up an API key, meaning that anyone can read/write from your MeiliSearch, and you aren’t using HTTPS yet, which makes this configuration unsafe for production.
To start the configuration process, connect via SSH to your new MeiliSearch Instance and follow the instructions that appear.
2.1. Secure your Key Pair
Open a terminal window and navigate to wherever you saved your key pair. It should be a .pem
file.
Run the following command to secure your key pair.
chmod 400 <YourMeiliSearchKeyPair>.pem
2.2. Run the configuration script
Next, start a new SSH connection with the Public IPv4 address or your domain name, using ‘admin’ as the username. You’ll also need to supply the relative path to your .pem
file.
ssh -i <relative-path-to-your-key-pair> admin@<your-ipv4-address>
ssh -i <relative-path-to-your-pem-file> admin@<your-domain-name>
You should see something like this:
________________________________________________
________________________________________________
_ _ _ __ _
/\/\ ___(_) (_) _\ ___ __ _ _ __ ___| |__
/ \ / _ \ | | \ \ / _ \/ _` | '__/ __| '_ \
/ /\/\ \ __/ | | |\ \ __/ (_| | | | (__| | | |
\/ \/\___|_|_|_\__/\___|\__,_|_| \___|_| |_|
________________________________________________
________________________________________________
When asked if you would like to use MeiliSearch in a production environment, write yes
and press Enter
to accept the authentication process.
A script will run automatically, asking for your settings and desired configuration. If you want to run this script again at any time, you can do so by using the following command:
meilisearch-setup
3. Enjoy your ready-to-use MeiliSearch instance
Your MeiliSearch Instance is up and running on AWS, and it is ready to be used in production.
To check if everything is running smoothly, do another HTTP call to the /health
route:
curl -v https://<your-domain-name>/health
Note that this time, we’re using HTTPS.
The server should answer with a 204 No content
status code as shown in the example below:
...
< HTTP/1.1 204 No Content
...
You’re all set to use MeiliSearch in production with AWS! If you have any issues with our AWS image, please create an issue in this repository (opens new window).