Deploy a Meilisearch instance on Amazon Web Services (AWS)

    Using our Meilisearch AMI, Meilisearch can be deployed on AWS in just a few minutes.

    The following 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.

    Refer to AWS's documentation to learn more about creating and configuring instances.

    Part 1: Deploy an out-of-the-box Meilisearch instance

    1. Launch an instance from the AWS console

    After logging into your AWS Console, navigate to the "Compute" service. Then go to "EC2", and finally open your "Instances" console.

    Page titled 'Instances'. Text in center of screen: You do not have any instances in this region

    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 search bar and select the "Community AMIs" tab on the left sidebar. Meilisearch's owner id is 567502172578.

    Page titled: 'Step 1: Choose an Amazon Machine Image (AMI)'

    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.

    Page titled: 'Step 2: Choose an Instance Type'. Selecting the free tier eligible instance type

    We recommend prioritizing memory allocation for better Meilisearch performance.

    TIP

    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. Since this section is not required to run Meilisearch, we won't cover it in this guide.

    Page titled 'Step 3: Configure Instance Details'. Important: You can launch multiple instances from the same AMI, request Spot instances to take advantage of lower pricing, and assign access management role to the instance.

    Click "Next: Add Storage" to keep going.

    5. Storage

    Choose the storage device and size for your Meilisearch instance.

    Page titled 'Step 4: Add Storage'. Text at bottom of screen: Free tier eligible users can get up to 30GB of EBS General Purpose (SSD) or Magnetic storage.

    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). We have the "Volume Type" set to "General Purpose SSD (gp2)".

    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.

    Page titled 'Step 5: Add Tags'. Text in center of screen: Make sure your IAM policy includes permissions to create tags.

    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.

    Page titled 'Step 6: Configure Security group'. Warning: Rules with sources of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only.

    By default, opened ports accept inbound traffic from any origin. If you prefer to restrict the IP addresses that are allowed to request your Meilisearch instance, go to the "Source" column and select the "Custom" option. The "Source" is set to "Anywhere" by default.

    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.

    A popup titled: "Select an existing key pair or create a new key pair". Inside the popup, there is a form that allows you to configure key pairs. It also contains a warning: "Download and store your private key file in a secure accessible location. You cannot download it again once it has been created"

    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).

    AWS dashboard showing an active instance

    Once the "Instance state" is "Running", use your web browser to navigate to the "Public IPv4 address" or the "Public IPv4 DNS" displayed in your AWS instances dashboard. You should see the Meilisearch search preview.

    Meilisearch search preview allowing users to search an example dataset

    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 getting started guide or API reference.

    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.

    An interface for editing DNS records with "Type": A, "Name": my-aws-instance, "IPv4 address": 35.180.61.104, and "TTL": Auto

    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 200 OK status code as shown in the example below:

    ...
    < HTTP/1.1 200 OK
    ...
    

    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 200 OK status code as shown in the example below:

    ...
    < HTTP/1.1 200 OK
    ...
    

    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.