Home / Articles

Tenant Isolation for RAG on Amazon S3 Vectors: Why the ARN Matters

Why a per-tenant index with its own ARN beats metadata filters for GDPR-grade RAG isolation, residency, erasure, audit and provenance on Amazon S3 Vectors.

Publisher: REACTAPP.TOP7 min read1602 words

This article is published in English.

Sources: Multi-Tenant RAG on Amazon S3 Vectors - Part 1: The Isolation Model

Picture a SaaS product aimed at public bodies in the EU. Each customer is a separate GDPR data controller, and the built-in assistant answers from that customer's own material: case files, internal guidance and the law that applies. Behind it sits a RAG system with hundreds of tenants, and there a wrong answer is no mere embarrassment. It is a breach that nobody notices.

Here is how it goes wrong. One shared vector index stores every tenant's chunks. A caseworker at tenant B asks what the eligibility thresholds are for a benefit covering reduced work capacity. Among the closest matches are chunks from an applicant's case notes at tenant A, since a similarity search treats that phrase as one topic no matter who wrote it. The model replies correctly and lists its sources, and source three is a citizen's medical history held by another organisation. The call returns HTTP 200 and every dashboard stays green.

None of this is a model problem. The model did what it was given. The real questions are what it is given and who enforces that.

Requirements

Start from the laws that protect the data and ask what each one demands of a retrieval system, now that the data lives as chunks in a vector index and no longer as rows in a table. Six requirements emerge, and each can be phrased as something testable and presentable to an auditor: isolation, residency, deletability, auditability, provenance and honest limits.

Two of them are often mixed up. Provenance looks backward from an answer and tells the user on screen where it came from. Auditability looks backward from the data and tells an auditor afterwards who has read it. Same system, opposite directions.

Why one tenant is easy and hundreds are not

With a single tenant, the first five requirements come almost for free. With hundreds of tenants in one index they hold only if application code is perfectly right, and each one breaks in its own way.

  • Isolation shrinks to a WHERE tenant_id = ? clause attached to each query. If it is missed, the wrong tenant is resolved, or a bug rewrites it, the search still happens.
  • Residency collapses to one region for everybody. A tenant whose contract names another region needs a second store sized and billed for a single customer, and in practice the contract gets a footnote.
  • Deletability turns into finding and deleting chunks tagged with a tenant and document. Erasure is only as good as the tags or the search, and approximate nearest-neighbour search can't prove something is absent.
  • Auditability falls back on the application log. The provider can record that the index was queried, but not whose chunks came back, since the tenant was a value inside the request and not a resource. Only the application's own log knows, and that is the log under suspicion.
  • Provenance depends on a tenant tag written at ingest. Many tenants will have a document called "Benefit guidance 2026", so a citation is true only with the tenant attached, and a wrong tag looks identical to a right one.

The remedy is what every vector store's documentation already advises: a partition, collection, index or schema per tenant. The remaining question is what kind of per-tenant boundary meets the list above, because not every kind does. Cost, the usual objection, comes up afterwards.

Three places to draw the line

A tenant boundary can live in three places, and they differ in who enforces them and how they fail.

A filter in application code

The index is shared, each vector carries tenant_id metadata and every query filters on it.

await client.send(new QueryVectorsCommand({
  indexArn: SHARED_INDEX,
  queryVector: { float32: embedding },
  topK: 10,
  filter: { tenant_id: { $eq: "org-b" } },   // ← the boundary
}));

Your code is the only enforcer. When it fails, the result is a plausible answer with HTTP 200, and nothing outside the process can refuse or record the mistake.

Structure that application code selects

Each tenant gets its own index, table, schema or collection, and the application chooses which one to use.

const index = indexFor(session.tenantId);           // ← the boundary
await client.send(new QueryVectorsCommand({ indexArn: index, ... }));

