Simplify Search: Deploy Lucenia on AWS EKS

Wes Richardet

November 26, 2024

In this tutorial, I'll walk you through three easy steps to deploy Lucenia, our fast, enterprise-grade search engine, on Amazon EKS (Elastic Kubernetes Service). With the help of our Helm chart, you’ll have a fully functional Lucenia cluster up and running in no time.

Let’s get started!

🛠 Prerequisites

Before you begin, make sure you have the following:

  1. AWS CLI installed and configured.
  2. EKS CLI (https://eksctl.io/) for configuring your EKS Cluster
  3. kubectl for interacting with your Kubernetes cluster.
  4. Helm (version 3+) for deploying Lucenia using Helm charts.
  5. An AWS Account with IAM permissions is needed to create an EKS cluster.

Step 1: Setup Your AWS Environment

You can now deploy Lucenia on Amazon’s Elastic Kubernetes Service.

Deploy on Amazon EKS

Create an EKS Cluster using the following command:

$> export CLUSTER=<your_cluster_name>
$> eksctl create cluster --name $CLUSTER --region us-east-1 \
  --nodegroup-name standard-workers \
  --node-type t3.medium \
  --nodes 3 \
  --nodes-min 3 \
  --nodes-max 5 \
  --managed
$> eksctl utils associate-iam-oidc-provider --region us-east-1 --cluster $CLUSTER --approve

$> eksctl create addon --name aws-ebs-csi-driver --version v1.37.0-eksbuild.1 --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy --cluster $CLUSTER

Wait for the cluster to be ready (this may take a few minutes, so grab a ☕). Confirm it's active by doing the following:

$> aws eks update-kubeconfig --name $CLUSTER --region us-east-1
$> kubectl get nodes

Create your service account for the cluster to run Lucenia as

$> eksctl create iamserviceaccount \     
    --name $SERVICE_ACCOUNT_NAME \
    --namespace $NS \
    --cluster $CLUSTER \
    --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
    --approve \
    --override-existing-serviceaccounts

Step 2: Subscribe to Lucenia on AWS Marketplace

Lucenia currently has two offerings on the AWS Marketplace. (https://aws.amazon.com/marketplace/seller-profile?id=seller-sspyvaxwiq6ey

Our Lucenia base offering  (https://aws.amazon.com/marketplace/pp/prodview-tf6ttmwvhs4e4) allows you to bring your Lucenia license to your AWS Account and run Lucenia on EKS.

Our annual subscription (https://aws.amazon.com/marketplace/pp/prodview-7buto473lcvle) allows you to purchase Lucenia Resource Units. Lucenia Resource Units (LRU) each have 128Gb of allocated Heap Space. You can use your LRU among as many nodes as you would like. You can run three beefy nodes on one cluster or use Lucenia across several clusters and distribute that heap as you see fit. Once you subscribe, you will get the necessary agreement ID emailed to configure your cluster.

$> export HELM_EXPERIMENTAL_OCI=1
$> aws ecr get-login-password \
    --region us-east-1 | helm registry login \
    --username AWS \
    --password-stdin 709825985650.dkr.ecr.us-east-1.amazonaws.com

$> helm pull oci://709825985650.dkr.ecr.us-east-1.amazonaws.com/lucenia/lucenia-annual-chart --version=0.1.19
$> tar -xvf lucenia-annual-chart-0.1.19.tgz
$> export LUCENIA_INITIAL_ADMIN_PASSWORD=$(openssl rand -base64 32)
$> helm install lucenia \
  --namespace $NS ./lucenia-annual-chart \
  --set 'lucenia.extraEnvs[0].name=LUCENIA_INITIAL_ADMIN_PASSWORD' \
  --set 'lucenia.extraEnvs[0].value='${LUCENIA_INITIAL_ADMIN_PASSWORD} \
  --set 'lucenia.rbac.create=false' \
  --set 'lucenia.rbac.serviceAccountName='${SERVICE_ACCOUNT_NAME} \-f myvalues.yaml

Step 3: Connect To Your Cluster and Query Your Dataset

$> export POD_NAME=$(kubectl get pods --namespace $NS -l "app.kubernetes.io/name=lucenia,app.kubernetes.io/instance=lucenia" -o jsonpath="{.items[0].metadata.name}")
$> echo "Visit http://127.0.0.1:9200 to use your application"
$> kubectl --namespace $NS port-forward $POD_NAME 9200:9200

1. Insert a JSON Document using curl:

curl -X POST https://localhost:9200/my-index/_doc \
  -H "Content-Type: application/json" \
  -d '{"title": "Hello Lucenia","content": "Your enterprise search engine is ready!"}' \
 -ku admin:$LUCENIA_INITIAL_ADMIN_PASSWORD

2. Search Your Data:

curl -X GET "http://<your-ip>:9200/my-index/_search" \
  -H "Content-Type: application/json" \
   -ku admin:$LUCENIA_INITIAL_ADMIN_PASSWORD
  -d '{
    "query": {
      "match": {
        "title": "Lucenia"
      }
    }
  }'

You should see a response with the indexed document.

🎉 Wrapping Up

Congratulations! You have successfully deployed Lucenia on AWS using either EKS or EC2. You’ve also set up security features and indexed your first dataset. From here, you can explore additional features like time series optimizations, dynamic fields, and segment replication for a more powerful search experience.

For more advanced configurations, check out the Lucenia Documentation.

Happy searching with Lucenia! 🚀

EKS and all related logos are trademark Amazon Web Services.