Amazon S3 Vectors is cloud object storage with native support for storing and querying vectors. It is built for large vector datasets that do not need the high-throughput, low-latency profile of an in-memory vector database, and it requires no infrastructure to provision.This page covers how to use the
AmazonS3Vectors vector store from the langchain-aws package.
Setup
Installation
AmazonS3Vectors requires langchain-aws>=0.2.31.Create a vector bucket
You must create an S3 vector bucket before using this store. The vector index is created for you on first write unless you passcreate_index_if_not_exist=False.
s3vectors:CreateVectorBucket permission. For more detail, see Getting started with S3 Vectors.
Credentials
The store uses the standard AWS credential chain. You can also passregion_name, credentials_profile_name, or an existing boto3 client.
Initialization
Manage vector store
Add items
Delete items
Get items by ID
If any requested ID is missing,
get_by_ids raises ValueError and returns nothing, rather than returning the subset it found.Query
Similarity search
Similarity search with score
The score returned is a distance, so lower values indicate a closer match.Metadata filtering
Filters use the S3 Vectors filter syntax:Search by vector
Configuration
Distance metric
distance_metric accepts cosine (the default) or euclidean. It is fixed when the index is created, so changing it afterwards has no effect on an existing index.
Non-filterable metadata
Metadata keys listed innon_filterable_metadata_keys are stored and returned with the document, but cannot be used in filters. Filtering on one raises a ValidationException. This is set when the index is created.
Page content storage
By default the document text is stored in metadata under the_page_content key. Set page_content_metadata_key to change that key, or to None to embed the text without storing it, in which case retrieved documents have an empty page_content.
Metadata is subject to the S3 Vectors limitations and restrictions, including a 40 KB total metadata limit per vector.
Use as a retriever
API reference
For detailed documentation of all features and configuration options, see theAmazonS3Vectors API reference.
Connect these docs to your agent of choice via MCP for real-time answers.

