Skip to content

Bedrock Knowledge Base with S3 Vectors: Troubleshooting IAM Permission Issues

3 minute read
Content level: Intermediate
0

This article outlines steps to troubleshoot IAM permission issues when creating Amazon Bedrock Knowledge Bases with S3 Vectors storage configuration.

Creating an Amazon Bedrock Knowledge Base with S3 Vectors requires careful configuration of IAM permissions and roles. This comprehensive guide will help you understand the required IAM Permissions, common issues, and solutions for successful knowledge base creation.


Understanding Service Role Requirements


When creating a Bedrock Knowledge Base with S3 Vectors, you have two options for service roles:

  1. AWS Console Auto-Creation: Let Amazon Bedrock automatically create a service role through the AWS Management Console
  2. Custom Role Creation: Create your own custom IAM role with specific permissions

Important Considerations for Service Roles


The automatically generated execution role for knowledge base created by Bedrock service when using the AWS Console is designed with specific IAM policies only for that role. When using CLI commands or SDK operations, it's recommended to create a custom role with appropriate permissions.

Important: The Amazon S3 Vectors integration with Amazon Bedrock Knowledge Bases is in preview release and is subject to change. Always refer to the latest AWS documentation for the most current requirements and best practices.


Required IAM Permissions


A custom IAM role for creating a knowledge base with S3 Vectors, should have following permissions:

1. Trust Relationship Policy

  • The trust relationship allows Amazon Bedrock service to assume the role and create and manage knowledge bases. Example Policy

2. Amazon Bedrock Model Access Permissions

  • The custom IAM role requires permissions to access foundation models for embedding operations Example Policy

3. S3 Data Source Access Permissions

  • For accessing the S3 bucket containing your source documents [2]: Example Policy

4. S3 Vectors Access Permissions

  • The most critical component for S3 Vectors integration is that the IAM role should have permissions to access to the S3 Vector Bucket and Vector Index. Example Policy

AWS CLI Command


Here's an example AWS CLI command for creating a knowledge base with S3 Vectors:

aws bedrock-agent create-knowledge-base \
  --name "my-s3-vectors-kb" \
  --description "Knowledge base with S3 vectors storage" \
  --role-arn "arn:aws:iam::123456789:role/KB_Creator" \
  --knowledge-base-configuration '{
    "type": "VECTOR",
    "vectorKnowledgeBaseConfiguration": {
      "embeddingModelArn": "arn:aws:bedrock:us-west-2::foundation-model/amazon.titan-embed-text-v2:0",
      "embeddingModelConfiguration": {
        "bedrockEmbeddingModelConfiguration": {
          "dimensions": 1024,
          "embeddingDataType": "FLOAT32"
        }
      }
    }
  }' \
  --storage-configuration '{
    "type": "S3_VECTORS",
    "s3VectorsConfiguration": {
      "vectorBucketArn": "arn:aws:s3vectors:us-west-2:123456789:bucket/<VECTOR_BUCKET_NAME>",
      "indexArn": "arn:aws:s3vectors:us-west-2:123456789:bucket/<VECTOR_BUCKET_NAME>/index/<VECTOR_INDEX_NAME>"
    }
  }' \
  --region us-west-2

Conclusion


Successfully creating a Bedrock Knowledge Base with S3 Vectors requires careful attention to IAM permissions, service role configuration, and security policies. By following the comprehensive permission structure outlined above and ensuring all prerequisites are met, you can avoid common permission-related errors and successfully deploy your knowledge base solution.