--- 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/attach-database), 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 | Three service principal Secrets or one storage account access key Secret | Both modes require the storage account name. | | 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. ```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?; ``` ### Google Cloud Storage {#gcp} ```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", ) ``` The Secret holds the full service-account JSON key. GCP has no role-based alternative. ### Azure Blob Storage {#azure} Specify the storage account and choose either service principal credentials or a storage account access key. Reference the values through Secrets. #### Service principal ```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", ) ``` #### Storage account access key Store the key in a single Secret. Azure must allow Shared Key authorization on the storage account. ```sql SQL icon="database" CREATE STORAGE INTEGRATION blobs_key STORAGE_PROVIDER = 'AZURE' STORAGE_PREFIX = 'az://customer-data/raw/' STORAGE_AZURE_STORAGE_ACCOUNT = 'customeraccount' STORAGE_AZURE_STORAGE_ACCOUNT_ACCESS_KEY_SECRET = azure_key ``` Use SQL to create the integration from TypeScript applications. {/* Draft for the SDK release with Azure storage account access key support. Publish these examples when the client APIs and Enterprise support ship. ```python Python icon="python" db.create_storage_integration( "blobs_key", "az://customer-data/raw/", storage_provider="AZURE", azure_storage_account="customeraccount", azure_storage_account_access_key_secret="azure_key", ) ``` ```rust use lancedb::storage_integration::{CreateStorageIntegrationRequest, SecretReference}; let request = CreateStorageIntegrationRequest::azure_with_account_access_key( "az://customer-data/raw/", "customeraccount", SecretReference::new("azure_key"), ); let info = db.create_storage_integration("blobs_key", request, &[]).await?; ``` */} ### HuggingFace {#huggingface} ```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", ) ``` `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} Read or import through the integration once it exists. Attach an existing database at a location the integration covers. The complete SQL reference: every provider's options and output columns.