Overview
The AWS Bedrock Knowledge Base tools let you query an existing AWS Bedrock Knowledge Base — either retrieving raw documents or generating a RAG answer — and sync new PDF documents into its S3 data source.Key Features
-
AWS_BEDROCK_KNOWLEDGE_BASE- Query an AWS Bedrock Knowledge Base with a natural language
query. - Two modes (set via the
modeconfig):retrievereturns raw retrieval results (content, source location, score, metadata), whileretrieveAndGenerate(default) returns an LLM-generated response with source citations. numberOfResultscontrols how many documents are retrieved (1–100, default 5).- In
retrievemode, the output also reportsguardrailAction(INTERVENEDorNONE) when guardrails are configured.
- Query an AWS Bedrock Knowledge Base with a natural language
-
AWS_BEDROCK_KNOWLEDGE_BASE_PDF_SYNC- Upload a PDF to the S3 data source of an existing Bedrock Knowledge Base and start an ingestion job.
pdfinput accepts a base64 string, a data URL (data:application/pdf;base64,...), or a public HTTPS URL.- Deduplicates by content: the object key is derived from the SHA-256 hash of the PDF, and if the same content already exists in S3, the upload and ingestion are skipped (
skipped: true). - Optionally waits for the ingestion job to finish (
waitForIngestion, defaulttrue) with a configurable timeout (ingestionTimeoutSeconds, 30–1800, default 300) and polling interval (ingestionPollIntervalSeconds, 1–60, default 5). - Output includes the S3
bucketandobjectKey, thecontentHash, and theingestionJobId/ingestionStatus.
Authentication
Both tools authenticate with AWS access keys, configured per step:- accessKeyId: An
AWS_ACCESS_KEY_IDvalue, or the name of the Flow secret that contains it. - secretAccessKey: An
AWS_SECRET_ACCESS_KEYvalue, or the name of the Flow secret that contains it.
- region: AWS region of the Bedrock Knowledge Base.
- knowledgeBaseId: The Bedrock Knowledge Base ID.
- dataSourceId (PDF sync only): The target S3 data source ID of the knowledge base.
- s3KeyPrefix (PDF sync only, optional): Additional folder appended after the data source prefix. The uploaded object path becomes
{S3_bucket_name}{dataSourcePrefix}{s3KeyPrefix}/...— omit any leading/and never include the bucket name itself.
Usage Examples
Example: RAG Answer from a Knowledge Base
Example: Sync a PDF and Query It
Notes
- PDF size limit: PDFs larger than 100 MB are rejected.
- PDF validation: The file must start with a
%PDFheader; other file types are rejected. - HTTPS only: Insecure
http://URLs are rejected for thepdfinput — use HTTPS. - Deduplication: The uploaded object is named
{sha256}.pdf. If an object with the same content hash already exists, the tool skips both upload and ingestion and returnsskipped: true. - Filename:
filenameis used for logging only; it is sanitized (special characters replaced) and truncated to 100 characters. Defaults todocument.pdf. - Ingestion wait: When
waitForIngestionistrue, the step fails if the ingestion job ends withFAILED,STOPPING, orSTOPPED, or if it does not complete withiningestionTimeoutSeconds. - numberOfResults for querying is capped at 100.