Class CfnKnowledgeBase

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.109.0 (build c221850)", date="2025-03-19T18:01:30.871Z") @Stability(Stable) public class CfnKnowledgeBase extends CfnResource implements IInspectable, ITaggableV2
Specifies a knowledge base as a resource in a top-level template. Minimally, you must specify the following properties:.

  • Name – Specify a name for the knowledge base.
  • RoleArn – Specify the Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base. For more information, see Create a service role for Knowledge base for Amazon Bedrock .
  • KnowledgeBaseConfiguration – Specify the embeddings configuration of the knowledge base. The following sub-properties are required:
  • Type – Specify the value VECTOR .
  • StorageConfiguration – Specify information about the vector store in which the data source is stored. The following sub-properties are required:
  • Type – Specify the vector store service that you are using.

Redis Enterprise Cloud vector stores are currently unsupported in AWS CloudFormation .

For more information about using knowledge bases in Amazon Bedrock , see Knowledge base for Amazon Bedrock .

See the Properties section below for descriptions of both the required and optional properties.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.bedrock.*;
 CfnKnowledgeBase cfnKnowledgeBase = CfnKnowledgeBase.Builder.create(this, "MyCfnKnowledgeBase")
         .knowledgeBaseConfiguration(KnowledgeBaseConfigurationProperty.builder()
                 .type("type")
                 // the properties below are optional
                 .kendraKnowledgeBaseConfiguration(KendraKnowledgeBaseConfigurationProperty.builder()
                         .kendraIndexArn("kendraIndexArn")
                         .build())
                 .sqlKnowledgeBaseConfiguration(SqlKnowledgeBaseConfigurationProperty.builder()
                         .type("type")
                         // the properties below are optional
                         .redshiftConfiguration(RedshiftConfigurationProperty.builder()
                                 .queryEngineConfiguration(RedshiftQueryEngineConfigurationProperty.builder()
                                         .type("type")
                                         // the properties below are optional
                                         .provisionedConfiguration(RedshiftProvisionedConfigurationProperty.builder()
                                                 .authConfiguration(RedshiftProvisionedAuthConfigurationProperty.builder()
                                                         .type("type")
                                                         // the properties below are optional
                                                         .databaseUser("databaseUser")
                                                         .usernamePasswordSecretArn("usernamePasswordSecretArn")
                                                         .build())
                                                 .clusterIdentifier("clusterIdentifier")
                                                 .build())
                                         .serverlessConfiguration(RedshiftServerlessConfigurationProperty.builder()
                                                 .authConfiguration(RedshiftServerlessAuthConfigurationProperty.builder()
                                                         .type("type")
                                                         // the properties below are optional
                                                         .usernamePasswordSecretArn("usernamePasswordSecretArn")
                                                         .build())
                                                 .workgroupArn("workgroupArn")
                                                 .build())
                                         .build())
                                 .storageConfigurations(List.of(RedshiftQueryEngineStorageConfigurationProperty.builder()
                                         .type("type")
                                         // the properties below are optional
                                         .awsDataCatalogConfiguration(RedshiftQueryEngineAwsDataCatalogStorageConfigurationProperty.builder()
                                                 .tableNames(List.of("tableNames"))
                                                 .build())
                                         .redshiftConfiguration(RedshiftQueryEngineRedshiftStorageConfigurationProperty.builder()
                                                 .databaseName("databaseName")
                                                 .build())
                                         .build()))
                                 // the properties below are optional
                                 .queryGenerationConfiguration(QueryGenerationConfigurationProperty.builder()
                                         .executionTimeoutSeconds(123)
                                         .generationContext(QueryGenerationContextProperty.builder()
                                                 .curatedQueries(List.of(CuratedQueryProperty.builder()
                                                         .naturalLanguage("naturalLanguage")
                                                         .sql("sql")
                                                         .build()))
                                                 .tables(List.of(QueryGenerationTableProperty.builder()
                                                         .name("name")
                                                         // the properties below are optional
                                                         .columns(List.of(QueryGenerationColumnProperty.builder()
                                                                 .description("description")
                                                                 .inclusion("inclusion")
                                                                 .name("name")
                                                                 .build()))
                                                         .description("description")
                                                         .inclusion("inclusion")
                                                         .build()))
                                                 .build())
                                         .build())
                                 .build())
                         .build())
                 .vectorKnowledgeBaseConfiguration(VectorKnowledgeBaseConfigurationProperty.builder()
                         .embeddingModelArn("embeddingModelArn")
                         // the properties below are optional
                         .embeddingModelConfiguration(EmbeddingModelConfigurationProperty.builder()
                                 .bedrockEmbeddingModelConfiguration(BedrockEmbeddingModelConfigurationProperty.builder()
                                         .dimensions(123)
                                         .embeddingDataType("embeddingDataType")
                                         .build())
                                 .build())
                         .supplementalDataStorageConfiguration(SupplementalDataStorageConfigurationProperty.builder()
                                 .supplementalDataStorageLocations(List.of(SupplementalDataStorageLocationProperty.builder()
                                         .supplementalDataStorageLocationType("supplementalDataStorageLocationType")
                                         // the properties below are optional
                                         .s3Location(S3LocationProperty.builder()
                                                 .uri("uri")
                                                 .build())
                                         .build()))
                                 .build())
                         .build())
                 .build())
         .name("name")
         .roleArn("roleArn")
         // the properties below are optional
         .description("description")
         .storageConfiguration(StorageConfigurationProperty.builder()
                 .type("type")
                 // the properties below are optional
                 .opensearchServerlessConfiguration(OpenSearchServerlessConfigurationProperty.builder()
                         .collectionArn("collectionArn")
                         .fieldMapping(OpenSearchServerlessFieldMappingProperty.builder()
                                 .metadataField("metadataField")
                                 .textField("textField")
                                 .vectorField("vectorField")
                                 .build())
                         .vectorIndexName("vectorIndexName")
                         .build())
                 .pineconeConfiguration(PineconeConfigurationProperty.builder()
                         .connectionString("connectionString")
                         .credentialsSecretArn("credentialsSecretArn")
                         .fieldMapping(PineconeFieldMappingProperty.builder()
                                 .metadataField("metadataField")
                                 .textField("textField")
                                 .build())
                         // the properties below are optional
                         .namespace("namespace")
                         .build())
                 .rdsConfiguration(RdsConfigurationProperty.builder()
                         .credentialsSecretArn("credentialsSecretArn")
                         .databaseName("databaseName")
                         .fieldMapping(RdsFieldMappingProperty.builder()
                                 .metadataField("metadataField")
                                 .primaryKeyField("primaryKeyField")
                                 .textField("textField")
                                 .vectorField("vectorField")
                                 .build())
                         .resourceArn("resourceArn")
                         .tableName("tableName")
                         .build())
                 .build())
         .tags(Map.of(
                 "tagsKey", "tags"))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnKnowledgeBase

      protected CfnKnowledgeBase(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnKnowledgeBase

      protected CfnKnowledgeBase(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnKnowledgeBase

      @Stability(Stable) public CfnKnowledgeBase(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnKnowledgeBaseProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrCreatedAt

      @Stability(Stable) @NotNull public String getAttrCreatedAt()
      The time the knowledge base was created.
    • getAttrFailureReasons

      @Stability(Stable) @NotNull public List<String> getAttrFailureReasons()
      A list of reasons that the API operation on the knowledge base failed.
    • getAttrKnowledgeBaseArn

      @Stability(Stable) @NotNull public String getAttrKnowledgeBaseArn()
      The Amazon Resource Name (ARN) of the knowledge base.
    • getAttrKnowledgeBaseId

      @Stability(Stable) @NotNull public String getAttrKnowledgeBaseId()
      The unique identifier for a knowledge base associated with the inline agent.
    • getAttrStatus

      @Stability(Stable) @NotNull public String getAttrStatus()
      The status of the knowledge base.
    • getAttrUpdatedAt

      @Stability(Stable) @NotNull public String getAttrUpdatedAt()
      The time the knowledge base was last updated.
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getKnowledgeBaseConfiguration

      @Stability(Stable) @NotNull public Object getKnowledgeBaseConfiguration()
      Contains details about the embeddings configuration of the knowledge base.
    • setKnowledgeBaseConfiguration

      @Stability(Stable) public void setKnowledgeBaseConfiguration(@NotNull IResolvable value)
      Contains details about the embeddings configuration of the knowledge base.
    • setKnowledgeBaseConfiguration

      @Stability(Stable) public void setKnowledgeBaseConfiguration(@NotNull CfnKnowledgeBase.KnowledgeBaseConfigurationProperty value)
      Contains details about the embeddings configuration of the knowledge base.
    • getName

      @Stability(Stable) @NotNull public String getName()
      The name of the knowledge base.
    • setName

      @Stability(Stable) public void setName(@NotNull String value)
      The name of the knowledge base.
    • getRoleArn

      @Stability(Stable) @NotNull public String getRoleArn()
      The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.
    • setRoleArn

      @Stability(Stable) public void setRoleArn(@NotNull String value)
      The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the knowledge base associated with the inline agent.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the knowledge base associated with the inline agent.
    • getStorageConfiguration

      @Stability(Stable) @Nullable public Object getStorageConfiguration()
      Contains details about the storage configuration of the knowledge base.
    • setStorageConfiguration

      @Stability(Stable) public void setStorageConfiguration(@Nullable IResolvable value)
      Contains details about the storage configuration of the knowledge base.
    • setStorageConfiguration

      @Stability(Stable) public void setStorageConfiguration(@Nullable CfnKnowledgeBase.StorageConfigurationProperty value)
      Contains details about the storage configuration of the knowledge base.
    • getTags

      @Stability(Stable) @Nullable public Map<String,String> getTags()
      Metadata that you can assign to a resource as key-value pairs.

      For more information, see the following resources:.

    • setTags

      @Stability(Stable) public void setTags(@Nullable Map<String,String> value)
      Metadata that you can assign to a resource as key-value pairs.

      For more information, see the following resources:.