← All articles
AI Platforms12 min read

Running RAG on Amazon EKS: A Production Checklist

Vector search, chunking, GPU serving, and observability—what usually breaks first when RAG leaves the demo environment.

Retrieval-augmented generation looks simple in a notebook: split some documents, embed them, store vectors, retrieve the closest chunks, and pass them to a language model. Production is where the hard parts appear—ingestion that keeps up with changing content, retrieval that respects who is allowed to see what, latency and cost that hold under load, and answers you can measure and improve. This checklist covers running RAG on Amazon EKS, with the architecture and code we use.

RAG on EKS: S3 documents trigger SQS, KEDA-scaled ingest workers embed chunks with Bedrock into Aurora PostgreSQL with pgvector; the RAG API behind an ALB retrieves by tenant and calls Bedrock or vLLM on GPU nodes.
Keep ingestion asynchronous and the query path lean; both share the same vector store and observability.

What usually breaks first

  • Stale answers because ingestion is a one-off script rather than a pipeline that tracks document changes and deletions.
  • Data leaks between customers or departments because retrieval ignores permissions.
  • Poor answers caused by bad chunking, not by the model.
  • Latency spikes when every request calls a large model with an oversized context.
  • Runaway cost from embedding the same content repeatedly or sending far more tokens than needed.
  • No way to tell whether a prompt or model change made answers better or worse.

1. Treat ingestion as an event-driven pipeline

Documents change, get deleted, and have permissions that change too. Put source documents in S3, send object events to SQS, and run ingestion workers on EKS that chunk, embed, and upsert. Store a content hash per chunk so unchanged content is never re-embedded, and handle deletions explicitly—a deleted document that is still retrievable is both a correctness and a compliance problem.

Ingestion load is bursty: quiet for hours, then thousands of documents at once. KEDA scales the workers from zero based on queue depth, and Karpenter adds nodes only while the backlog exists.

ingest-worker-scaling.yamlyaml
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: keda-aws
  namespace: rag
spec:
  podIdentity:
    provider: aws # uses the KEDA operator's EKS Pod Identity role
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: ingest-worker
  namespace: rag
spec:
  scaleTargetRef:
    name: ingest-worker
  minReplicaCount: 0
  maxReplicaCount: 20
  triggers:
    - type: aws-sqs-queue
      authenticationRef:
        name: keda-aws
      metadata:
        queueURL: https://sqs.ap-south-1.amazonaws.com/111122223333/rag-ingest
        queueLength: "50"
        awsRegion: ap-south-1

2. Chunk for retrieval, not for convenience

Chunking has more effect on answer quality than most model choices. Split on document structure—headings, sections, paragraphs—rather than fixed character counts, keep chunks small enough to be specific but large enough to carry context, and add a modest overlap so sentences are not cut in half. Store metadata with every chunk: source document, section title, URL, last-modified date, and the access-control attributes you will filter on. That metadata is what makes citations and permission filtering possible.

How does your cloud measure up?

Score your setup across foundation, delivery, reliability, security, and cost in 3 minutes—instant results, no email needed.

Take the free scorecard

3. Choose a vector store you can operate

For many teams the right vector database is the PostgreSQL they already run. The pgvector extension on Amazon Aurora PostgreSQL or RDS gives approximate nearest-neighbour search with HNSW indexes, transactions, backups, and SQL filtering in one familiar system. Amazon OpenSearch Service is a strong alternative when you also need keyword and hybrid search at large scale. Dedicated vector databases make sense at very high volumes or for specialised features, at the cost of another system to secure and run.

pgvector schema with tenant isolationsql
CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE chunks (
  id           bigserial PRIMARY KEY,
  tenant_id    text        NOT NULL,
  document_id  text        NOT NULL,
  section      text,
  content      text        NOT NULL,
  content_hash text        NOT NULL,
  updated_at   timestamptz NOT NULL DEFAULT now(),
  embedding    vector(1024) NOT NULL -- match your embedding model's dimensions
);

CREATE INDEX chunks_embedding_hnsw
  ON chunks USING hnsw (embedding vector_cosine_ops);

CREATE INDEX chunks_tenant ON chunks (tenant_id);

-- Retrieval: always filter by tenant before ranking by similarity
SELECT id, document_id, section, content
FROM chunks
WHERE tenant_id = $1
ORDER BY embedding <=> $2
LIMIT 6;

4. Enforce permissions at retrieval time

A language model will happily summarise anything you put in its context, so access control must happen before retrieval results reach the prompt. Derive the tenant and the user's groups from the authenticated request—never from the prompt—and filter in the database query. For stricter isolation, PostgreSQL row-level security enforces the tenant filter even if application code forgets it.

