AWS Builder Center
Amazon DynamoDB Vector Search. No Separate Vector Store

Amazon DynamoDB Vector Search. No Separate Vector Store

Amazon DynamoDB Vector Search GA: add a vector index to an existing table. Same accuracy as S3 Vectors, single-digit ms latency, data and embeddings collocated.

Series: AI Agent Memory (7 articles)

  1. …
  2. 3
    Amazon DynamoDB Vector Search. No Separate Vector Store This article
Developer Advocate/SDE, GenAI
Part 1 of this postĀ  showed how keyword search misses semantic questions and measured two vector backends: FAISS and Amazon S3 VectorsĀ  (managed), on the same traveler memories. Both found the answer. The difference was deployment: local vs cloud-managed.
This part adds a third vector backend: Amazon DynamoDB Vector SearchĀ , generally available since 2025. The question and the memories are identical. Only the backend changes.
1
2
3
4
5
6
stored: dietary_notes: "Vegetarian; severe shellfish allergy — strictly no
crustaceans or mollusks."


asked: "What should I avoid eating when I go out for dinner on this trip?"

DynamoDB Vector Search: top hit (score 0.231) answer found: True

What is Amazon DynamoDB Vector Search?

It is a vector index added to an existing DynamoDB table. Not a separate service. You define a VectorIndexes block when you create (or update) the table, and DynamoDB stores the embeddings as a List attribute on each item. Queries use the SearchVectors API.
The key difference from S3 Vectors: the vectors live in the same table as your operational data. If your agent already reads user preferences or travel records from DynamoDB, you can add a vector index to that same table and query by meaning without provisioning another service.
Amazon S3 VectorsAmazon DynamoDB Vector Search
Where vectors liveDedicated vector bucketInside a DynamoDB table
Operational data collocatedNoYes
Query latency~100–200 msSingle-digit ms
Billing modelPer-query + storageOn-demand (PAY_PER_REQUEST)
Accuracyāœ… same (same embeddings)āœ… same (same embeddings)
Survives restartYesYes
Infrastructure to manageNoneNone
Best forDedicated vector memory, no operational data to manageAgents that already use DynamoDB, or want one service for data + embeddings
Both are valid choices. S3 Vectors is purpose-built for dedicated vector workloads and the right fit when you want memory completely separate from your operational data. DynamoDB Vector Search is the right fit when your agent data is already in DynamoDB and you want one service for both.
(This demo uses Strands AgentsĀ . The pattern carries over to any agent framework.)

How does the embedding comparison look?

Same question, same Titan V2 embeddings, four backends side by side:
StoreFinds answercos_simQuery latency
Key-value (keyword scan)No——
FAISSYes0.231<0.1 ms
Amazon S3 VectorsYes0.231~195 ms
Amazon DynamoDB Vector SearchYes0.231single-digit ms
All three vector backends return the same top hit with the same score, because they use the same Amazon Titan Text Embeddings V2Ā  model. The embedding call (~510 ms) still dominates end-to-end latency for all of them. What changes is the query after the embedding.

How do you add a vector index to a DynamoDB table?

DynamoDB Vector Search requires on-demand billing (PAY_PER_REQUEST). The vector index is declared when creating the table:
1
2
3
4
5
6
7
8
9
10
11
12
13
client.create_table(
TableName="agent-memory-demo-ddb",
BillingMode="PAY_PER_REQUEST", # required for vector indexes
KeySchema=[{"AttributeName": "memory_key", "KeyType": "HASH"}],
AttributeDefinitions=[{"AttributeName": "memory_key", "AttributeType": "S"}],
VectorIndexes=[{
"IndexName": "memory-vector-index",
"VectorAttribute": {"AttributeName": "embedding"},
"Dimensions": 1024,
"DistanceFunction": "COSINE",
"Projection": {"ProjectionType": "ALL"},
}],
)
The demo self-provisions the table and index if missing: no console steps, no CDK required.

How do you write and query vectors?

Embeddings are stored as a DynamoDB List attribute alongside the rest of the item:
1
2
3
4
5
6
7
8
client.put_item(
TableName="agent-memory-demo-ddb",
Item={
"memory_key": {"S": "dietary_notes"},
"text": {"S": "Vegetarian; severe shellfish allergy..."},
"embedding": {"L": [{"N": str(float(f))} for f in vector]}, # 1024 floats
},
)
Querying uses the SearchVectors API with the same AttributeValue format:
1
2
3
4
5
6
resp = client.search_vectors(
TableName="agent-memory-demo-ddb",
IndexName="memory-vector-index",
SearchVector=[{"N": str(float(f))} for f in question_vector],
TopK=3,
)
Score note: SearchVectors returns a cosine distance (lower = more similar). The demo converts it to cosine similarity (1.0 āˆ’ score) so the output is directly comparable to FAISS and S3 Vectors.

Does the index survive a restart?

Yes. It's DynamoDB. A fresh client instantiated after the demo runs still sees every item:
1
2
fresh = DynamoDBVectorStore()
fresh.count() == 10 # True — all 10 memories are there
This is the same restart test run in Part 1 for S3 Vectors. Both pass.

How do you run Test 4?

Test 4 runs as part of the existing test_vector_memory.py in the companion repo:
1
2
3
4
git clone https://github.com/elizabethfuentes12/stop-ai-agents-losing-memory-sample-for-aws
cd stop-ai-agents-losing-memory-sample-for-aws/02-vector-memory-demo
uv venv && uv pip install -r requirements.txt
uv run python test_vector_memory.py
Needs AWS credentials (aws configure) for Titan embeddings (Bedrock), S3 Vectors, and DynamoDB. The demo creates the DynamoDB table and vector index automatically if they don't exist. Requires boto3\>=1.43.72 (SearchVectors was added in that release).

When do you pick DynamoDB over S3 Vectors?

You havePick
No existing DynamoDB table; memory is the only use caseS3 Vectors — purpose-built for dedicated vector workloads
An existing DynamoDB table with user dataDynamoDB Vector Search — add the index to the same table; one service, one billing model
Need sub-100 ms query latency after the embedding callDynamoDB Vector Search — single-digit ms vs ~200 ms
High QPS, hybrid search, or advanced filteringDedicated vector database (OpenSearch, Qdrant, etc.)

FAQ

Can I add a vector index to an existing DynamoDB table?
Yes. Use update_table with VectorIndexUpdates to add the index to a table that already has data. Existing items without the embedding attribute won't appear in vector queries until you backfill their embeddings and update the items.
Does DynamoDB Vector Search work in all regions?
Check regional availabilityĀ ; the feature is GA but not in every region on launch day.
What's the cost compared to S3 Vectors?
DynamoDB Vector Search uses on-demand billing: you pay for read/write capacity units and storage on the table. S3 Vectors charges per query and per stored vector. For agent memory workloads (infrequent queries, small number of vectors per user) both are low cost; the deciding factor is architecture, not price.
Why does SearchVectors return a distance and not a similarity?
SearchVectors returns cosine distance (1 āˆ’ cosine_similarity), where 0 means identical and 1 means opposite. The demo converts with 1.0 āˆ’ score to get cosine similarity for easy comparison with FAISS (which returns inner product of normalized vectors, equivalent to cosine similarity) and S3 Vectors (which also returns 1 āˆ’ distance).

Resources


Which surprised you more: the single-digit millisecond DynamoDB latency, or the fact that the cosine similarity score is identical across all four backends? Share in the comments.

Gracias!

Series: AI Agent Memory (7 articles)

  1. …
  2. 3
    Amazon DynamoDB Vector Search. No Separate Vector Store This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article