Files
lancedb/docs/web/ingestion/define-storage-integration.mdx
T
Jack YeandClaude Sonnet 5 5e38120bdc docs: add storage integration SDK examples, abstract RTE write, simplify cache pages (#4865)
## Summary

- **Define Storage Integration**: un-gates the Python (and Rust, for S3)
`create_storage_integration` examples, drafted against #4618 and held
back until it shipped -- it's now in v0.42.0-beta.0+, and the signature
matches the drafts exactly.
- **Naming rules**: drops the `Branch` row and its "Learn more" link,
consistent with de-emphasizing branches elsewhere in this nav.
- **Distributed RTE Write**: removes the REST path, the
`__lance_mem_wal` index name, and "WAL node" terminology in favor of an
abstract framing -- a query node routes writes to RTE nodes, each of
which can host shards from many different tables. Both diagram variants
are updated to match.
- **Data Page Cache / Tiered Index Cache / Cache Prewarm**: drop
Helm-specific and exact-percentage detail (disk-budget math,
`startup_prewarm_block_query_ready`/`healthPort`/failure-policy table)
in favor of a short feature → architecture → why-it-matters shape, each
closing with a contact-sales pointer. Data Page Cache's on-demand
prewarm section is removed outright.

## Note

I wasn't able to get a clean visual render of the updated Distributed
RTE Write diagram in local preview -- Mermaid isn't rendering in
headless Chrome in this environment for *any* page right now, confirmed
against an unmodified reference page showing the identical symptom. The
diagram source follows the exact pattern already shipped and working in
the 21 diagrams from the earlier brand-theming pass, and `mint
validate`/`mint broken-links` both pass clean.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-05 01:40:54 -08:00

176 lines
5.9 KiB
Plaintext

---
title: "Define Storage Integration"
sidebarTitle: "Define Storage Integration"
description: "Set up a reusable credential for AWS, GCP, Azure or HuggingFace before importing data from it."
icon: cloud
keywords: ["storage integration", "s3", "gcs", "azure", "huggingface", "credentials", "ingestion"]
availability:
embedded: unavailable
enterprise: available
---
Before you can [import data](/ingestion/import) from external storage or
[attach an existing database](/ingestion/migrate-from-embedded), define a
storage integration once per location. It is a namespace-scoped catalog
object that stores the credential -- neither operation names the
integration directly, LanceDB matches the URI you read against whichever
integration's prefix covers it.
## What each provider needs {#providers}
| Provider | Credential | Notes |
| --- | --- | --- |
| AWS S3 | An IAM role to assume, or a static access key pair | A role needs one extra step outside LanceDB: [trust policy setup](#trust). |
| Google Cloud Storage | A service account's JSON key | No role-based alternative. |
| Azure Blob Storage | A service principal's tenant, client ID and client secret | All three required together. |
| HuggingFace | An access token | Always required to create an integration. For anonymous access at HuggingFace's default rate limits, register no integration for that prefix instead. |
Every credential option takes a [Secret](/management/secret) reference,
never the value directly -- create the Secret first.
## Create one {#create}
### AWS S3 {#aws}
Give either an IAM role to assume, or a static access key pair -- mixing
the two, or supplying only one half of the key pair, is refused.
<CodeGroup>
```sql SQL icon="database"
CREATE STORAGE INTEGRATION raw
STORAGE_PROVIDER = 'S3'
STORAGE_PREFIX = 's3://customer-data/raw/'
STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::123456789012:role/lancedb-access'
CREATE STORAGE INTEGRATION raw
STORAGE_PROVIDER = 'S3'
STORAGE_PREFIX = 's3://customer-data/raw/'
STORAGE_AWS_ACCESS_KEY_ID_SECRET = aws_key_id
STORAGE_AWS_SECRET_ACCESS_KEY_SECRET = aws_key_secret
```
```python Python icon="python"
db.create_storage_integration(
"raw", "s3://customer-data/raw/",
storage_provider="S3",
aws_role_arn="arn:aws:iam::123456789012:role/lancedb-access",
)
db.create_storage_integration(
"raw", "s3://customer-data/raw/",
storage_provider="S3",
aws_access_key_id_secret="aws_key_id",
aws_secret_access_key_secret="aws_key_secret",
)
```
```rust
use lancedb::storage_integration::CreateStorageIntegrationRequest;
let info = db.create_storage_integration(
"raw",
CreateStorageIntegrationRequest::s3(
"s3://customer-data/raw/",
"arn:aws:iam::123456789012:role/lancedb-access",
),
&[],
).await?;
```
</CodeGroup>
### Google Cloud Storage {#gcp}
<CodeGroup>
```sql SQL icon="database"
CREATE STORAGE INTEGRATION gcs
STORAGE_PROVIDER = 'GCP'
STORAGE_PREFIX = 'gs://customer-data/raw/'
GCP_CREDENTIALS_JSON_SECRET = gcp_service_account
```
```python Python icon="python"
db.create_storage_integration(
"gcs", "gs://customer-data/raw/",
storage_provider="GCP",
gcp_credentials_json_secret="gcp_service_account",
)
```
</CodeGroup>
The Secret holds the full service-account JSON key. GCP has no
role-based alternative.
### Azure Blob Storage {#azure}
<CodeGroup>
```sql SQL icon="database"
CREATE STORAGE INTEGRATION blobs
STORAGE_PROVIDER = 'AZURE'
STORAGE_PREFIX = 'az://customer-data/raw/'
STORAGE_AZURE_STORAGE_ACCOUNT = 'customeraccount'
STORAGE_AZURE_TENANT_ID_SECRET = azure_tenant
STORAGE_AZURE_CLIENT_ID_SECRET = azure_client
STORAGE_AZURE_CLIENT_SECRET_SECRET = azure_credential
```
```python Python icon="python"
db.create_storage_integration(
"blobs", "az://customer-data/raw/",
storage_provider="AZURE",
azure_storage_account="customeraccount",
azure_tenant_id_secret="azure_tenant",
azure_client_id_secret="azure_client",
azure_client_secret_secret="azure_credential",
)
```
</CodeGroup>
All four options are required together; there is no role-based
alternative for Azure.
### HuggingFace {#huggingface}
<CodeGroup>
```sql SQL icon="database"
CREATE STORAGE INTEGRATION hub
STORAGE_PROVIDER = 'HUGGINGFACE'
STORAGE_PREFIX = 'hf://datasets/owner/private/data/'
HUGGINGFACE_TOKEN_SECRET = hf_token
```
```python Python icon="python"
db.create_storage_integration(
"hub", "hf://datasets/owner/private/data/",
storage_provider="HUGGINGFACE",
huggingface_token_secret="hf_token",
)
```
</CodeGroup>
`HUGGINGFACE_TOKEN_SECRET` is required to create this integration; omitting
it is rejected, not treated as anonymous. For anonymous access at
HuggingFace's default rate limits, register no integration for that prefix
at all.
### Finish the AWS trust policy {#trust}
An IAM role integration needs one step outside LanceDB: describing it
returns the `trust_policy` and `permissions_policy` documents your role
needs. Attach them in AWS, then describe the integration again and check
`access_verified` to confirm LanceDB can assume the role. A static access
key pair skips this step entirely.
See [Storage Integration](/sql/ddl/storage-integration) for every
provider's complete option reference, S3's two credential modes in full,
and the output schema, or [Storage Integration](/management/storage-integration)
for the Python and SQL CRUD operations at a glance.
## What to read next {#next}
<CardGroup cols={2}>
<Card title="Import Datasets" icon="file-import" href="/ingestion/import">
Read or import through the integration once it exists.
</Card>
<Card title="Attach Database" icon="arrow-right-arrow-left" href="/ingestion/migrate-from-embedded">
Attach an existing database at a location the integration covers.
</Card>
<Card title="Storage Integration" icon="cloud" href="/sql/ddl/storage-integration">
The complete SQL reference: every provider's options and output columns.
</Card>
</CardGroup>