Skip to main content
Welcome back. In this lesson you’ll learn how to programmatically access S3 Vector Buckets from a Jupyter notebook using Python and Boto3. This builds on prior work creating an IAM policy and attaching it to a user — those permissions are required to query vector buckets and indexes. What you’ll accomplish
  • Create a Boto3 session / client for the s3vectors service.
  • List available vector buckets.
  • List indexes inside a specific vector bucket.
S3 Vector Buckets use a dedicated Boto3 client, typically exposed as 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
Helpful references:

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 an s3vectors 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

Use list_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.
Common troubleshooting tips
  • 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. Call list_indexes() with the target vector bucket name to get its indexes.
This prints the number of indexes found for the specified vector bucket and a short preview of the returned objects. Use get_vectors and index-level calls once you confirm the index names.

Common s3vectors operations

For the full list of methods, parameter shapes, and response structures see the Boto3 s3vectors documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3vectors.html
The image shows a section of the AWS Boto3 documentation page, listing available methods for managing S3 vectors, alongside navigation links on the left sidebar.
You can also embed text or documents into a vector bucket and create an index from that content — that workflow will be covered in a follow-up tutorial.

Watch Video