If your SaaS already lives in DynamoDB, you can now keep embeddings in the same table and search them without running OpenSearch or a separate vector database. Use the partition key per tenant, but do not rely on it to isolate customers: your backend has to set the tenant filter, not the user.
What it is
Since 5 August 2026, DynamoDB has generally available vector search in all commercial Regions and in GovCloud. An embedding is a list of numbers that represents the meaning of a text: two similar texts give nearby vectors. Vector search is what a RAG system (retrieval-augmented generation) uses to find the chunks it hands to the model.
In DynamoDB it works like this, according to the developer guide:
- The embedding is stored as an ordinary item attribute, a list of numbers, next to the rest of the data.
- You create a vector index with
CreateTableorUpdateTable. You tell it which attribute holds the vector, how many dimensions (up to 4,096) and which distance to use:COSINE,DOT_PRODUCTorEUCLIDEAN. - You search with the new
SearchVectorsAPI: pass the query vector and how many results you want (TopK), and it returns the closest items with a score. - Optionally, the index has a partition key, which scopes each search to vectors with that value, and inline filters to narrow results within the partition.
It is approximate search (ANN), like almost every vector database: fast, but not guaranteed to always find the exact nearest neighbour.
How to set it up for a multi-tenant SaaS
The natural pattern is to use TenantId as the index partition key. Each search then only scans that customer’s documents, which is cheaper and faster than searching the whole index.
- Create the table in on-demand mode with the vector index. Adapted from the documentation example:
aws dynamodb create-table \
--table-name Documents \
--attribute-definitions AttributeName=DocId,AttributeType=S \
AttributeName=TenantId,AttributeType=S \
AttributeName=DocType,AttributeType=S \
--key-schema AttributeName=DocId,KeyType=HASH \
--billing-mode PAY_PER_REQUEST \
--vector-indexes '[{
"IndexName": "DocsEmbedding",
"VectorAttribute": {"AttributeName": "Embedding"},
"SearchSchema": [
{"AttributeName": "TenantId", "SearchSchemaElementType": "HASH"},
{"AttributeName": "DocType", "SearchSchemaElementType": "INLINE_FILTER"}
],
"Projection": {"ProjectionType": "KEYS_ONLY"},
"Dimensions": 1024,
"DistanceFunction": "COSINE"
}]'
-
Generate embeddings with the model of your choice (one on Bedrock, for example) and write them with a normal
PutItem. Always use the same model for documents and queries. -
Search within the tenant:
aws dynamodb search-vectors \
--table-name Documents \
--index-name DocsEmbedding \
--search-vector file://query.json \
--top-k 5 \
--search-condition-expression "TenantId = :t AND DocType = :type" \
--expression-attribute-values '{":t": {"S": "tenant-42"}, ":type": {"S": "contract"}}'
With KEYS_ONLY, the response only carries the document keys, and you read the text afterwards with BatchGetItem on the table. That is what AWS recommends to avoid paying extra for index storage and writes.
If the index has a partition key, every search must include it with =. Inline filters are optional and, for now, only support equality: no <, > or IN.
Limits to know before you start
- On-demand only. If your table uses provisioned capacity, you cannot create the index.
- The index cannot change. Dimensions, distance, projection, filters and partition key are fixed at creation. If you switch embedding models, you create another index (there is a limit of 5 per table) and migrate.
- Eventual consistency. Indexing is asynchronous: a freshly written document takes a moment to show up in searches.
- Responses up to 16 MB, with no pagination. With
ALLprojection, large items and a highTopK, you get there fast. One more reason to project little. - Quotas per partition key value. The best practices guide gives 1 GB/s of search and 10 MB/s of writes per value. With one tenant per partition, a very large customer can hit that ceiling.
- Billed by bytes. You pay for index writes, bytes processed per search and storage, with a 1 KB minimum per operation. Per-GB rates are on the DynamoDB pricing page; run the numbers for your volume before deciding.
The trap: the partition key is not access control
This is the point I care most about. The documentation is blunt: the index partition key is there for performance and data locality, and it is not an access-control boundary. The IAM condition dynamodb:LeadingKeys, which many of us use so each tenant only reads its own items, does not apply to SearchVectors. Fine-grained access control (FGAC) is not supported on this API either.
In practice, any role allowed to call SearchVectors on the index can search every tenant’s documents. The only barrier is the :t value you put in the condition.
So the rule is simple: the search TenantId comes from the token your backend has already validated (the JWT claim, for example), never from a parameter the client sends. And if some customers have strong isolation requirements, a table or an account per customer is still the safest option.
My take
For a small SaaS already on DynamoDB, I would start here before OpenSearch or a separate vector database. One less system to maintain, no replication pipeline and no capacity to provision. For a team of one or two people, that matters more than any difference in recall.
What I would do before production:
- Test recall with real documents from a couple of tenants, especially small ones: with very few vectors per partition, approximate search can miss more often.
- Pick the model and dimensions carefully. Changing later means another index.
- Write a test that tries to search with another user’s tenant and checks that your API rejects it.
Where I would not use it: if you already pay for OpenSearch for text search, or if you need range filters (dates, prices) inside the vector search, which do not exist today.
Sources
- AWS: Amazon DynamoDB now supports real-time vector search
- AWS Database Blog: Build semantic search with native vector support in Amazon DynamoDB
- DynamoDB Developer Guide: Using vector indexes
- DynamoDB Developer Guide: Creating and searching vector indexes
- DynamoDB Developer Guide: Best practices for vector indexes
- DynamoDB Developer Guide: Requirements and limitations
If you build serverless SaaS on AWS and want more architecture calls like this one, follow me on LinkedIn.