NEWVectors or files. Pick a path.Start →
    Infrastructure
    8 min read
    Updated 2026-11-25

    How Do I Store and Search Vectors Directly in S3? Three Ways, With Code

    A plain S3 bucket cannot run similarity search, so you store vectors with something that keeps its index in object storage: Amazon S3 Vectors (a vector bucket with put_vectors and query_vectors), LanceDB writing tables to an s3:// path, or a storage-first vector database such as Mixpeek's. Working code for each, AWS's limits, and a comparison table.

    Ethan Steininger
    By , Founder & CEO, Mixpeek
    S3
    S3 Vectors
    Vector Search
    Object Storage
    LanceDB
    Vector Databases
    AWS

    How do I store and search vectors directly in S3?



    A plain S3 bucket stores files and has no similarity search, so you need something that keeps its vectors and index in object storage and runs the search for you. There are three ways to do it in 2026:

    1. Amazon S3 Vectors. AWS's own vector bucket type. Create a vector bucket and an index, write embeddings with put_vectors, and search with query_vectors. Nothing to run, AWS only. 2. LanceDB on an S3 path. An open-source library that writes Lance tables to s3://your-bucket/path and runs the search inside your own process. Your bucket, your compute. 3. A storage-first vector database. A managed service, such as the Mixpeek Vector Store (MVS), that keeps its write-ahead log, segments and snapshots in object storage and puts a cache in front for warm queries. You get hybrid search, filters and an API, and don't run any servers.

    Pick S3 Vectors when you are on AWS and query occasionally, LanceDB when you want the data in your bucket and are happy to run the query compute, and a storage-first database when you need hybrid search, higher query rates or one API across text, images and video. The code for each is below.

    What do I need before I start?



  1. Embeddings. One model for both the stored items and the queries, with a fixed dimension (for
  2. example 1,024). Changing models later means writing a new index.
  3. An ID for every vector. Usually your document or file ID, so a hit leads back to the source.
  4. The fields you will filter on. Tenant, date, type or language. Decide them now, because S3
  5. Vectors fixes which metadata keys can be filtered when the index is created.

    Option 1: How do I use Amazon S3 Vectors?



    S3 Vectors adds a bucket type that holds vector indexes. Each index has a fixed dimension and a distance metric (cosine or Euclidean). With boto3:
    import boto3
    
    s3v = boto3.client("s3vectors", region_name="us-east-1")
    
    # 1. A vector bucket and an index. Dimension and metric are fixed for the index's lifetime.
    s3v.create_vector_bucket(vectorBucketName="docs-vectors")
    s3v.create_index(
        vectorBucketName="docs-vectors",
        indexName="articles-v1",
        dataType="float32",
        dimension=1024,
        distanceMetric="cosine",
        metadataConfiguration={"nonFilterableMetadataKeys": ["chunk_text"]},
    )
    
    # 2. Write vectors in batches of up to 500, each with a key and metadata.
    s3v.put_vectors(
        vectorBucketName="docs-vectors",
        indexName="articles-v1",
        vectors=[{
            "key": "doc-001#0",
            "data": {"float32": embedding},          # 1,024 floats from your model
            "metadata": {"tenant": "acme", "lang": "en", "chunk_text": "First paragraph..."},
        }],
    )
    
    # 3. Search with a query embedding and an optional metadata filter.
    res = s3v.query_vectors(
        vectorBucketName="docs-vectors",
        indexName="articles-v1",
        queryVector={"float32": query_embedding},
        topK=10,
        filter={"tenant": "acme"},
        returnDistance=True,
        returnMetadata=True,
    )
    for hit in res["vectors"]:
        print(hit["key"], hit["distance"])
    Keep long text such as chunk_text as non-filterable metadata: filterable metadata is capped at 2 KB per vector, out of 40 KB in total. Writes are strongly consistent, so a vector can be queried as soon as put_vectors returns. The limits that matter most in production are hundreds of queries a second per index and 2,500 vectors a second of writes per index. The full list, prices and a worked 10M-vector cost example are in Is Amazon S3 Vectors good enough for production?

    Option 2: How do I keep vectors in my own S3 bucket with LanceDB?



    LanceDB writes its tables as Lance files under any s3://, gs:// or az:// path and runs queries in your application's process. AWS credentials come from the usual credential chain.
    import lancedb
    
    db = lancedb.connect("s3://my-bucket/lancedb")
    
    table = db.create_table("articles", data=[
        {"id": "doc-001#0", "vector": embedding, "tenant": "acme", "text": "First paragraph..."},
    ])
    
    hits = (
        table.search(query_embedding)
        .where("tenant = 'acme'")
        .limit(10)
        .to_list()
    )
    The data never leaves your bucket and there is no service to pay for. You do pay for the query compute, because every search runs where your code runs and reads from S3. Without a vector index, a search scans the table, which is fine for thousands of rows and slow for millions, so build an index once the table grows (table.create_index(...)). Concurrent writers from several machines need coordination, which the LanceDB docs cover.

    Option 3: How do I use a storage-first vector database?



    A storage-first database keeps the durable copy of every vector in object storage and serves queries from a fleet with a local cache. You call an API, it handles segments, compaction and caching. With Mixpeek's vector store, you create a namespace, upsert documents with your own vectors, and query through a retriever:
    # 1. A namespace for your vectors. Dimensions are inferred on the first write.
    curl -X POST "https://api.mixpeek.com/v1/namespaces/standalone" \
      -H "Authorization: Bearer $MIXPEEK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"namespace_id": "articles"}'
    
    # 2. Upsert documents with your vectors and any payload fields.
    curl -X POST "https://api.mixpeek.com/v1/namespaces/articles/documents/upsert" \
      -H "Authorization: Bearer $MIXPEEK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"documents": [{
            "document_id": "doc-001",
            "vectors": {"articles_e5_v1": [0.12, -0.34, 0.56]},
            "payload": {"tenant": "acme", "lang": "en"}
          }]}'
    Then create a retriever with a feature_search stage on articles_e5_v1 and a pre_filters condition on tenant, and execute it with the query embedding. The vector store quickstart has the full request, plus sparse, BM25 and hybrid search over the same documents.

    On the managed service the vectors sit in object storage that Mixpeek runs. On a dedicated or self-hosted deployment you can point the store at your own S3, GCS, R2 or other S3-compatible bucket (bring your own object storage).

    How do the three options compare?



    Amazon S3 VectorsLanceDB on S3Storage-first database (MVS)
    Where vectors liveAWS vector bucketYour bucketObject storage (yours on dedicated or self-hosted)
    Who runs the searchAWSYour processThe service
    CloudsAWSAny object storeAWS, GCP and S3-compatible stores
    Search typesSimilarity with metadata filtersVector, full-text and hybridDense, sparse, BM25 and hybrid
    Query rateHundreds of queries a second per indexLimited by your computeScales with the serving fleet
    Changing embedding modelsNew index and full reloadNew column or tableNew vector name in the same namespace
    PricingStorage, writes and data processed per queryYour S3 and compute billsPlan based, see pricing
    Best forAWS teams with occasional queries and many tenantsPipelines and apps that want full controlProducts with steady query traffic or multimodal data


    Why is my first query slow?



    Every option here reads from object storage on a cold query, and each read is a network round trip. Expect high hundreds of milliseconds when nothing is cached and around 100 ms once the data is warm. Keep an index warm with a periodic query, or split data so each query touches a small index. Why is the first vector search query on S3 slow? measures cold, warm and cached latency.

    What about the files the vectors came from?



    The vectors are only half of it. If your source is images, video, audio or PDFs in S3, something has to read each file, cut it into pieces, embed every piece and keep the vector linked to the file and the timestamp it came from. You can write that pipeline yourself around any of the three options. Mixpeek does it as a managed step: it reads objects from your bucket, runs extractors for text, images, video and audio, and writes the vectors into the store above. See how to make files searchable as soon as they land in S3 and the broader explainer, Can you run a vector database on S3?

    Frequently asked questions



    Can I store embeddings in a normal S3 bucket?



    Yes, as files such as Parquet, NumPy arrays or Lance tables, but a normal bucket cannot search them. A library like LanceDB reads those files and runs the search in your process, or you use an S3 Vectors vector bucket, which is a separate bucket type with its own query API.

    How many vectors can Amazon S3 Vectors hold?



    Up to 2 billion vectors per index and 10,000 indexes per vector bucket, with 1 to 4,096 dimensions per vector, per AWS's documented limits. Each query_vectors call returns up to 100 results per page.

    Is searching vectors in S3 cheaper than a vector database?



    Usually, for storage. S3 Vectors charges $0.06 per GB-month in US East, against memory-resident databases that hold every vector in RAM around the clock. Query cost is the part to model: S3 Vectors bills each query on the size of the index it searches, so a busy, large index can cost more than a fixed-price cluster.

    Can I do hybrid keyword and vector search on S3?



    With LanceDB, yes, through its full-text index. With a storage-first database such as Mixpeek's, yes, with BM25 and dense vectors in one query. For S3 Vectors, AWS documents similarity search with metadata filters, and its pricing page lists full-text and hybrid query charges, so check what your Region supports.

    How do I delete a vector from S3 Vectors?



    Call delete_vectors with the vector bucket, the index and the list of keys. Deletes count against the same 1,000 write or delete requests a second per index as writes.
    Managed Mixpeek

    Put multimodal search to work

    Connect a bucket and Mixpeek runs the whole multimodal search pipeline for you: extraction, indexing, and search over your own objects. No models to wire up, nothing to host.

    Start with Managed
    MVS · bring your own

    Already have vectors?

    Keep your embeddings on your own cloud and run dense, sparse, and BM25 search directly on object storage. From $25/mo.

    Start with MVS

    Store and search vectors on object storage

    Mixpeek's vector store keeps your vectors in object storage, serves dense, sparse, BM25 and hybrid search through one API, and can index the images, video, audio and documents in your S3 bucket for you.

    See the vector storeRead the quickstart

    Related guides

    Infrastructure

    Is Amazon S3 Vectors Good Enough for Production Vector Search?

    Amazon S3 Vectors is good enough for production when queries are occasional or spread across many indexes, writes stay under 2,500 vectors a second per index, and about 90% recall with 100 ms to sub-second latency is acceptable. It falls short for high query rates on one index, single-digit-millisecond latency or heavy write streams. AWS's documented limits, current prices with a worked 10M-vector example, and how to test it on your own data.

    Read guide →
    Infrastructure

    Why Is the First Vector Search Query on S3 Slow? Cold, Warm and Cached Latency, Measured

    The first vector search query on S3 or GCS is slow because the index must be fetched from the bucket before anything can be ranked. Measured on Mixpeek's vector store: a cold query at 1M x 768 had a p50 of 0.697 s, a whole-partition layout read 391 MB where a range-read layout read 3.1 MB, and cached queries ran at a p50 of about 50 ms. What drives cold latency, why recall drops on large indexes, and how to make the first query faster.

    Read guide →
    Infrastructure

    Write-Ahead Logs on Object Storage: How S3 Becomes a Database's Durability Layer

    A write-ahead log acknowledges a write the moment it is durable, before any index work happens. Move that log onto S3 or GCS and the bucket becomes the durability layer: recovery, read replicas and change feeds all become readers of one chain of sequenced objects. Covers what a WAL is, why object storage changes the design, the two coordination problems it creates (writer fencing and garbage collection that could delete the only copy of a write), how conditional writes solve them, and the shipped write path in Mixpeek MVS.

    Read guide →