Row-level security as a safety netsql
ALTER TABLE chunks ENABLE ROW LEVEL SECURITY;

CREATE POLICY tenant_isolation ON chunks
  USING (tenant_id = current_setting('app.tenant_id'));

-- The API sets the tenant per transaction from the verified token:
-- SET LOCAL app.tenant_id = 'acme';

5. Pick the model-serving path deliberately

There are two main options on AWS. Amazon Bedrock provides managed foundation and embedding models billed per token, with no GPUs to run; the RAG API calls it with an IAM role granted through EKS Pod Identity. Self-hosting an open-weight model with a serving engine such as vLLM on EKS GPU nodes gives more control over models, data locality, and cost at steady high volume, in exchange for operating GPU capacity. Many teams start on Bedrock and move specific high-volume paths to self-hosted models once usage patterns are clear.

Least-privilege Bedrock policy for the RAG API rolejson
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
      "Resource": [
        "arn:aws:bedrock:ap-south-1::foundation-model/<chat-model-id>",
        "arn:aws:bedrock:ap-south-1::foundation-model/<embedding-model-id>"
      ]
    }
  ]
}

6. Keep latency and cost under control

  • Retrieve fewer, better chunks: a reranking step often lets you send three highly relevant chunks instead of ten mediocre ones.
  • Cap context and output tokens per request, and log token counts so cost per request is visible.
  • Cache embeddings for repeated queries and cache full answers for frequently asked, non-personalised questions.
  • Stream responses to users so perceived latency drops even when generation takes a few seconds.
  • Set per-tenant rate limits and budgets so one customer or script cannot exhaust shared capacity.
  • Scale the API on requests in flight or latency, not CPU.

7. Add guardrails

Production RAG needs defences against prompt injection hidden in retrieved documents, leakage of sensitive data, and confident answers with no supporting evidence. Treat retrieved text as untrusted input, instruct the model to answer only from provided context and cite sources, redact or block sensitive data on the way in and out, and return “I don't know” when retrieval finds nothing relevant. Managed options such as Amazon Bedrock Guardrails can handle content filtering and sensitive-information detection.

8. Evaluate before every change

Without evaluation, every prompt tweak, chunking change, or model upgrade is a guess. Build a test set of real questions with expected sources and answers, and run it automatically in CI before promoting changes. Track retrieval quality—did the right chunks come back—separately from generation quality—was the answer faithful and complete—because they fail for different reasons. In production, trace every request with the retrieved chunk IDs, token counts, latency, and user feedback, so problems can be traced to retrieval or generation.

9. Run it like any other production service on EKS

  • Each component—API, ingest workers, model servers—in its own namespace with its own Pod Identity role.
  • PodDisruptionBudgets and multiple replicas across zones for the API and any self-hosted model servers.
  • Secrets from AWS Secrets Manager via the External Secrets Operator; database credentials rotated.
  • Network policies so only the API can reach the vector store and model endpoints.
  • OpenTelemetry traces across API, retrieval, and model calls; dashboards for latency, error rate, tokens, and cost per tenant.

Production RAG checklist

  1. Event-driven ingestion with content hashing, updates, and deletions handled.
  2. Structure-aware chunking with source, section, and access metadata on every chunk.
  3. A vector store your team can back up, secure, and operate—often pgvector on Aurora.
  4. Permission filtering at retrieval time, with row-level security as a safety net.
  5. A deliberate model-serving choice: Bedrock, self-hosted on GPUs, or both.
  6. Token caps, caching, reranking, streaming, and per-tenant limits.
  7. Guardrails against prompt injection and sensitive-data leakage, with cited answers.
  8. An evaluation set run in CI, and production traces tied to retrieval and generation.

Most RAG problems in production are platform and data problems rather than model problems. Get ingestion, permissions, evaluation, and observability right, and model upgrades become routine. If you are taking a RAG prototype to production on AWS, this is the foundation we build with teams on EKS.

Key takeaways

  • Treat retrieval indexes as versioned production data with rollback.
  • Separate embedding jobs, API serving, and vector stores for blast-radius control.
  • Measure groundedness and latency together—accuracy without SLOs is incomplete.

FAQ

Should the vector DB run inside the cluster?

It can, but managed stores often win on backups and ops. If in-cluster, define storage, restore drills, and resource isolation explicitly.

What breaks first in production RAG?

Stale indexes, embedding model drift, secret sprawl for model APIs, and unbounded context that blows latency and cost.

Need help putting this into practice?

Our engineers do this every week. Get a fixed-scope plan for platform engineering services—free scoping call, written price before you commit.

Get a free scoping call