Skip to content

Build1 publisher2 min readPublished

One Lambda fans a query into a prefix match and a 512-dimension cosine search

DynamoDB vector search has been generally available since August 5, 2026. A walkthrough of a serverless search engine shows what a single Lambda actually buys with it, and what choosing 512 dimensions commits a catalogue to.

The Engineer · Build desk

Illustration accompanying One Lambda fans a query into a prefix match and a 512-dimension cosine search

What happened

  • DynamoDB vector search became generally available on August 5, 2026, and the author reached for it because the help article data was already sitting in DynamoDB.
  • The search it replaces used lexical, prefix-based matching, and many words simply did not match.
  • A dev.to walkthrough wires DynamoDB vector search, Amazon Bedrock, Lambda and API Gateway together, with all the infrastructure defined and deployed by AWS CDK in TypeScript.
  • One table holds the product catalog, the embeddings and popularity scores, with a DynamoDB vector index doing the semantic similarity search over it.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • capability A team already keeping its content in DynamoDB can add semantic retrieval to the table it already queries, with no second datastore to provision, monitor or keep in sync.
  • constraint The 512-dimension setting binds the whole corpus, so a later move to 256 or 1,024 is a full re-embedding job before any query improves.
  • decision Someone now has to decide how a cosine distance, a prefix match and a stored popularity score combine into one ordering, and that decision lives in application code.
  • exposure Both the write path and the read path now depend on a Bedrock model invocation, so search quality and availability are tied to a second AWS service as well as the table.

The lexical query can leave for DynamoDB as soon as the request arrives. The semantic one waits for a vector. Amazon Titan Text Embeddings V2 has to turn the query text into 512 numbers first, and only then can SearchVectors compare it against what is stored [9]. The two branches do overlap in time, so the clock is set by the slower one, and the semantic branch is two network calls deep before any comparison happens [21].

The projection is the part worth copying. The vector index carries the product attributes the search response needs, so a SearchVectors result answers the request without a further read [15]. Take the projection away and the flow goes back to the familiar one, where you collect identifiers from the vector result and then read the items back by key [26]. You declare that saving in the index definition [15].

You cannot change the embedding settings casually. The project pins amazon.titan-embed-text-v2:0, 512 dimensions, and normalization enabled [13]. Products and queries must use the same model, the same number of dimensions, and the same normalization [12]. Titan V2 also offers 256 and 1,024 dimensions, according to the Bedrock documentation cited in the tutorial [14], so 512 is a decision about the whole corpus: move to another size and every stored product has to be embedded again before a single query gets better [22].

Ordering comes from the distance function configured on the index, and DynamoDB does the nearest-neighbour step with an approximate index [10]. The tutorial uses cosine distance, where 0 means identical vectors and lower values mean closer [11]. One query run through a comparator with the sign backwards looks exactly like a broken index. The walkthrough does not publish latency or recall numbers, so treat it as a shape to copy; the author's production case is help article titles, and the tutorial indexes products [17].

Adoption cost is version floors and IAM. Node.js 22 or later, npm 11 or later, permissions for DynamoDB, Lambda, API Gateway, CloudFormation and IAM, plus bedrock:InvokeModel, plus an account already bootstrapped for CDK [16]. Bedrock model access is usually enabled by default in new accounts, though availability still varies by Region [20]. The table runs on on-demand capacity [8]. Indexing and querying are separate flows, and nothing is searchable until its embedding has been generated and stored [18].

The walkthrough describes the project and the AWS services as of September 2026, about a month after general availability [19][23]. The author's advice is to review the official AWS documentation before using the design in production [19].

What to watch

  • Recall or latency characteristics published for the DynamoDB ANN index. With those numbers, teams could size the semantic leg.
  • Any backfill tooling for re-embedding and reindexing in place. A dimension change currently requires that work.
  • Documented limits on how many attributes a vector index can project, since the no-second-read property depends on them.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories