title: 'Amazon S3 Vectors Engine'
sidebar_label: 'Amazon S3 Vectors'
description: 'Amazon S3 Vectors Engine Documentation'
sidebar_position: 1
pagination_next: null
🎓 Learn how it works with the Amazon S3 Vectors with Spice (opens in a new tab) engineering blog post.
Amazon S3 Vectors, announced in public preview at AWS Summit New York 2025, is a new S3 bucket type designed for storing and querying vector embeddings at scale. It supports billions of vectors with sub-second similarity queries, reducing costs by up to 90% compared to traditional vector databases by separating storage from compute. Spice AI integrates S3 Vectors as a vector index backend, managing embedding indexing, lifecycle, and queries for hybrid search experiences.
To use Amazon S3 Vectors as a Vector Engine, specify s3_vectors as the engine, and configure the associated location and AWS credentials.
Parameters
| Parameter | Description | Example Value |
|---|
s3_vectors_arn | The S3 vectors index to use. Incompatible with s3_vectors_bucket and s3_vectors_index. | arn:aws:s3vectors:us-east-1:123456789012:bucket/a-bucket/index/index-of-important-embeddings |
s3_vectors_aws_access_key_id | Optional. The access key ID for the S3 vectors index. If not specified, credentials will be loaded from the environment. | - |
s3_vectors_aws_iam_role_source | Optional. IAM role credential source: auto (default AWS credential chain), metadata (instance/container metadata only), or env (environment variables only). Ignored when an access key and secret are supplied. Default auto. | metadata |
s3_vectors_aws_region | The AWS region for the S3 vectors index. | us-east-1 |
s3_vectors_aws_secret_access_key |
:::warning[Limitations]
-
s3_vectors_index and s3_vectors_arn specify a single index for the dataset and therefore should not be used with a dataset containing more than one embedding column.
-
S3 Vectors uses approximate nearest neighbor (ANN) algorithms for performance, providing probabilistically closest results.
-
A single vector search can retrieve up to 10,000 results. Spice paginates the underlying QueryVectors calls (100 results per page) to reach this limit. When no LIMIT is specified, the search returns one page (100 results); a LIMIT larger than 10,000 is clamped to 10,000.
:::
Overview
Amazon S3 Vectors exposes two core operations: upsert vectors (assign a vector to a key with optional metadata) and vector similarity queries (find closest vectors by metrics like cosine or Euclidean distance). It stores vectors durably in S3 and executes queries on transient compute, avoiding always-on servers. This enables petabyte-scale storage at low cost, ideal for semantic search, recommendations, and RAG in AI applications.
Configuration
Annotate dataset schemas to specify columns for embedding and models. Spice supports local or hosted models like Amazon Titan Embeddings. When data ingests, Spice generates embeddings and stores them in the configured S3 Vectors index. Spice handles index creation, updates, and synchronization with data changes.
Example with AWS Titan model:
Querying
Perform vector searches via HTTP API or SQL table-valued function vector_search(dataset, query).
HTTP example:
SQL example:
Results include matching snippets, additional fields, primary keys, scores, and table names.
Managing Embeddings
Spice manages the vector lifecycle: embedding data on ingestion, upserting to S3 Vectors with primary keys as identifiers, and handling updates/deletions. Vectors can be pre-stored in S3 for scalability, avoiding memory limits in accelerators or slow just-in-time computations.
Query Execution
Spice pushes similarity computations to S3 Vectors, retrieving top matches as (id, score) pairs. These form a temporary table joinable with the dataset for full records, reducing processing to candidates only.
Handling Filters
Mark columns as filterable metadata to push filters into S3 Vectors queries:
This ensures results respect constraints like time ranges during similarity search.
Which Predicates Push Down
S3 Vectors accepts a restricted, MongoDB-style metadata filter, so only some predicates translate. A predicate is pushed into the S3 Vectors query when it references a filterable metadata column on the left-hand side and takes one of these shapes:
| Predicate | Pushed down when |
|---|
=, != | The literal is a boolean, a string, or a finite number |
<, <=, >, >= | The literal is numeric — an integer, or a finite float |
IS NULL, IS NOT NULL | Always |
IN (…) | The list is non-empty and every element is a boolean, a string, or a finite number |
AND, OR | Every sub-expression is itself pushable |
Anything else is evaluated by the Spice query engine after candidates come back, which is correct but reads more rows from the index. The cases that most often surprise:
- Range comparisons against strings are not pushed down.
WHERE category > 'm' is a valid SQL predicate, but S3 Vectors supports range operators only on numeric metadata, so it is filtered locally. Equality and IN on strings do push down.
- The column must be the left operand.
WHERE rating > 4 pushes down; WHERE 4 < rating does not.
NaN and infinite floats never push down, nor do NULL literals — use IS NULL instead of = NULL.
- Columns that are not
filterable metadata cannot be pushed at all, including derived columns such as the similarity distance the index adds to results.
Optimizations
Store non-filterable columns as metadata to avoid joins:
Queries can then retrieve all needed data directly from the index, improving latency for read-heavy workloads.
Advanced Features
Spice supports hybrid search (vector + full-text via BM25, merged with RRF), multi-vector queries (weighting columns), and re-ranking (e.g., keyword first-pass then vector on candidates). Compose via SQL CTEs and joins.
Hybrid RRF example:
Multi-column example (weighting title higher):
Bucket and Index Naming
For S3 vector bucket and index names, AWS allows only lowercase letters, numbers, and hyphens. A name must also be 3 to 63 characters long.
When not provided, Spice normalizes the index names it generates, but it passes s3_vectors_bucket and an explicit s3_vectors_index to AWS unchanged. As a result, invalid names will be rejected.
Index Partitioning
S3 Vectors indexes can be partitioned using an arbitrary logical expression. This enables Spice to compose many actual vector indexes as one logical vector index, enabling elastic scalability for vector storage.
To partition your S3 vector indexes:
This example uses a bucket user-defined function (UDF) to hash the PULocationID column and split the associated vectors into one of 50 partitioned indexes. The runtime will use the s3_vectors_index parameter as a prefix and generate partition-specific names. The prefix is normalized (_ and . become -) and truncated to 45 characters to leave room for the partition suffix within the S3 Vectors 63-character index-name limit — see Index Naming (opens in a new tab).
:::warning[Limitations]
partition_by must have only 1 expression.
- Expression must reference exactly one column from the dataset.
- Expression must produce a scalar value
- Expression cannot contain a subquery
:::
Authentication
If AWS credentials are not explicitly provided in the configuration, the connector will automatically load credentials from the following sources in order.
-
Environment Variables:
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN (if using temporary credentials)
-
Shared AWS Config/Credentials Files:
-
Config file: ~/.aws/config (Linux/Mac) or %UserProfile%\.aws\config (Windows)
-
Credentials file: ~/.aws/credentials (Linux/Mac) or %UserProfile%\.aws\credentials (Windows)
-
The AWS_PROFILE environment variable can be used to specify a named profile, otherwise the [default] profile is used.
-
Supports both static credentials and SSO sessions
-
Example credentials file:
:::tip
To set up SSO authentication:
- Run
aws configure sso to configure a new SSO profile
- Use the profile by setting
AWS_PROFILE=sso-profile
- Run
aws sso login --profile sso-profile to start a new SSO session
:::
-
AWS STS Web Identity Token Credentials:
- Used primarily with OpenID Connect (OIDC) and OAuth
The connector will try each source in order until valid credentials are found. If no valid credentials are found, an authentication error will be returned.
:::note[IAM Permissions]
Regardless of the credential source, the IAM role or user must have appropriate S3 Vectors permissions (e.g., s3vectors:QueryVectors, s3vectors:GetVectors) to access the vectors. If the Spicepod connects to multiple different AWS services, the permissions should cover all of them.
:::
Required IAM Permissions
The IAM role or user needs the following minimum permissions to access S3 Vectors:
Permission Details
| Permission | Purpose |
|---|
s3vectors:DeleteVectors | Required. Used to remove vectors when rows are deleted from the dataset. |
s3vectors:GetIndex | Required. Used to verify if the index already exists or needs to be created. |
s3vectors:GetVectorBucket | Required. Used to verify if the vector bucket already exists or needs to be created. |
s3vectors:GetVectors | Required. Used to read vector data when the *_embeddings column is projected. |
s3vectors:ListIndexes | Required when using index partitioning or spill writes, to enumerate physical indexes. |
s3vectors:ListVectors | Required. Used to populate the *_embeddings column on vector tables in Spice. |
s3vectors:PutVectors | Required. Used to populate the vector index with Spice-computed embeddings. |
s3vectors:QueryVectors | Required. Used to query for vectors using the vector_search table function. |
s3vectors:CreateIndex | Optional. Spice can automatically create indexes if this permission is given. |
metrics
Spice supports the following S3 Vector engine metrics (opens in a new tab):
| Metric Name | Type | Description |
|---|
s3_vectors_create_index_errors | counter | Number of errors returned from create_index operation. |
s3_vectors_create_index_latency | histogram | Total duration of create_index operation, in milliseconds. |
s3_vectors_create_index_requests | counter | Number of requests to create_index operation. |
s3_vectors_create_vector_bucket_errors | counter | Number of errors returned from create_vector_bucket operation. |
s3_vectors_create_vector_bucket_latency | histogram | Total duration of create_vector_bucket operation, in milliseconds. |
s3_vectors_create_vector_bucket_requests | counter | Number of requests to create_vector_bucket operation. |
s3_vectors_delete_index_errors | counter | Number of errors returned from delete_index operation. |
s3_vectors_delete_index_latency | histogram | Total duration of delete_index operation, in milliseconds. |
s3_vectors_delete_index_requests | counter | Number of requests to delete_index operation. |
s3_vectors_delete_vector_bucket_errors |
Cookbook
References