Enforcement is split between the code that picks the index and, on a database, whatever grants have been configured. If indexFor resolves the wrong value, the query runs against another tenant's index and returns the wrong customer's data, again with HTTP 200. That is quieter than a filter and exactly as wrong. With a schema per tenant on Postgres, the database itself refuses a read from the wrong schema, which helps. The grant is still the team's own, though, and the cloud provider sees one cluster as one resource, with nothing to refuse and nothing to log per tenant.

A resource the provider enforces

Each tenant has an index that is a first-class cloud resource with its own ARN, and the caller's credentials name exactly one of them.

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3vectors:QueryVectors", "s3vectors:GetVectors"],
    "Resource": "arn:aws:s3vectors:eu-west-1:123456789012:bucket/kb-eu-west-1/index/org-b"
  }]
}

IAM enforces this on every call, before the service even runs. The same indexFor bug now ends in an AccessDeniedException and nothing is returned, while CloudTrail records the refused attempt against the ARN that was requested. The further along this scale, the louder a failure becomes. The third level needs one property from the store that is easy to miss: the unit of tenancy must have an ARN.

Why the ARN settles it

Every IAM statement is an action on a resource, and the resource is an ARN or a wildcard. IAM can only guard things that have one, and CloudTrail follows the same rule by recording API calls against resource ARNs.

Amazon S3 Vectors gives each index an ARN shaped like arn:aws:s3vectors:<region>:<account>:bucket/<bucket>/index/<index>. All the data-plane operations (PutVectors, QueryVectors, GetVectors, DeleteVectors and ListVectors) count as IAM actions on that ARN and as CloudTrail data events recorded against it. This detail lifts the tenant boundary from the second level to the third.

The resource model and the six requirements

S3 Vectors is a storage bucket type, not a database. A vector bucket is made much like an ordinary S3 bucket and lives in one region. Inside it sit indexes, and each index fixes a dimension, picks a distance metric and lists which metadata keys cannot be filtered on. An index stores vectors, and each vector pairs a caller-chosen key with a float array and metadata, some of it filterable. The QueryVectors call returns the top-k nearest vectors together with that metadata.

// Tenant onboarding = one call. No capacity to choose.
await client.send(new CreateIndexCommand({
  vectorBucketName: "kb-eu-west-1",
  indexName: "org-b",
  dataType: "float32",
  dimension: 1024,                          // Titan Text Embeddings V2
  distanceMetric: "cosine",
  metadataConfiguration: {
    nonFilterableMetadataKeys: ["chunk_text"],   // stored and returned, never scanned or filtered
  },
}));

Onboarding a tenant is a single call with no capacity to choose. Here is how the requirements map onto the model.

  1. Isolation: each tenant maps to one index. The credentials point at that index ARN, so a query physically cannot land on another index, whatever the application requests.
  2. Residency: the region is baked into the index ARN. Keep one vector bucket per region served, and create a tenant's index in the bucket its contract names. For contracts needing an EU-operated partition, the AWS European Sovereign Cloud offers S3 Vectors too. Listing the indexes of each bucket produces the residency report.
  3. Deletability: because the writer chooses vector keys, they can be built from the document id and logged at ingest. Erasing a document is then DeleteVectors followed by a GetVectors that returns nothing, and strong consistency makes that absence reliable immediately. Removing a whole tenant is one DeleteIndex.
  4. Auditability: enabling CloudTrail data events for the index resource type means every call records who made it, when, against which index ARN and with what outcome. Asking who read tenant A reduces to filtering on that tenant's ARN.
  5. Provenance: anything coming back from tenant B's index is B's by construction, so no tenant tag is needed. Document id and version are filterable metadata shown in the citation. The chunk text is stored as non-filterable metadata and returned with the vector, which means the cited passage is the one the model actually received.
  6. Honest limits: unchanged, since the model sits downstream of the boundary.

What the boundary does not do

The third level settles which tenant can reach which data. It doesn't cover roles within a tenant, how a model treats the bare existence of a restricted document, or answer quality across languages. Those are application concerns, and they absorb most of the engineering time. The code shown is illustrative and uses the AWS SDK for JavaScript v3, so parameter names should be checked against the current SDK, and tenants, regions and account ids are placeholders.