Amazon S3 Vectors

2025/11/06 - Amazon S3 Vectors - 3 updated api methods

Changes  Amazon S3 Vectors provides cost-effective, elastic, and durable vector storage for queries based on semantic meaning and similarity.

CreateIndex (updated) Link ¶
Changes (response)
{'indexArn': 'string'}

Creates a vector index within a vector bucket. To specify the vector bucket, you must use either the vector bucket name or the vector bucket Amazon Resource Name (ARN).

Permissions

You must have the s3vectors:CreateIndex permission to use this operation.

See also: AWS API Documentation

Request Syntax

client.create_index(
    vectorBucketName='string',
    vectorBucketArn='string',
    indexName='string',
    dataType='float32',
    dimension=123,
    distanceMetric='euclidean'|'cosine',
    metadataConfiguration={
        'nonFilterableMetadataKeys': [
            'string',
        ]
    }
)
type vectorBucketName:

string

param vectorBucketName:

The name of the vector bucket to create the vector index in.

type vectorBucketArn:

string

param vectorBucketArn:

The Amazon Resource Name (ARN) of the vector bucket to create the vector index in.

type indexName:

string

param indexName:

[REQUIRED]

The name of the vector index to create.

type dataType:

string

param dataType:

[REQUIRED]

The data type of the vectors to be inserted into the vector index.

type dimension:

integer

param dimension:

[REQUIRED]

The dimensions of the vectors to be inserted into the vector index.

type distanceMetric:

string

param distanceMetric:

[REQUIRED]

The distance metric to be used for similarity search.

type metadataConfiguration:

dict

param metadataConfiguration:

The metadata configuration for the vector index.

  • nonFilterableMetadataKeys (list) -- [REQUIRED]

    Non-filterable metadata keys allow you to enrich vectors with additional context during storage and retrieval. Unlike default metadata keys, these keys can’t be used as query filters. Non-filterable metadata keys can be retrieved but can’t be searched, queried, or filtered. You can access non-filterable metadata keys of your vectors after finding the vectors. For more information about non-filterable metadata keys, see Vectors and Limitations and restrictions in the Amazon S3 User Guide.

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'indexArn': 'string'
}

Response Structure

  • (dict) --

    • indexArn (string) --

      The Amazon Resource Name (ARN) of the newly created vector index.

CreateVectorBucket (updated) Link ¶
Changes (response)
{'vectorBucketArn': 'string'}

Creates a vector bucket in the Amazon Web Services Region that you want your bucket to be in.

Permissions

You must have the s3vectors:CreateVectorBucket permission to use this operation.

See also: AWS API Documentation

Request Syntax

client.create_vector_bucket(
    vectorBucketName='string',
    encryptionConfiguration={
        'sseType': 'AES256'|'aws:kms',
        'kmsKeyArn': 'string'
    }
)
type vectorBucketName:

string

param vectorBucketName:

[REQUIRED]

The name of the vector bucket to create.

type encryptionConfiguration:

dict

param encryptionConfiguration:

The encryption configuration for the vector bucket. By default, if you don't specify, all new vectors in Amazon S3 vector buckets use server-side encryption with Amazon S3 managed keys (SSE-S3), specifically AES256.

  • sseType (string) --

    The server-side encryption type to use for the encryption configuration of the vector bucket. By default, if you don't specify, all new vectors in Amazon S3 vector buckets use server-side encryption with Amazon S3 managed keys (SSE-S3), specifically AES256.

  • kmsKeyArn (string) --

    Amazon Web Services Key Management Service (KMS) customer managed key ID to use for the encryption configuration. This parameter is allowed if and only if sseType is set to aws:kms.

    To specify the KMS key, you must use the format of the KMS key Amazon Resource Name (ARN).

    For example, specify Key ARN in the following format: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

rtype:

dict

returns:

Response Syntax

{
    'vectorBucketArn': 'string'
}

