Skip to content
v2.277.0

Experimental

@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

KnowledgeBaseAttributes Struct ​

Attributes for referencing an existing knowledge base.

Example ​

ts
declare const role: iam.Role;

const byArn = bedrock.KnowledgeBase.fromKnowledgeBaseArn(this, 'ImportedByArn',
  'arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678');

// Assumed to be in the same account and region as this stack
const byId = bedrock.KnowledgeBase.fromKnowledgeBaseId(this, 'ImportedById', 'KB12345678');

const withRole = bedrock.KnowledgeBase.fromKnowledgeBaseAttributes(this, 'ImportedWithRole', {
  knowledgeBaseArn: 'arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678',
  role,
});
python
# role: iam.Role


by_arn = bedrock.KnowledgeBase.from_knowledge_base_arn(self, "ImportedByArn", "arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678")

# Assumed to be in the same account and region as this stack
by_id = bedrock.KnowledgeBase.from_knowledge_base_id(self, "ImportedById", "KB12345678")

with_role = bedrock.KnowledgeBase.from_knowledge_base_attributes(self, "ImportedWithRole",
    knowledge_base_arn="arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678",
    role=role
)
java
Role role;


IKnowledgeBase byArn = KnowledgeBase.fromKnowledgeBaseArn(this, "ImportedByArn", "arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678");

// Assumed to be in the same account and region as this stack
IKnowledgeBase byId = KnowledgeBase.fromKnowledgeBaseId(this, "ImportedById", "KB12345678");

IKnowledgeBase withRole = KnowledgeBase.fromKnowledgeBaseAttributes(this, "ImportedWithRole", KnowledgeBaseAttributes.builder()
        .knowledgeBaseArn("arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678")
        .role(role)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Alpha
Role role;


var byArn = KnowledgeBase.FromKnowledgeBaseArn(this, "ImportedByArn", "arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678");

// Assumed to be in the same account and region as this stack
var byId = KnowledgeBase.FromKnowledgeBaseId(this, "ImportedById", "KB12345678");

var withRole = KnowledgeBase.FromKnowledgeBaseAttributes(this, "ImportedWithRole", new KnowledgeBaseAttributes {
    KnowledgeBaseArn = "arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678",
    Role = role
});
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockalpha/v2
var role Role


byArn := bedrock.KnowledgeBase_FromKnowledgeBaseArn(this, jsii.String("ImportedByArn"), jsii.String("arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678"))

// Assumed to be in the same account and region as this stack
byId := bedrock.KnowledgeBase_FromKnowledgeBaseId(this, jsii.String("ImportedById"), jsii.String("KB12345678"))

withRole := bedrock.KnowledgeBase_FromKnowledgeBaseAttributes(this, jsii.String("ImportedWithRole"), &KnowledgeBaseAttributes{
	KnowledgeBaseArn: jsii.String("arn:aws:bedrock:us-east-1:123456789012:knowledge-base/KB12345678"),
	Role: Role,
})

Properties ​

knowledgeBaseArnstringknowledge_base_arnstrknowledgeBaseArnStringKnowledgeBaseArnstringKnowledgeBaseArn*string required #
The ARN of the knowledge base.
roleoptionalanyroleoptionalanyroleoptionalanyRoleoptionalanyRoleoptionalany #
The service role of the knowledge base.

Default: the role is unknown