knowledge_bases
Creates, updates, deletes or gets a knowledge_base resource or lists knowledge_bases in a region
Overview
| Name | knowledge_bases |
| Type | Resource |
| Description | Definition of AWS::Bedrock::KnowledgeBase Resource Type |
| Id | awscc.bedrock.knowledge_bases |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
description | string | Description of the Resource. |
knowledge_base_configuration | object | Contains details about the embeddings model used for the knowledge base. |
knowledge_base_id | string | The unique identifier of the knowledge base. |
knowledge_base_arn | string | The ARN of the knowledge base. |
name | string | The name of the knowledge base. |
status | string | The status of a knowledge base. |
role_arn | string | The ARN of the IAM role with permissions to invoke API operations on the knowledge base. The ARN must begin with AmazonBedrockExecutionRoleForKnowledgeBase_ |
created_at | string | The time at which the knowledge base was created. |
failure_reasons | array | A list of reasons that the API operation on the knowledge base failed. |
updated_at | string | The time at which the knowledge base was last updated. |
storage_configuration | object | The vector store service in which the knowledge base is stored. |
tags | object | A map of tag keys and values |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
knowledge_base_id | string | The unique identifier of the knowledge base. |
region | string | AWS region. |
For more information, see AWS::Bedrock::KnowledgeBase.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | knowledge_bases | INSERT | KnowledgeBaseConfiguration, Name, RoleArn, region |
delete_resource | knowledge_bases | DELETE | Identifier, region |
update_resource | knowledge_bases | UPDATE | Identifier, PatchDocument, region |
list_resources | knowledge_bases_list_only | SELECT | region |
get_resource | knowledge_bases | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual knowledge_base.
SELECT
region,
description,
knowledge_base_configuration,
knowledge_base_id,
knowledge_base_arn,
name,
status,
role_arn,
created_at,
failure_reasons,
updated_at,
storage_configuration,
tags
FROM awscc.bedrock.knowledge_bases
WHERE
region = 'us-east-1' AND
Identifier = '{{ knowledge_base_id }}';
Lists all knowledge_bases in a region.
SELECT
region,
knowledge_base_id
FROM awscc.bedrock.knowledge_bases_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new knowledge_base resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.bedrock.knowledge_bases (
KnowledgeBaseConfiguration,
Name,
RoleArn,
region
)
SELECT
'{{ knowledge_base_configuration }}',
'{{ name }}',
'{{ role_arn }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.bedrock.knowledge_bases (
Description,
KnowledgeBaseConfiguration,
Name,
RoleArn,
StorageConfiguration,
Tags,
region
)
SELECT
'{{ description }}',
'{{ knowledge_base_configuration }}',
'{{ name }}',
'{{ role_arn }}',
'{{ storage_configuration }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: knowledge_base
props:
- name: description
value: '{{ description }}'
- name: knowledge_base_configuration
value:
type: '{{ type }}'
vector_knowledge_base_configuration:
embedding_model_arn: '{{ embedding_model_arn }}'
embedding_model_configuration:
bedrock_embedding_model_configuration:
dimensions: '{{ dimensions }}'
embedding_data_type: '{{ embedding_data_type }}'
supplemental_data_storage_configuration:
supplemental_data_storage_locations:
- supplemental_data_storage_location_type: '{{ supplemental_data_storage_location_type }}'
s3_location:
uri: '{{ uri }}'
kendra_knowledge_base_configuration:
kendra_index_arn: '{{ kendra_index_arn }}'
sql_knowledge_base_configuration:
type: '{{ type }}'
redshift_configuration:
storage_configurations:
- type: '{{ type }}'
aws_data_catalog_configuration:
table_names:
- '{{ table_names[0] }}'
redshift_configuration:
database_name: '{{ database_name }}'
query_engine_configuration:
type: '{{ type }}'
serverless_configuration:
workgroup_arn: '{{ workgroup_arn }}'
auth_configuration:
type: '{{ type }}'
username_password_secret_arn: '{{ username_password_secret_arn }}'
provisioned_configuration:
cluster_identifier: '{{ cluster_identifier }}'
auth_configuration:
type: '{{ type }}'
database_user: '{{ database_user }}'
username_password_secret_arn: null
query_generation_configuration:
execution_timeout_seconds: '{{ execution_timeout_seconds }}'
generation_context:
tables:
- name: '{{ name }}'
description: '{{ description }}'
inclusion: '{{ inclusion }}'
columns:
- name: '{{ name }}'
description: null
inclusion: null
curated_queries:
- natural_language: '{{ natural_language }}'
sql: '{{ sql }}'
- name: name
value: '{{ name }}'
- name: role_arn
value: '{{ role_arn }}'
- name: storage_configuration
value:
type: '{{ type }}'
opensearch_serverless_configuration:
collection_arn: '{{ collection_arn }}'
vector_index_name: '{{ vector_index_name }}'
field_mapping:
vector_field: '{{ vector_field }}'
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
pinecone_configuration:
connection_string: '{{ connection_string }}'
credentials_secret_arn: '{{ credentials_secret_arn }}'
namespace: '{{ namespace }}'
field_mapping:
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
rds_configuration:
resource_arn: '{{ resource_arn }}'
credentials_secret_arn: '{{ credentials_secret_arn }}'
database_name: '{{ database_name }}'
table_name: '{{ table_name }}'
field_mapping:
primary_key_field: '{{ primary_key_field }}'
vector_field: '{{ vector_field }}'
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
custom_metadata_field: '{{ custom_metadata_field }}'
mongo_db_atlas_configuration:
endpoint: '{{ endpoint }}'
credentials_secret_arn: '{{ credentials_secret_arn }}'
database_name: '{{ database_name }}'
collection_name: '{{ collection_name }}'
vector_index_name: '{{ vector_index_name }}'
text_index_name: '{{ text_index_name }}'
endpoint_service_name: '{{ endpoint_service_name }}'
field_mapping:
vector_field: '{{ vector_field }}'
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
neptune_analytics_configuration:
graph_arn: '{{ graph_arn }}'
field_mapping:
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
opensearch_managed_cluster_configuration:
domain_arn: '{{ domain_arn }}'
domain_endpoint: '{{ domain_endpoint }}'
vector_index_name: '{{ vector_index_name }}'
field_mapping:
vector_field: '{{ vector_field }}'
text_field: '{{ text_field }}'
metadata_field: '{{ metadata_field }}'
- name: tags
value: {}
UPDATE example
Use the following StackQL query and manifest file to update a knowledge_base resource, using stack-deploy.
/*+ update */
UPDATE awscc.bedrock.knowledge_bases
SET PatchDocument = string('{{ {
"Description": description,
"Name": name,
"RoleArn": role_arn,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ knowledge_base_id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.bedrock.knowledge_bases
WHERE
Identifier = '{{ knowledge_base_id }}' AND
region = 'us-east-1';
Permissions
To operate on the knowledge_bases resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
bedrock:CreateKnowledgeBase,
bedrock:GetKnowledgeBase,
bedrock:TagResource,
bedrock:ListTagsForResource,
bedrock:AssociateThirdPartyKnowledgeBase,
iam:PassRole
bedrock:GetKnowledgeBase,
bedrock:ListTagsForResource
bedrock:GetKnowledgeBase,
bedrock:UpdateKnowledgeBase,
bedrock:TagResource,
bedrock:UntagResource,
bedrock:ListTagsForResource,
bedrock:AssociateThirdPartyKnowledgeBase,
iam:PassRole
bedrock:GetKnowledgeBase,
bedrock:DeleteKnowledgeBase,
bedrock:ListDataSources
bedrock:ListKnowledgeBases