Response Structure

  • (dict) --

    • vectorBucketArn (string) --

      The Amazon Resource Name (ARN) of the newly created vector bucket.

QueryVectors (updated) Link ¶
Changes (response)
{'distanceMetric': 'euclidean | cosine'}

Performs an approximate nearest neighbor search query in a vector index using a query vector. By default, it returns the keys of approximate nearest neighbors. You can optionally include the computed distance (between the query vector and each vector in the response), the vector data, and metadata of each vector in the response.

To specify the vector index, you can either use both the vector bucket name and the vector index name, or use the vector index Amazon Resource Name (ARN).

Permissions

You must have the s3vectors:QueryVectors permission to use this operation. Additional permissions are required based on the request parameters you specify:

  • With only s3vectors:QueryVectors permission, you can retrieve vector keys of approximate nearest neighbors and computed distances between these vectors. This permission is sufficient only when you don't set any metadata filters and don't request vector data or metadata (by keeping the returnMetadata parameter set to false or not specified).

  • If you specify a metadata filter or set returnMetadata to true, you must have both s3vectors:QueryVectors and s3vectors:GetVectors permissions. The request fails with a 403 Forbidden error if you request metadata filtering, vector data, or metadata without the s3vectors:GetVectors permission.

See also: AWS API Documentation

Request Syntax

client.query_vectors(
    vectorBucketName='string',
    indexName='string',
    indexArn='string',
    topK=123,
    queryVector={
        'float32': [
            ...,
        ]
    },
    filter={...}|[...]|123|123.4|'string'|True|None,
    returnMetadata=True|False,
    returnDistance=True|False
)
type vectorBucketName:

string

param vectorBucketName:

The name of the vector bucket that contains the vector index.

type indexName:

string

param indexName:

The name of the vector index that you want to query.

type indexArn:

string

param indexArn:

The ARN of the vector index that you want to query.

type topK:

integer

param topK:

[REQUIRED]

The number of results to return for each query.

type queryVector:

dict

param queryVector:

[REQUIRED]

The query vector. Ensure that the query vector has the same dimension as the dimension of the vector index that's being queried. For example, if your vector index contains vectors with 384 dimensions, your query vector must also have 384 dimensions.

  • float32 (list) --

    The vector data as 32-bit floating point numbers. The number of elements in this array must exactly match the dimension of the vector index where the operation is being performed.

    • (float) --

type filter:

:ref:`document<document>`

param filter:

Metadata filter to apply during the query. For more information about metadata keys, see Metadata filtering in the Amazon S3 User Guide.

type returnMetadata:

boolean

param returnMetadata:

Indicates whether to include metadata in the response. The default value is false.

type returnDistance:

boolean

param returnDistance:

Indicates whether to include the computed distance in the response. The default value is false.

rtype:

dict

returns:

Response Syntax

{
    'vectors': [
        {
            'key': 'string',
            'data': {
                'float32': [
                    ...,
                ]
            },
            'metadata': {...}|[...]|123|123.4|'string'|True|None,
            'distance': ...
        },
    ],
    'distanceMetric': 'euclidean'|'cosine'
}

Response Structure

  • (dict) --

    • vectors (list) --

      The vectors in the approximate nearest neighbor search.

      • (dict) --

        The attributes of a vector in the approximate nearest neighbor search.

        • key (string) --

          The key of the vector in the approximate nearest neighbor search.

        • data (dict) --

          The vector data associated with the vector, if requested.

          • float32 (list) --

            The vector data as 32-bit floating point numbers. The number of elements in this array must exactly match the dimension of the vector index where the operation is being performed.

            • (float) --

        • metadata (:ref:`document<document>`) --

          The metadata associated with the vector, if requested.

        • distance (float) --

          The measure of similarity between the vector in the response and the query vector.

    • distanceMetric (string) --

      The distance metric that was used for the similarity search calculation. This is the same distance metric that was configured for the vector index when it was created.