Costs
In this tutorial, Nebius AI Cloud charges for one resource: Object Storage, for the storage that the LanceDB files consume in your bucket.Prerequisites
- Web console
- CLI
- Terraform
- Go SDK
- Python SDK
- JavaScript SDK
-
Make sure you are in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console. -
Set up Python or Node.js for the LanceDB client that you want to use:
- Python: Install Python 3.10 or later, or use a running JupyterLab® Devlab.
- TypeScript: Install Node.js 22 or later.
Steps
Create an Object Storage bucket
Create a bucket for the LanceDB data. This tutorial uses the Enhanced Throughput storage class because it’s well suited for streaming embeddings or model weights at scale and for latency-sensitive queries. You can use the Standard storage class instead. For a comparison, see Storage classes in Object Storage.- Web console
- CLI
- Terraform
- Go SDK
- Python SDK
- JavaScript SDK
- In the web console, go to Storage → Object Storage.
- Click Create resource → Bucket.
- Enter a name for the bucket. The name must be unique across the region.
- Select the Enhanced storage class.
- Click Create bucket.
Create a service account and grant it access to the bucket
LanceDB works with the bucket on behalf of a service account. Create a dedicated service account, put it in its own group, and grant that group access to the bucket:- Web console
- CLI
- Terraform
- Go SDK
- Python SDK
- JavaScript SDK
-
Create a group for the service account:
- In the sidebar, go to Administration → IAM.
- Click Create resource → Group.
- In the window that opens, enter
lancedb-accessas the group name and select your project as the scope of the group. - Click Create.
-
Create a service account and add it to the group:
- Click Create resource → Service account.
- In the window that opens, enter
lancedb-saas the service account name and select the project. - Click Create and continue.
- In the window that opens, find the
lancedb-accessgroup by its name or ID and click Add next to it. - Click Close.
-
Grant the group read and write access to the bucket:
- Go to Storage → Object Storage, find the bucket, and copy its ID.
- Go to Administration → IAM. On the Groups tab, open the
lancedb-accessgroup and switch to the Access permits tab. - Click Manage permits.
- In the Resource field, paste the bucket ID and press
Enter. - Select the
storage.editorrole. - Click Save changes.
storage.editor role lets the service account read and write objects in the bucket.
Create an access key
LanceDB authenticates in Object Storage with an access key of the service account. Create an access key for thelancedb-sa service account that you created:
- Web console
- CLI
- Terraform
- Go SDK
- Python SDK
- JavaScript SDK
- In the sidebar, go to Administration → IAM.
- On the Service accounts tab, open the
lancedb-saservice account. - On the Keys tab, click Create access key.
- Copy the key ID and the secret key and save them in a secure place. The web console shows the secret key only once.
Install LanceDB
Install the LanceDB client for the language that you use:Set environment variables
LanceDB reads the access key, the region, and the Object Storage endpoint from environment variables. In the terminal where you run the LanceDB code, set the variables:AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY: Key ID and secret key of the access key that you created. If you created the access key by using the CLI or Terraform in the same terminal, both variables are already set.AWS_DEFAULT_REGION: The region of your project; for example,eu-north1.AWS_ENDPOINT: Object Storage endpoint in the same region.
%env instead of export; for example, %env AWS_DEFAULT_REGION=<region_ID>.
Connect LanceDB to Object Storage
Open a script or a Jupyter notebook and connect LanceDB to your bucket. In the code, replace<bucket_name> with the name of the bucket that you created:
Create a table and insert vectors
Create a table with a vector column and a metadata column, then insert a few rows. This tutorial uses random vectors to keep the example self-contained.s3://<bucket_name>/lancedb/documents.lance/. You can verify this in the web console: go to Storage → Object Storage and open your bucket.
Run a similarity search
Query the table for the rows nearest to a query vector:_distance scores. 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, set the environment variables again, connect to the bucket, and open the table by its name:How to delete the created resources
The bucket is a chargeable resource. If you no longer need the data, delete the bucket, so Nebius AI Cloud doesn’t charge for it.See also
- LanceDB storage configuration
- About Object Storage
- Compatibility of Amazon S3 API with Object Storage
- Serverless AI
“Jupyter” and the Jupyter logos are trademarks or registered trademarks of LF Charities, used by Nebius B.V. with permission.