Skip to main content
Vector embeddings turn text, images and other unstructured data into numerical vectors that you can search by similarity, which is the basis for semantic search and retrieval-augmented generation (RAG). This tutorial shows you how to use LanceDB with Object Storage as a persistent vector store. LanceDB writes tables directly to an Object Storage bucket, each containing vector embeddings alongside structured metadata, with no separate database server to run or manage. Object Storage exposes an S3-compatible API, so LanceDB connects to it with no additional drivers. This tutorial uses the Enhanced Throughput storage class because it is well suited for streaming embeddings or model weights at scale and for latency-sensitive queries. By the end of this tutorial, you will have LanceDB reading and writing vector data to an Object Storage bucket in Nebius AI Cloud and will have run a nearest-neighbor similarity search against that data.

Costs

Nebius AI Cloud charges for the following resources used in this tutorial:
  • Object Storage: storage consumed by LanceDB files written to your bucket.

Prerequisites

Steps

Create an Object Storage bucket

  1. In the web console, go to https://mintcdn.com/nebius-ai-cloud/rOlLZ_MFvrheaI-h/_assets/sidebar/storage.svg?fit=max&auto=format&n=rOlLZ_MFvrheaI-h&q=85&s=f060b15cbd82c08f84599faeeeb07ece Object Storage and click Create bucket.
  2. Enter a name for the bucket, for example lancedb-data.
  3. Select Enhanced Throughput for the storage class.
    You can use the Standard storage class instead, but Enhanced Throughput works better for this workflow. For a comparison, see Storage classes in Object Storage.
  4. Click Create bucket.

Create a service account and grant it access to the bucket

LanceDB needs credentials to read and write objects. Create a dedicated service account, put it in its own group and grant that group access to the bucket you created.
  1. Create a service account:
  2. Create a group for the service account and add the account to it:
  3. Look up the bucket ID and grant the group read and write access scoped to the bucket:
    The storage.editor role in this bucket policy lets the service account read and write objects in this bucket only.
  4. Create an access key and save the credentials:
    Save the values of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY somewhere secure — the secret is shown only once.

Install LanceDB

Install LanceDB dependencies for your platform of choice:

Connect LanceDB to Object Storage

Open a script or notebook and connect LanceDB to your bucket. The endpoint follows the pattern https://storage.<region_ID>.nebius.cloud. Replace <bucket_name>, <region_ID>, <access_key_ID> and <secret_access_key> with your values.
You can supply credentials via environment variables instead of storage_options. If AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION and AWS_ENDPOINT are set in your shell, you can call lancedb.connect("s3://<bucket_name>/lancedb") with no additional options.

Create a table and insert vectors

Create a table with a vector column and a metadata column, then insert a few rows. In this tutorial, random vectors are used to keep the example self-contained.
In a real application you would generate embeddings using a model deployed via Serverless AI or running locally with SentenceTransformers. For a Serverless AI example, see the tutorial on Building a RAG electronics store chatbot.
LanceDB writes the table as Lance files under s3://<bucket_name>/lancedb/documents.lance/. You can verify this in the web console under Object Storage → your bucket. Query the table for the rows nearest to a query vector:
The output shows the two nearest rows along with their _distance score. Because the data in this example is random, the distances have no semantic meaning — in a real application, vectors would come from an embedding model and low distances would indicate semantic similarity.

Reconnect to an existing table

LanceDB tables persist in Object Storage. To reopen a table in a later session, reconnect with the same credentials and call open_table:

How to delete the created resources

Object Storage is a chargeable resource. If you no longer need the data, delete the bucket to stop incurring charges.

See also


“Jupyter” and the Jupyter logos are trademarks or registered trademarks of LF Charities, used by Nebius B.V. with permission.