How do I resolve the “Failed to delete knowledge base” error in Amazon Bedrock?

3 minute read
-1

I want to resolve the “Failed to delete knowledge base” error in Amazon Bedrock.

Short description

When you delete an Amazon Bedrock knowledge base, you might receive the following error:

"Failed to delete example-knowledge-base. Unable to delete data from vector store for data source with example-id. Check your vector store configurations and permissions and retry your request. If the issue persists, consider updating the dataDeletionPolicy of the data source to RETAIN and retry your request."

This error occurs when you don't have permission to delete the data that's stored in the associated vector database, or the vector database doesn't exist. By default, the knowledge base data source has a data deletion policy that's set to Delete. This allows the associated vector database data to be deleted when the data source is deleted. If a data source doesn't have permission to delete the vector database data or the target database has been deleted, then the preceding error occurs.

Resolution

To resolve the Failed to delete knowledge base error, complete the following steps:

Set the data deletion policy to RETAIN

Complete the following steps:

  1. Open the Amazon Bedrock console.
  2. In the left navigation pane, select Knowledge bases.
  3. Choose the knowledge base that you can't delete.
  4. Select the data source that has a Delete unsuccessful status in the Knowledge base.
  5. Choose Edit. Then, choose Advanced settings.
  6. Set the Data deletion policy to Retain. Then, choose Submit.

Note: If you delete a data source when the deletion policy is set to Retain, then the associated vector database data isn't deleted.

Grant the necessary permissions to delete data

The Failed to delete knowledge base error also occurs for the following reasons:

  • The knowledge base service role doesn't have the required permissions to operate specific database APIs. Make sure that the required permissions are assigned to the AWS Identity and Access Management (IAM) service role.
  • The data source doesn't have the required resource base policy permissions to delete data from the vector database for the data source. Make sure the required permissions are granted to delete related data and complete the data source deletion.

To resolve your permission issues, complete one of the following methods based on the AWS service that you use for the vector database:

For Amazon OpenSearch Serverless, update the data access policy with the required permissions.

For Amazon Aurora PostgreSQL, run one of the following commands to grant permission to the primary user:

postgres=> GRANT pg_read_all_data, pg_write_all_data TO example-username;

Note Replace example-username with the primary user.

postgres=> GRANT SELECT, DELETE ON example-schema-name. example-table-name TO example-username;

Note Replace example-schema-name with the schema name, example-table-name with the table name, and example-username with the primary user.

For third-party databases, make sure that you have the required permissions for data deletion.

AWS OFFICIAL
AWS OFFICIALUpdated 12 days ago
2 Comments

This does not work. You said:

  1. Choose Edit. Then, choose Advanced settings.

However, there is no advanced settings option available.

tuptain
replied 8 days ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 8 days ago