Skip to main content

knowledge_bases

Creates, updates, deletes, gets or lists a knowledge_bases resource.

Overview

Nameknowledge_bases
TypeResource
Idaws.bedrock_agent.knowledge_bases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the knowledge base. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>)
created_atstring (date-time)The time the knowledge base was created.
descriptionstringThe description of the knowledge base.
failure_reasonsarrayA list of reasons that the API operation on the knowledge base failed.
knowledge_base_arnstringThe Amazon Resource Name (ARN) of the knowledge base. (pattern: <code>arn:aws(|-cn|-us-gov):bedrock:[a-zA-Z0-9-]*:[0-9]{12}:knowledge-base/[0-9a-zA-Z]+</code>)
knowledge_base_configurationobjectContains details about the vector embeddings configuration of the knowledge base.
knowledge_base_idstringThe unique identifier of the knowledge base. (pattern: <code>[0-9a-zA-Z]{10}</code>)
role_arnstringThe Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the knowledge base. (pattern: <code>arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/.+</code>)
statusstringThe status of the knowledge base. The following statuses are possible: CREATING – The knowledge base is being created. ACTIVE – The knowledge base is ready to be queried. DELETING – The knowledge base is being deleted. UPDATING – The knowledge base is being updated. FAILED – The knowledge base API operation failed. (CREATING, ACTIVE, DELETING, UPDATING, FAILED, DELETE_UNSUCCESSFUL, UPDATE_UNSUCCESSFUL)
storage_configurationobjectContains the storage configuration of the knowledge base.
updated_atstring (date-time)The time the knowledge base was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_knowledge_baseselectknowledge_base_id, regionGets information about a knowledge base.
list_knowledge_basesselectregionLists the knowledge bases in an account. The list also includesinformation about each knowledge base.
create_knowledge_baseinsertregion, name, roleArn, knowledgeBaseConfigurationCreates a knowledge base. A knowledge base contains your data sources so that Large Language Models (LLMs) can use your data. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see Set up a knowledge base. To create a managed knowledge base, provide a managedKnowledgeBaseConfiguration during creation. For more information, see Build a managed knowledge base. Provide the name and an optional description. Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the roleArn field. For managed knowledge bases, set embeddingModelType to MANAGED to use the service-managed embedding model, or CUSTOM with an embeddingModelArn to use your own. To use your own KMS key for encryption, provide the ARN in serverSideEncryptionConfiguration. No vector store configuration is required for managed knowledge bases. For self-managed knowledge bases, provide the embedding model to use in the embeddingModelArn field in the knowledgeBaseConfiguration object. For self-managed knowledge bases, provide the configuration for your vector store in the storageConfiguration object. For an Amazon OpenSearch Service database, use the opensearchServerlessConfiguration object. For more information, see Create a vector store in Amazon OpenSearch Service. For an Amazon Aurora database, use the RdsConfiguration object. For more information, see Create a vector store in Amazon Aurora. For a Pinecone database, use the pineconeConfiguration object. For more information, see Create a vector store in Pinecone. For a Redis Enterprise Cloud database, use the redisEnterpriseCloudConfiguration object. For more information, see Create a vector store in Redis Enterprise Cloud.
update_knowledge_baseupdateknowledge_base_id, region, name, roleArn, knowledgeBaseConfigurationUpdates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same. You can change the following fields: name description roleArn You can't change the knowledgeBaseConfiguration or storageConfiguration fields, so you must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations.
delete_knowledge_basedeleteknowledge_base_id, regionDeletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a DisassociateAgentKnowledgeBase request.
start_ingestion_jobexecknowledge_base_id, data_source_id, regionBegins a data ingestion job. Data sources are ingested into your knowledge base so that Large Language Models (LLMs) can use your data.
stop_ingestion_jobexecknowledge_base_id, data_source_id, ingestion_job_id, regionStops a currently running data ingestion job. You can send a StartIngestionJob request again to ingest the rest of your data when you are ready.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
data_source_idstringThe unique identifier of the data source for the data ingestion job you want to stop.
ingestion_job_idstringThe unique identifier of the data ingestion job you want to stop.
knowledge_base_idstringThe unique identifier of the knowledge base for the data ingestion job you want to stop.
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about a knowledge base.

SELECT
name,
created_at,
description,
failure_reasons,
knowledge_base_arn,
knowledge_base_configuration,
knowledge_base_id,
role_arn,
status,
storage_configuration,
updated_at
FROM aws.bedrock_agent.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a knowledge base. A knowledge base contains your data sources so that Large Language Models (LLMs) can use your data. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see Set up a knowledge base. To create a managed knowledge base, provide a managedKnowledgeBaseConfiguration during creation. For more information, see Build a managed knowledge base. Provide the name and an optional description. Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the roleArn field. For managed knowledge bases, set embeddingModelType to MANAGED to use the service-managed embedding model, or CUSTOM with an embeddingModelArn to use your own. To use your own KMS key for encryption, provide the ARN in serverSideEncryptionConfiguration. No vector store configuration is required for managed knowledge bases. For self-managed knowledge bases, provide the embedding model to use in the embeddingModelArn field in the knowledgeBaseConfiguration object. For self-managed knowledge bases, provide the configuration for your vector store in the storageConfiguration object. For an Amazon OpenSearch Service database, use the opensearchServerlessConfiguration object. For more information, see Create a vector store in Amazon OpenSearch Service. For an Amazon Aurora database, use the RdsConfiguration object. For more information, see Create a vector store in Amazon Aurora. For a Pinecone database, use the pineconeConfiguration object. For more information, see Create a vector store in Pinecone. For a Redis Enterprise Cloud database, use the redisEnterpriseCloudConfiguration object. For more information, see Create a vector store in Redis Enterprise Cloud.

INSERT INTO aws.bedrock_agent.knowledge_bases (
clientToken,
name,
description,
roleArn,
knowledgeBaseConfiguration,
storageConfiguration,
tags,
region
)
SELECT
'{{ clientToken }}',
'{{ name }}' /* required */,
'{{ description }}',
'{{ roleArn }}' /* required */,
'{{ knowledgeBaseConfiguration }}' /* required */,
'{{ storageConfiguration }}',
'{{ tags }}',
'{{ region }}'
RETURNING
knowledge_base
;

UPDATE examples

Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be overwritten, you must include the same values for fields that you want to keep the same. You can change the following fields: name description roleArn You can't change the knowledgeBaseConfiguration or storageConfiguration fields, so you must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations.

UPDATE aws.bedrock_agent.knowledge_bases
SET
name = '{{ name }}',
description = '{{ description }}',
roleArn = '{{ roleArn }}',
knowledgeBaseConfiguration = '{{ knowledgeBaseConfiguration }}',
storageConfiguration = '{{ storageConfiguration }}'
WHERE
knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
AND name = '{{ name }}' --required
AND roleArn = '{{ roleArn }}' --required
AND knowledgeBaseConfiguration = '{{ knowledgeBaseConfiguration }}' --required
RETURNING
knowledge_base;

DELETE examples

Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any agents that it is associated with by making a DisassociateAgentKnowledgeBase request.

DELETE FROM aws.bedrock_agent.knowledge_bases
WHERE knowledge_base_id = '{{ knowledge_base_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Begins a data ingestion job. Data sources are ingested into your knowledge base so that Large Language Models (LLMs) can use your data.

EXEC aws.bedrock_agent.knowledge_bases.start_ingestion_job
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@data_source_id='{{ data_source_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"clientToken": "{{ clientToken }}",
"description": "{{ description }}"
}'
;