- Create a Boto3 session / client for the
s3vectorsservice. - List available vector buckets.
- List indexes inside a specific vector bucket.
s3vectors. This client provides methods such as list_vector_buckets, list_indexes, get_vectors, create_index, and create_vector_bucket (among others).
Do not hardcode production credentials in notebooks. Prefer environment variables, an AWS credentials file, or an IAM role (if running on AWS compute). Never commit secrets to source control.
Prerequisites
- Python 3.8+ installed
- Boto3 installed in your environment:
pip install boto3 - A user or role with permissions to call S3 Vector Bucket APIs
- Target vector bucket and index names you want to inspect
- Boto3 s3vectors API: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3vectors.html
- AWS credentials and configuration: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
Step 1 — Import and configure
Import the required libraries and set your credentials and target names. Replace placeholders with your own values or, better, load them from environment variables or a credentials file.Step 2 — Create a Boto3 session and s3vectors client
Create a Boto3 session and then instantiate ans3vectors client. You can also call boto3.client("s3vectors", ...) directly if you prefer not to use a session.
If you receive
AccessDenied or Unauthorized errors, verify the IAM policy attached to your user/role includes the required s3vectors actions and the resource ARNs are in scope for your region and account.Step 3 — List vector buckets
Uselist_vector_buckets() to retrieve the vector buckets accessible to the credentials in use. The API response keys may vary in capitalization across SDK versions, so handle common variants.
- Ensure the region in your session matches where the vector bucket is located.
- Confirm the IAM policy permits
s3vectors:ListVectorBuckets(and other needed actions). - Verify the vector bucket name you configured is exact.
Step 4 — List indexes within a vector bucket
A single S3 Vector Bucket may contain multiple indexes. Calllist_indexes() with the target vector bucket name to get its indexes.
get_vectors and index-level calls once you confirm the index names.
Common s3vectors operations
| Operation | Use case |
|---|---|
list_vector_buckets | Enumerate S3 Vector Buckets visible to the current credentials |
list_indexes | List all indexes inside a specific vector bucket |
get_vectors | Retrieve vectors (embedding results) from an index |
create_vector_bucket | Create a new S3 Vector Bucket for storing vectorized objects |
create_index | Build an index from content stored in a vector bucket |
delete_vector_bucket / delete_index | Remove resources when no longer needed |
