Textract Document Deployer
An AWS CloudOps agent skill that deploys Amazon Textract document-
analysis pipelines with correct defaults. The skill walks the operator
through feature selection (Forms, Tables, Queries, Signatures, Expense,
Identity), synchronous vs asynchronous API choice, S3 input/output
configuration, KMS encryption, SNS completion notifications, Lambda
integration for real-time extraction, document splitting for oversized
PDFs, service quotas, and Comprehend downstream NLP, captures the
document-processing topology, explains why each default matters, and
emits a READY_TO_DEPLOY checklist with copy-pasteable verification
commands.
Activation keywords
analyze document, detect document text, extract form fields, extract
tables, textract queries, textract expense analysis, textract signature
detection, textract identity documents, start document analysis, textract
lambda, textract s3 output, textract kms encryption, textract sns
notification.
STRICT output contract
When this skill is invoked with a Textract-deployment request
(extract text/forms/tables/expense/identity from documents, set up async
multipage extraction, configure SNS/KMS/Lambda integration, or a partial
configuration), the agent MUST respond with the READY_TO_DEPLOY checklist
defined in the "Output format" section using the literal all-caps labels
TEXTRACT_PIPELINE:, VERDICT:, CHECKLIST:, and
VERIFICATION_COMMANDS:. Do NOT preface the checklist with prose,
headings, or disclaimers — emit the block as the first lines of the
response. This contract is what assertion-based evals and downstream
provisioning pipelines rely on; deviating from the literal labels breaks
automation silently.
If any prerequisite is missing, the verdict is PREREQUISITES_MISSING
with a specific gap citation in the checklist (marked [✗]), and
READY_TO_DEPLOY MUST NOT also appear.
Quick navigation
| Section |
When to read |
| Prerequisites |
Always — verify before provisioning |
| Step 1 — Feature selection (Forms, Tables, Queries, ...) |
Core feature matrix |
| Step 2 — Synchronous vs asynchronous API choice |
API selection |
| Step 3 — S3 document source and output config |
Storage |
| Step 4 — KMS encryption |
Encryption |
| Step 5 — SNS notification for async completion |
Async notification |
| Step 6 — Lambda integration for real-time extraction |
Real-time path |
| Step 7 — Bounding boxes and confidence scores |
Geometry |
| Step 8 — Document splitting for large PDFs |
Quota handling |
| Step 9 — Comprehend integration for downstream NLP |
NLP chaining |
| Step 10 — Identity documents and signatures |
Specialized features |
| Step 11 — Recent features |
Latest |
| NEVER do these things |
Review before signing off |
| Output format |
The literal checklist template |
| references/async-and-s3.md |
Async API + S3 output detail |
| references/sync-and-lambda.md |
Sync API + Lambda real-time detail |
Mindset
One-line takeaway: Textract synchronous APIs
(DetectDocumentText, AnalyzeDocument) work on a single page (or up to
the per-call page limit) for real-time use; asynchronous APIs
(StartDocumentAnalysis, StartExpenseAnalysis,
StartDocumentTextDetection) work on multipage PDFs up to 3000 pages
with S3 input, SNS notification, and an output config that writes
structured JSON to your own S3 bucket. Feature selection at
AnalyzeDocument time — Forms, Tables, Queries, Signatures — is what
turns raw OCR into structured business data.
Three misconceptions dominate Textract misdesign at provisioning time:
"DetectDocumentText is sufficient for forms/tables." It is not.
DetectDocumentText returns only raw text lines and words (with
geometry and confidence). To get form key-value pairs, table cells,
signatures, or natural-language query answers, you MUST use
AnalyzeDocument with the appropriate FeatureTypes (FORMS, TABLES,
QUERIES, SIGNATURES). A baseline model often reaches for
DetectDocumentText when the operator needs structured form data.
"The synchronous API handles multipage PDFs." It does NOT.
AnalyzeDocument and DetectDocumentText accept a single document
(page). For multipage PDFs (up to 3000 pages), you MUST use the
asynchronous StartDocumentAnalysis / StartDocumentTextDetection /
StartExpenseAnalysis APIs with an S3 document source. Using the
sync API on a multipage PDF returns an error or processes only the
first page.
"Textract output is just the API response." For async jobs, the
output is configurable. The OutputConfig parameter writes the
structured JSON to a customer-owned S3 bucket, and the
S3ObjectPrefix keeps results organized per job. Without
OutputConfig, results are returned only in the Get* API response
(which can be tens of MB for multipage documents).
Configuration dependency graph (novel heuristic)
Textract configurations are NOT independent. The feature types selected
determine the API choice; the API choice determines sync vs async; the
async path requires S3 input and (recommended) S3 output, SNS, and KMS.
Use this graph to sequence provisioning.
| Configuration |
Hard dependencies (API error without) |
Silent failure / immutability |
Enables downstream |
| IAM role (or direct IAM) |
s3:GetObject on input bucket |
Textract returns InvalidParameterException if S3 access is missing |
Textract to read documents |
| Synchronous AnalyzeDocument |
Inline bytes (base64) OR S3 location; feature types specified |
Limited to single-page or low-page documents; multipage PDFs rejected |
real-time extraction in Lambda |
| Asynchronous StartDocumentAnalysis |
S3 location for input; S3 bucket in same region |
without OutputConfig, results only available via Get* (paginated, large) |
multipage processing up to 3000 pages |
| OutputConfig (S3 output) |
S3 bucket in same region as Textract job; s3:PutObject grant |
bucket region MUST match Textract region |
structured JSON results in your bucket |
| KMS encryption |
KMS key policy grants Textract service kms:GenerateDataKey + kms:Decrypt |
KMS key must be in same region |
encrypts input (if encrypted in S3) and output JSON |
| SNS notification |
SNS topic in same region; Textract service allowed sns:Publish |
without SNS, must poll GetDocumentAnalysis |
push notification on job completion |
| Lambda integration |
Lambda in same region; IAM includes textract:Start* / Get* |
Lambda synchronous API for single-page only |
real-time extraction endpoint |
| Comprehend NLP |
Textract output (text or forms) extracted and passed to Comprehend |
Comprehend has its own quotas and regions |
entity detection, PII, classification on extracted text |
| Document splitting |
Customer-side logic (Textract does NOT split) |
Textract enforces 3000-page hard limit per async job |
oversized PDF processing |
| Queries feature |
AnalyzeDocument with FeatureTypes=[QUERIES] + QueriesConfig |
Queries requires the QUERIES feature type AND a QueriesConfig block |
natural-language questions on forms |
| Expense analysis |
StartExpenseAnalysis (async) or AnalyzeExpense (sync) |
Expense uses a SEPARATE API family; Forms/Tables feature types do not apply |
invoices/receipts structured line items |
| Identity documents |
AnalyzeID (sync, dedicated API) |
Identity uses a SEPARATE API; Lending uses a SEPARATE async API |
driver's license, passport fields |
The sync-vs-async choice row is the one a baseline model misses.
A naive deployment calls DetectDocumentText for everything. The
correct heuristic recognizes that multipage PDFs and most production
workloads need the async API with S3 input, OutputConfig, and SNS. The
procedure below forces an explicit API choice.
Cross-dependency gotchas:
- S3 input bucket and OutputConfig bucket MUST be in the same AWS
region as the Textract API call. Cross-region S3 fails silently or
with a confusing InvalidS3Object exception.
- KMS-encrypted input documents require the Textract service role (or
caller) to have kms:Decrypt on the encrypting key; the output JSON
uses a separate KMS key grant (kms:GenerateDataKey).
- SNS topic MUST be in the same region as the Textract job. The role
needs sns:Publish on the topic ARN, and Textract's service principal
must be allowed.
- The Queries feature is selected via
FeatureTypes=[QUERIES] AND
requires a QueriesConfig block with one or more Text queries. A
missing QueriesConfig returns no query results.
- Expense analysis and identity documents use SEPARATE API families
(
AnalyzeExpense / StartExpenseAnalysis and AnalyzeID). They are
NOT invoked through AnalyzeDocument.
Expert heuristic: choosing sync vs async
A baseline model says "use Textract." The correct heuristic recognizes
that Textract has two distinct operational shapes.
Document profile:
├── Single page (PNG/JPEG/TIFF/PDF), real-time, < 30s SLA
│ → Synchronous API
│ DetectDocumentText (raw text + geometry)
│ AnalyzeDocument (text + Forms / Tables / Queries / Signatures)
│ AnalyzeExpense (invoices/receipts, single doc)
│ AnalyzeID (driver's license / passport)
│
├── Multipage PDF (2-3000 pages), batch, minutes
│ → Asynchronous API with S3 input + OutputConfig + SNS + KMS
│ StartDocumentTextDetection (raw text, multipage)
│ StartDocumentAnalysis (Forms / Tables / Queries / Signatures, multipage)
│ StartExpenseAnalysis (invoices/receipts, multipage batch)
│
└── Over 3000 pages
→ Customer-side document splitting into <3000-page chunks
then StartDocumentAnalysis per chunk; aggregate downstream
Key implication: the async API is the production default for any
multipage document. Lambda real-time extraction is only for single-page
or low-page documents where the 15-minute (or configured) Lambda timeout
is not exceeded.
Expert heuristic: feature-type selection
Feature types are selected at AnalyzeDocument time. Each adds
structured output on top of raw OCR.
Use case → FeatureTypes → API
─────────────────────────────────────────────────────────────────────────
Raw text extraction (lines, words) → (none — use Detect) → DetectDocumentText
Form key-value pairs (labels+values) → [FORMS] → AnalyzeDocument
Tabular data (rows, columns, headers) → [TABLES] → AnalyzeDocument
Natural-language questions on forms → [QUERIES] → AnalyzeDocument
Signature locations on page → [SIGNATURES] → AnalyzeDocument
Forms + Tables together → [FORMS, TABLES] → AnalyzeDocument
Forms + Tables + Queries → [FORMS, TABLES, QUERIES]
Invoice / receipt line items → (separate API) → AnalyzeExpense / StartExpenseAnalysis
Driver's license / passport → (separate API) → AnalyzeID
The Queries feature lets you ask natural-language questions of
forms. Example: "What is the policy number?" returns the value and
its bounding box, even if the form layout varies. This is more
flexible than FORMS key-value extraction, which depends on matching
labels.
Expert heuristic: async API supports up to 3000 pages per job
The async APIs (StartDocumentAnalysis, StartDocumentTextDetection,
StartExpenseAnalysis) support multipage PDFs up to 3000 pages per
job (hard limit). The sync APIs support a single page (or a small
number of pages depending on the API and document type). For oversized
PDFs, split the document customer-side before invoking Textract.
PDF page count:
├── 1 page → sync OK (Lambda real-time)
├── 2-3000 pages → async (StartDocumentAnalysis)
└── >3000 pages → split into chunks of ≤3000 pages, async per chunk
Key implication: the 3000-page limit is a hard quota. Plan for
document splitting in any document-management pipeline that handles
large reports, contracts, or regulatory filings.
Expert heuristic: expense analysis is purpose-built for invoices and receipts
AnalyzeExpense (sync) and StartExpenseAnalysis (async) use a
purpose-built ML model for invoices and receipts. They return
structured fields (vendor, invoice number, total, line items) without
requiring Forms/Tables feature configuration.
Invoice / receipt processing decision:
├── Need structured fields (vendor, total, line items)
│ → AnalyzeExpense / StartExpenseAnalysis (purpose-built)
│ Returns: ExpenseDocuments[] with SummaryFields[] and LineItems[]
│
└── Need custom form layout extraction
→ AnalyzeDocument with FORMS, TABLES, QUERIES
Key implication: do NOT use AnalyzeDocument with FORMS for invoices
if you need vendor name, total, or line-item extraction. Use
AnalyzeExpense — it returns these as structured fields with confidence
scores.
Prerequisites (verify before provisioning)
Before emitting provisioning commands, verify these prerequisites. If
any are missing, the verdict is PREREQUISITES_MISSING.
| Prerequisite |
Why it matters |
How to verify |
| S3 input bucket exists (same region) |
Textract must read documents from S3 in the same region |
aws s3api head-bucket --bucket <input-bucket> |
| S3 output bucket exists (same region) |
OutputConfig writes JSON to a customer-owned bucket |
aws s3api head-bucket --bucket <output-bucket> |
| IAM grant: s3:GetObject on input |
Textract service (or caller) must read documents |
Review role policy |
| IAM grant: s3:PutObject on output |
Textract writes structured JSON to output bucket |
Review role policy |
| IAM grant: textract:Start*/Get*/Notify* |
Required to invoke async APIs and retrieve results |
Review IAM policy |
| KMS key (if encryption enabled) |
KMS-encrypted inputs require kms:Decrypt; outputs use kms:GenerateDataKey |
aws kms describe-key --key-id <key-id> |
| KMS key policy grants Textract |
Textract service principal needs kms:GenerateDataKey + kms:Decrypt |
Review key policy |
| SNS topic (if async + notification) |
SNS topic in same region; Textract needs sns:Publish |
aws sns get-topic-attributes --topic-arn <arn> |
| Document format supported |
PDF, TIFF, PNG, JPEG |
Confirm file type |
| Document under 3000 pages (async) |
Hard limit per async job |
Verify page count, plan splitting |
| Feature type selected |
Determines structured output |
Choose from FORMS/TABLES/QUERIES/SIGNATURES |
If any prerequisite is missing, output VERDICT: PREREQUISITES_MISSING
and cite the specific gap.
Step 1 — Feature selection (Forms, Tables, Queries, Signatures, Expense, Identity)
AnalyzeDocument accepts a FeatureTypes list. Multiple features can
be combined (e.g., [FORMS, TABLES, QUERIES]).
| Feature |
What it adds |
API |
| FORMS |
Key-value pairs (field labels + values) with confidence |
AnalyzeDocument |
| TABLES |
Tabular structure (rows, columns, headers, merged cells) |
AnalyzeDocument |
| QUERIES |
Natural-language question answering on forms (with QueriesConfig) |
AnalyzeDocument |
| SIGNATURES |
Signature locations (bounding boxes) on the page |
AnalyzeDocument |
| LAYOUT |
Reading order and structural layout elements |
AnalyzeDocument |
| (Expense) |
Invoice/receipt structured fields — separate API |
AnalyzeExpense / StartExpenseAnalysis |
| (Identity) |
Driver's license / passport fields — separate API |
AnalyzeID |
Choose feature types based on document type and downstream use:
- Invoices/receipts → Expense API (not AnalyzeDocument FORMS).
- Custom forms → FORMS, optionally + QUERIES.
- Spreadsheets → TABLES.
- Contracts with signatures → FORMS + SIGNATURES.
- Variable-layout forms → QUERIES (more flexible than FORMS).
Step 2 — Synchronous vs asynchronous API choice
| Decision factor |
Synchronous |
Asynchronous |
| Document length |
Single page (or low page count per API limits) |
Up to 3000 pages |
| Latency requirement |
Real-time (< 30s typical) |
Minutes (batch) |
| Input source |
Inline bytes (base64) OR S3 Object |
S3 Object (required) |
| Output |
API response only |
OutputConfig (S3) recommended |
| Notification |
None (caller waits) |
SNS topic (optional) |
| Encryption |
KMS via API parameters |
KMS via API parameters |
| APIs |
DetectDocumentText, AnalyzeDocument, AnalyzeExpense, AnalyzeID |
StartDocumentTextDetection, StartDocumentAnalysis, StartExpenseAnalysis |
| Result retrieval |
Direct in response |
GetDocumentAnalysis / GetExpenseAnalysis (paginated) OR OutputConfig S3 |
| Lambda integration |
Yes (single-page real-time) |
Yes but with Step Functions for polling |
Rule of thumb: if the document is more than 1-2 pages or the
extraction takes more than a few seconds, use async.
Step 3 — S3 document source and output config
OutputConfig + S3Prefix layout, same-region bucket requirement — moved verbatim.
Full detail: Async APIs and S3 output.
Step 4 — KMS encryption
KMS key id, key-policy grants (kms:GenerateDataKey / kms:Decrypt) — moved verbatim.
Full detail: Async APIs and S3 output.
Step 5 — SNS notification for async completion
NotificationChannel RoleArn + SNSTopicArn, SNS message body fields — moved verbatim.
Full detail: Async APIs and S3 output.
Step 6 — Lambda integration for real-time extraction
Python handler, minimum Lambda IAM policy, sync page-limit caveat — moved verbatim.
Full detail: Sync APIs and Lambda.
Step 7 — Bounding boxes and confidence scores
BoundingBox/Polygon geometry, confidence-threshold filtering pattern — moved verbatim.
Full detail: Sync APIs and Lambda.
Step 8 — Document splitting for large PDFs
3000-page hard limit, chunk-and-submit pattern — moved verbatim.
Full detail: Async APIs and S3 output.
Step 9 — Comprehend integration for downstream NLP
entities / PII chaining, Comprehend size quotas — moved verbatim.
Full detail: Sync APIs and Lambda.
Step 10 — Identity documents and signatures
Identity documents (driver's license, passport) use the dedicated
AnalyzeID API (synchronous). It returns structured fields like
document number, expiration, first/last name, address, date of birth.
aws textract analyze-id \
--document-pages '[{"S3Object":{"Bucket":"my-bucket","Name":"id/drivers-license.jpg"}}]' \
--region us-east-1
Signatures are detected via AnalyzeDocument with
FeatureTypes=["SIGNATURES"]. Each signature is returned as a
SIGNATURE Block with a bounding box.
Step 11 — Recent features
Queries GA, Signatures GA, Expense CSV output, Lending, Layout, EU/APAC expansion — moved verbatim.
Full detail: Advanced patterns.
NEVER do these things
NEVER use DetectDocumentText when you need forms, tables, queries,
signatures, or expense data. DetectDocumentText returns only raw
text. Use AnalyzeDocument with the appropriate FeatureTypes, or
AnalyzeExpense / AnalyzeID for specialized document types.
NEVER call the synchronous API on a multipage PDF expecting all
pages. The sync APIs are designed for single-page (or low-page)
documents. Use StartDocumentAnalysis / StartDocumentTextDetection
for multipage PDFs up to 3000 pages.
NEVER submit a PDF over 3000 pages without splitting. The async
API hard-fails at 3001+ pages. Split customer-side into chunks of
≤3000 pages and submit each as a separate job.
NEVER use cross-region S3 buckets for input or OutputConfig.
Both the input bucket and the OutputConfig bucket MUST be in the
same region as the Textract API call. Cross-region S3 causes
InvalidS3Object or ProvisionedThroughputExceeded errors.
NEVER forget the notification role for SNS. The
NotificationChannel requires a RoleArn that trusts
textract.amazonaws.com and has sns:Publish on the topic. Without
it, the API call fails.
NEVER use AnalyzeDocument FORMS for invoices and receipts.
Invoices and receipts have a dedicated API (AnalyzeExpense /
StartExpenseAnalysis) that returns structured vendor, total, and
line-item fields. AnalyzeDocument FORMS does not.
NEVER assume Textract output is small. Multipage documents can
produce tens of MB of structured JSON. Use OutputConfig to write
results to S3 rather than fetching them all via Get* pagination.
NEVER skip the KMS key policy for Textract. If the input
document is KMS-encrypted, Textract needs kms:Decrypt. If output
encryption is configured, Textract needs kms:GenerateDataKey. Both
must be granted to the Textract service principal.
NEVER assume confidence scores are binary (good/bad). Set a
threshold appropriate to your use case (typically 50-90%). Route
low-confidence extractions to a human review queue.
NEVER confuse AnalyzeID with AnalyzeDocument. Identity
documents (driver's license, passport) use the dedicated AnalyzeID
API. AnalyzeDocument does not return identity-document structured
fields.
Output format
TEXTRACT_PIPELINE: <input-s3-uri> → <feature-types> → <output-s3-uri>
VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING
CHECKLIST:
[✓|✗] Input bucket: s3://<bucket>/<key> (region <region>)
[✓|✗] Output bucket: s3://<bucket>/<prefix> (region <region>)
[✓|✗] API mode: Synchronous (AnalyzeDocument) | Asynchronous (StartDocumentAnalysis)
[✓|✗] Feature types: FORMS | TABLES | QUERIES | SIGNATURES | EXPENSE | IDENTITY
[✓|✗] Document format: <PDF|TIFF|PNG|JPEG> (<page-count> pages)
[✓|✗] Page-count check: PASS (<n> ≤ 3000) | FAIL (<n> > 3000 — split required)
[✓|✗] IAM — s3:GetObject on input: <role>
[✓|✗] IAM — s3:PutObject on output: <role>
[✓|✗] IAM — textract:Start*/Get*: <role>
[✓|✗] KMS encryption: <key-id> (input + output) | Disabled
[✓|✗] SNS notification: <topic-arn> (RoleArn <role>) | Disabled
[✓|✗] Lambda integration: <function-name> (sync real-time) | Not used
[✓|✗] OutputConfig: s3://<bucket>/<prefix>/<job-id>/
[✓|✗] Queries config: <n> queries (if QUERIES feature) | Not used
[✓|✗] Confidence threshold: <threshold>% (downstream review filter)
[✓|✗] Document splitting: not required | <n> chunks of ≤3000 pages
[✓|✗] Comprehend integration: <detect-entities|detect-pii|classify> | Not used
VERIFICATION_COMMANDS:
aws textract get-document-analysis --job-id <job-id> --region <region>
aws textract describe-document-text-detection --job-id <job-id> --region <region> (if StartDocumentTextDetection)
aws s3 ls s3://<output-bucket>/<prefix>/<job-id>/ --recursive
Worked example — async multipage Forms+Tables with SNS, KMS, OutputConfig
TEXTRACT_PIPELINE: s3://doc-input/invoices/2026-q3.pdf → FORMS,TABLES → s3://doc-output/textract/
VERDICT: READY_TO_DEPLOY
CHECKLIST:
[✓] Input bucket: s3://doc-input/invoices/2026-q3.pdf (region us-east-1)
[✓] Output bucket: s3://doc-output/textract/ (region us-east-1)
[✓] API mode: Asynchronous (StartDocumentAnalysis)
[✓] Feature types: FORMS, TABLES
[✓] Document format: PDF (1450 pages)
[✓] Page-count check: PASS (1450 ≤ 3000)
[✓] IAM — s3:GetObject on input: arn:aws:iam::123456789012:role/TextractProcessingRole
[✓] IAM — s3:PutObject on output: arn:aws:iam::123456789012:role/TextractProcessingRole
[✓] IAM — textract:StartDocumentAnalysis/GetDocumentAnalysis: TextractProcessingRole
[✓] KMS encryption: arn:aws:kms:us-east-1:123456789012:key/abcd1234-... (input + output)
[✓] SNS notification: arn:aws:sns:us-east-1:123456789012:TextractComplete (RoleArn TextractNotificationRole)
[✓] OutputConfig: s3://doc-output/textract/<job-id>/
[✓] Confidence threshold: 75% (route <75% to manual review)
[✓] Document splitting: not required
VERIFICATION_COMMANDS:
aws textract get-document-analysis --job-id <job-id> --region us-east-1
aws s3 ls s3://doc-output/textract/<job-id>/ --recursive
Error handling
InvalidS3Object, KMS AccessDenied, IN_PROGRESS/FAILED, ProvisionedThroughputExceeded, Lambda timeout, empty Queries — moved verbatim.
Full detail: Error handling.
References (load on demand)
- Async APIs and S3 output — async API mechanics, OutputConfig layout, KMS key policy, SNS notification role, document splitting
- Sync APIs and Lambda — sync API limits, Lambda handler + IAM, bounding boxes and confidence filtering, Comprehend NLP chaining
- Advanced patterns — recent features (Queries, Signatures, Layout, Lending, OutputConfig CSV, region expansion)
- Error handling — InvalidS3Object, KMS AccessDenied, job status, throughput, Lambda timeout, empty Queries
Domain
AWS CloudOps / Amazon Textract Document Analysis & OCR Pipeline
Provisioning.
AWS documentation
1---2name: textract-document-deployer3description: 'Deploys Amazon Textract document-analysis pipelines with production defaults: synchronous APIs (DetectDocumentText, AnalyzeDocument) for single-page real-time extraction, asynchronous APIs (StartDocumentAnalysis, StartDocumentTextDetection, StartExpenseAnalysis) for multipage PDFs up to 3000 pages, S3 document source and output config, SNS notification for async job completion, KMS encryption for input and output, feature selection (Forms, Tables, Queries, Signatures, Expense, Identity), bounding-box geometry and confidence-score handling, Lambda integration for real-time extraction, document splitting for oversized PDFs, service quotas, Comprehend integration for downstream NLP on extracted text. Emits a. Triggers: analyze document, detect document text, extract form fields, extract tables, textract queries, textract expense analysis, textract signature detection, textract identity documents, start document analysis, textract lambda, textract s3 output, textract kms encryption, textract sns notification.'4license: Apache-2.05compatibility: 'Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). For live deployment: AWS CLI v2 with textract access and an IAM role granting s3:GetObject on the input bucket, s3:PutObject on the output bucket, textract:Start* / Get* / Notify* actions, kms:Decrypt / kms:GenerateDataKey on the KMS key, and sns:Publish if SNS notification is used. Works with Lambda runtimes (boto3 textract client), Step Functions orchestrations, Terraform aws_textract_* data sources, and...'6metadata:7 source: https://skillmd.com/skills/jhkchan/textract-document-deployer8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '1'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: AI/ML15 task_type: deploy16 skill_class: capability17 lifecycle_status: active18 verdict_shape: READY_TO_DEPLOY | PREREQUISITES_MISSING19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 tags: aws, textract, document-analysis, ml, deploy, provisioning, forms, tables, queries, expense, lambda, kms, sns22 dependencies: aws-orchestrator23 keywords: aws, textract, document analysis, ocr, forms, tables, queries, signatures, expense, identity documents, ml, deploy, provisioning, synchronous, asynchronous, lambda, kms, sns, s3, comprehend24 when_to_use: Invoke when the user wants to extract text, forms, tables, signatures, expense, or identity data from documents (PDF, TIFF, PNG, JPEG) using Amazon Textract. Covers both synchronous APIs for single-page real-time extraction (DetectDocumentText, AnalyzeDocument) and asynchronous APIs for multipage batch extraction (StartDocumentAnalysis, StartExpenseAnalysis, StartDocumentTextDetection) with S3 input/output, SNS completion notification, KMS encryption, Lambda integration, and Comprehend downstream NLP. Do NOT invoke for Amazon Transcribe (audio), Amazon Rekognition (image/video ML), or pure OCR via Textract DetectDocumentText without downstream analysis.25---2627# Textract Document Deployer2829An AWS CloudOps agent skill that deploys Amazon Textract document-30analysis pipelines with correct defaults. The skill walks the operator31through feature selection (Forms, Tables, Queries, Signatures, Expense,32Identity), synchronous vs asynchronous API choice, S3 input/output33configuration, KMS encryption, SNS completion notifications, Lambda34integration for real-time extraction, document splitting for oversized35PDFs, service quotas, and Comprehend downstream NLP, captures the36document-processing topology, explains why each default matters, and37emits a READY_TO_DEPLOY checklist with copy-pasteable verification38commands.3940## Activation keywords4142analyze document, detect document text, extract form fields, extract43tables, textract queries, textract expense analysis, textract signature44detection, textract identity documents, start document analysis, textract45lambda, textract s3 output, textract kms encryption, textract sns46notification.4748## STRICT output contract4950When this skill is invoked with a Textract-deployment request51(extract text/forms/tables/expense/identity from documents, set up async52multipage extraction, configure SNS/KMS/Lambda integration, or a partial53configuration), the agent MUST respond with the READY_TO_DEPLOY checklist54defined in the "Output format" section using the literal all-caps labels55`TEXTRACT_PIPELINE:`, `VERDICT:`, `CHECKLIST:`, and56`VERIFICATION_COMMANDS:`. Do NOT preface the checklist with prose,57headings, or disclaimers — emit the block as the first lines of the58response. This contract is what assertion-based evals and downstream59provisioning pipelines rely on; deviating from the literal labels breaks60automation silently.6162If any prerequisite is missing, the verdict is `PREREQUISITES_MISSING`63with a specific gap citation in the checklist (marked `[✗]`), and64`READY_TO_DEPLOY` MUST NOT also appear.6566## Quick navigation6768| Section | When to read |69|---|---|70| Prerequisites | Always — verify before provisioning |71| Step 1 — Feature selection (Forms, Tables, Queries, ...) | Core feature matrix |72| Step 2 — Synchronous vs asynchronous API choice | API selection |73| Step 3 — S3 document source and output config | Storage |74| Step 4 — KMS encryption | Encryption |75| Step 5 — SNS notification for async completion | Async notification |76| Step 6 — Lambda integration for real-time extraction | Real-time path |77| Step 7 — Bounding boxes and confidence scores | Geometry |78| Step 8 — Document splitting for large PDFs | Quota handling |79| Step 9 — Comprehend integration for downstream NLP | NLP chaining |80| Step 10 — Identity documents and signatures | Specialized features |81| Step 11 — Recent features | Latest |82| NEVER do these things | Review before signing off |83| Output format | The literal checklist template |84| references/async-and-s3.md | Async API + S3 output detail |85| references/sync-and-lambda.md | Sync API + Lambda real-time detail |8687## Mindset8889**One-line takeaway:** Textract synchronous APIs90(DetectDocumentText, AnalyzeDocument) work on a single page (or up to91the per-call page limit) for real-time use; asynchronous APIs92(StartDocumentAnalysis, StartExpenseAnalysis,93StartDocumentTextDetection) work on multipage PDFs up to 3000 pages94with S3 input, SNS notification, and an output config that writes95structured JSON to your own S3 bucket. Feature selection at96`AnalyzeDocument` time — Forms, Tables, Queries, Signatures — is what97turns raw OCR into structured business data.9899Three misconceptions dominate Textract misdesign at provisioning time:100101- **"DetectDocumentText is sufficient for forms/tables."** It is not.102 `DetectDocumentText` returns only raw text lines and words (with103 geometry and confidence). To get form key-value pairs, table cells,104 signatures, or natural-language query answers, you MUST use105 `AnalyzeDocument` with the appropriate `FeatureTypes` (FORMS, TABLES,106 QUERIES, SIGNATURES). A baseline model often reaches for107 `DetectDocumentText` when the operator needs structured form data.108109- **"The synchronous API handles multipage PDFs."** It does NOT.110 `AnalyzeDocument` and `DetectDocumentText` accept a single document111 (page). For multipage PDFs (up to 3000 pages), you MUST use the112 asynchronous `StartDocumentAnalysis` / `StartDocumentTextDetection` /113 `StartExpenseAnalysis` APIs with an S3 document source. Using the114 sync API on a multipage PDF returns an error or processes only the115 first page.116117- **"Textract output is just the API response."** For async jobs, the118 output is configurable. The `OutputConfig` parameter writes the119 structured JSON to a customer-owned S3 bucket, and the120 `S3ObjectPrefix` keeps results organized per job. Without121 `OutputConfig`, results are returned only in the `Get*` API response122 (which can be tens of MB for multipage documents).123124## Configuration dependency graph (novel heuristic)125126Textract configurations are NOT independent. The feature types selected127determine the API choice; the API choice determines sync vs async; the128async path requires S3 input and (recommended) S3 output, SNS, and KMS.129Use this graph to sequence provisioning.130131| Configuration | Hard dependencies (API error without) | Silent failure / immutability | Enables downstream |132|---|---|---|---|133| IAM role (or direct IAM) | s3:GetObject on input bucket | Textract returns InvalidParameterException if S3 access is missing | Textract to read documents |134| Synchronous AnalyzeDocument | Inline bytes (base64) OR S3 location; feature types specified | Limited to single-page or low-page documents; multipage PDFs rejected | real-time extraction in Lambda |135| Asynchronous StartDocumentAnalysis | S3 location for input; S3 bucket in same region | without OutputConfig, results only available via Get* (paginated, large) | multipage processing up to 3000 pages |136| OutputConfig (S3 output) | S3 bucket in same region as Textract job; s3:PutObject grant | bucket region MUST match Textract region | structured JSON results in your bucket |137| KMS encryption | KMS key policy grants Textract service kms:GenerateDataKey + kms:Decrypt | KMS key must be in same region | encrypts input (if encrypted in S3) and output JSON |138| SNS notification | SNS topic in same region; Textract service allowed sns:Publish | without SNS, must poll GetDocumentAnalysis | push notification on job completion |139| Lambda integration | Lambda in same region; IAM includes textract:Start* / Get* | Lambda synchronous API for single-page only | real-time extraction endpoint |140| Comprehend NLP | Textract output (text or forms) extracted and passed to Comprehend | Comprehend has its own quotas and regions | entity detection, PII, classification on extracted text |141| Document splitting | Customer-side logic (Textract does NOT split) | Textract enforces 3000-page hard limit per async job | oversized PDF processing |142| Queries feature | AnalyzeDocument with FeatureTypes=[QUERIES] + QueriesConfig | Queries requires the QUERIES feature type AND a QueriesConfig block | natural-language questions on forms |143| Expense analysis | StartExpenseAnalysis (async) or AnalyzeExpense (sync) | Expense uses a SEPARATE API family; Forms/Tables feature types do not apply | invoices/receipts structured line items |144| Identity documents | AnalyzeID (sync, dedicated API) | Identity uses a SEPARATE API; Lending uses a SEPARATE async API | driver's license, passport fields |145146**The sync-vs-async choice row is the one a baseline model misses.**147A naive deployment calls `DetectDocumentText` for everything. The148correct heuristic recognizes that multipage PDFs and most production149workloads need the async API with S3 input, OutputConfig, and SNS. The150procedure below forces an explicit API choice.151152**Cross-dependency gotchas:**153- S3 input bucket and OutputConfig bucket MUST be in the same AWS154 region as the Textract API call. Cross-region S3 fails silently or155 with a confusing InvalidS3Object exception.156- KMS-encrypted input documents require the Textract service role (or157 caller) to have kms:Decrypt on the encrypting key; the output JSON158 uses a separate KMS key grant (kms:GenerateDataKey).159- SNS topic MUST be in the same region as the Textract job. The role160 needs sns:Publish on the topic ARN, and Textract's service principal161 must be allowed.162- The Queries feature is selected via `FeatureTypes=[QUERIES]` AND163 requires a `QueriesConfig` block with one or more `Text` queries. A164 missing QueriesConfig returns no query results.165- Expense analysis and identity documents use SEPARATE API families166 (`AnalyzeExpense` / `StartExpenseAnalysis` and `AnalyzeID`). They are167 NOT invoked through `AnalyzeDocument`.168169## Expert heuristic: choosing sync vs async170171A baseline model says "use Textract." The correct heuristic recognizes172that Textract has two distinct operational shapes.173174```text175Document profile:176 ├── Single page (PNG/JPEG/TIFF/PDF), real-time, < 30s SLA177 │ → Synchronous API178 │ DetectDocumentText (raw text + geometry)179 │ AnalyzeDocument (text + Forms / Tables / Queries / Signatures)180 │ AnalyzeExpense (invoices/receipts, single doc)181 │ AnalyzeID (driver's license / passport)182 │183 ├── Multipage PDF (2-3000 pages), batch, minutes184 │ → Asynchronous API with S3 input + OutputConfig + SNS + KMS185 │ StartDocumentTextDetection (raw text, multipage)186 │ StartDocumentAnalysis (Forms / Tables / Queries / Signatures, multipage)187 │ StartExpenseAnalysis (invoices/receipts, multipage batch)188 │189 └── Over 3000 pages190 → Customer-side document splitting into <3000-page chunks191 then StartDocumentAnalysis per chunk; aggregate downstream192```193194**Key implication:** the async API is the production default for any195multipage document. Lambda real-time extraction is only for single-page196or low-page documents where the 15-minute (or configured) Lambda timeout197is not exceeded.198199## Expert heuristic: feature-type selection200201Feature types are selected at `AnalyzeDocument` time. Each adds202structured output on top of raw OCR.203204```text205Use case → FeatureTypes → API206─────────────────────────────────────────────────────────────────────────207Raw text extraction (lines, words) → (none — use Detect) → DetectDocumentText208Form key-value pairs (labels+values) → [FORMS] → AnalyzeDocument209Tabular data (rows, columns, headers) → [TABLES] → AnalyzeDocument210Natural-language questions on forms → [QUERIES] → AnalyzeDocument211Signature locations on page → [SIGNATURES] → AnalyzeDocument212Forms + Tables together → [FORMS, TABLES] → AnalyzeDocument213Forms + Tables + Queries → [FORMS, TABLES, QUERIES]214Invoice / receipt line items → (separate API) → AnalyzeExpense / StartExpenseAnalysis215Driver's license / passport → (separate API) → AnalyzeID216```217218**The Queries feature lets you ask natural-language questions of219forms.** Example: "What is the policy number?" returns the value and220its bounding box, even if the form layout varies. This is more221flexible than FORMS key-value extraction, which depends on matching222labels.223224## Expert heuristic: async API supports up to 3000 pages per job225226The async APIs (`StartDocumentAnalysis`, `StartDocumentTextDetection`,227`StartExpenseAnalysis`) support multipage PDFs up to 3000 pages per228job (hard limit). The sync APIs support a single page (or a small229number of pages depending on the API and document type). For oversized230PDFs, split the document customer-side before invoking Textract.231232```text233PDF page count:234 ├── 1 page → sync OK (Lambda real-time)235 ├── 2-3000 pages → async (StartDocumentAnalysis)236 └── >3000 pages → split into chunks of ≤3000 pages, async per chunk237```238239**Key implication:** the 3000-page limit is a hard quota. Plan for240document splitting in any document-management pipeline that handles241large reports, contracts, or regulatory filings.242243## Expert heuristic: expense analysis is purpose-built for invoices and receipts244245`AnalyzeExpense` (sync) and `StartExpenseAnalysis` (async) use a246purpose-built ML model for invoices and receipts. They return247structured fields (vendor, invoice number, total, line items) without248requiring Forms/Tables feature configuration.249250```text251Invoice / receipt processing decision:252 ├── Need structured fields (vendor, total, line items)253 │ → AnalyzeExpense / StartExpenseAnalysis (purpose-built)254 │ Returns: ExpenseDocuments[] with SummaryFields[] and LineItems[]255 │256 └── Need custom form layout extraction257 → AnalyzeDocument with FORMS, TABLES, QUERIES258```259260**Key implication:** do NOT use AnalyzeDocument with FORMS for invoices261if you need vendor name, total, or line-item extraction. Use262AnalyzeExpense — it returns these as structured fields with confidence263scores.264265## Prerequisites (verify before provisioning)266267Before emitting provisioning commands, verify these prerequisites. If268any are missing, the verdict is **PREREQUISITES_MISSING**.269270| Prerequisite | Why it matters | How to verify |271|---|---|---|272| S3 input bucket exists (same region) | Textract must read documents from S3 in the same region | `aws s3api head-bucket --bucket <input-bucket>` |273| S3 output bucket exists (same region) | OutputConfig writes JSON to a customer-owned bucket | `aws s3api head-bucket --bucket <output-bucket>` |274| IAM grant: s3:GetObject on input | Textract service (or caller) must read documents | Review role policy |275| IAM grant: s3:PutObject on output | Textract writes structured JSON to output bucket | Review role policy |276| IAM grant: textract:Start*/Get*/Notify* | Required to invoke async APIs and retrieve results | Review IAM policy |277| KMS key (if encryption enabled) | KMS-encrypted inputs require kms:Decrypt; outputs use kms:GenerateDataKey | `aws kms describe-key --key-id <key-id>` |278| KMS key policy grants Textract | Textract service principal needs kms:GenerateDataKey + kms:Decrypt | Review key policy |279| SNS topic (if async + notification) | SNS topic in same region; Textract needs sns:Publish | `aws sns get-topic-attributes --topic-arn <arn>` |280| Document format supported | PDF, TIFF, PNG, JPEG | Confirm file type |281| Document under 3000 pages (async) | Hard limit per async job | Verify page count, plan splitting |282| Feature type selected | Determines structured output | Choose from FORMS/TABLES/QUERIES/SIGNATURES |283284If any prerequisite is missing, output `VERDICT: PREREQUISITES_MISSING`285and cite the specific gap.286287## Step 1 — Feature selection (Forms, Tables, Queries, Signatures, Expense, Identity)288289`AnalyzeDocument` accepts a `FeatureTypes` list. Multiple features can290be combined (e.g., `[FORMS, TABLES, QUERIES]`).291292| Feature | What it adds | API |293|---|---|---|294| FORMS | Key-value pairs (field labels + values) with confidence | AnalyzeDocument |295| TABLES | Tabular structure (rows, columns, headers, merged cells) | AnalyzeDocument |296| QUERIES | Natural-language question answering on forms (with QueriesConfig) | AnalyzeDocument |297| SIGNATURES | Signature locations (bounding boxes) on the page | AnalyzeDocument |298| LAYOUT | Reading order and structural layout elements | AnalyzeDocument |299| (Expense) | Invoice/receipt structured fields — separate API | AnalyzeExpense / StartExpenseAnalysis |300| (Identity) | Driver's license / passport fields — separate API | AnalyzeID |301302**Choose feature types based on document type and downstream use:**303- Invoices/receipts → Expense API (not AnalyzeDocument FORMS).304- Custom forms → FORMS, optionally + QUERIES.305- Spreadsheets → TABLES.306- Contracts with signatures → FORMS + SIGNATURES.307- Variable-layout forms → QUERIES (more flexible than FORMS).308309## Step 2 — Synchronous vs asynchronous API choice310311| Decision factor | Synchronous | Asynchronous |312|---|---|---|313| Document length | Single page (or low page count per API limits) | Up to 3000 pages |314| Latency requirement | Real-time (< 30s typical) | Minutes (batch) |315| Input source | Inline bytes (base64) OR S3 Object | S3 Object (required) |316| Output | API response only | OutputConfig (S3) recommended |317| Notification | None (caller waits) | SNS topic (optional) |318| Encryption | KMS via API parameters | KMS via API parameters |319| APIs | DetectDocumentText, AnalyzeDocument, AnalyzeExpense, AnalyzeID | StartDocumentTextDetection, StartDocumentAnalysis, StartExpenseAnalysis |320| Result retrieval | Direct in response | GetDocumentAnalysis / GetExpenseAnalysis (paginated) OR OutputConfig S3 |321| Lambda integration | Yes (single-page real-time) | Yes but with Step Functions for polling |322323**Rule of thumb:** if the document is more than 1-2 pages or the324extraction takes more than a few seconds, use async.325326## Step 3 — S3 document source and output config327328OutputConfig + S3Prefix layout, same-region bucket requirement — moved verbatim.329Full detail: [Async APIs and S3 output](references/async-and-s3.md).330331## Step 4 — KMS encryption332333KMS key id, key-policy grants (kms:GenerateDataKey / kms:Decrypt) — moved verbatim.334Full detail: [Async APIs and S3 output](references/async-and-s3.md).335336## Step 5 — SNS notification for async completion337338NotificationChannel RoleArn + SNSTopicArn, SNS message body fields — moved verbatim.339Full detail: [Async APIs and S3 output](references/async-and-s3.md).340341## Step 6 — Lambda integration for real-time extraction342343Python handler, minimum Lambda IAM policy, sync page-limit caveat — moved verbatim.344Full detail: [Sync APIs and Lambda](references/sync-and-lambda.md).345346## Step 7 — Bounding boxes and confidence scores347348BoundingBox/Polygon geometry, confidence-threshold filtering pattern — moved verbatim.349Full detail: [Sync APIs and Lambda](references/sync-and-lambda.md).350351## Step 8 — Document splitting for large PDFs3523533000-page hard limit, chunk-and-submit pattern — moved verbatim.354Full detail: [Async APIs and S3 output](references/async-and-s3.md).355356## Step 9 — Comprehend integration for downstream NLP357358entities / PII chaining, Comprehend size quotas — moved verbatim.359Full detail: [Sync APIs and Lambda](references/sync-and-lambda.md).360361## Step 10 — Identity documents and signatures362363Identity documents (driver's license, passport) use the dedicated364`AnalyzeID` API (synchronous). It returns structured fields like365document number, expiration, first/last name, address, date of birth.366367```bash368aws textract analyze-id \369 --document-pages '[{"S3Object":{"Bucket":"my-bucket","Name":"id/drivers-license.jpg"}}]' \370 --region us-east-1371```372373Signatures are detected via `AnalyzeDocument` with374`FeatureTypes=["SIGNATURES"]`. Each signature is returned as a375SIGNATURE Block with a bounding box.376377## Step 11 — Recent features378379Queries GA, Signatures GA, Expense CSV output, Lending, Layout, EU/APAC expansion — moved verbatim.380Full detail: [Advanced patterns](references/advanced-patterns.md).381382## NEVER do these things3833841. **NEVER use DetectDocumentText when you need forms, tables, queries,385 signatures, or expense data.** DetectDocumentText returns only raw386 text. Use AnalyzeDocument with the appropriate FeatureTypes, or387 AnalyzeExpense / AnalyzeID for specialized document types.3883892. **NEVER call the synchronous API on a multipage PDF expecting all390 pages.** The sync APIs are designed for single-page (or low-page)391 documents. Use StartDocumentAnalysis / StartDocumentTextDetection392 for multipage PDFs up to 3000 pages.3933943. **NEVER submit a PDF over 3000 pages without splitting.** The async395 API hard-fails at 3001+ pages. Split customer-side into chunks of396 ≤3000 pages and submit each as a separate job.3973984. **NEVER use cross-region S3 buckets for input or OutputConfig.**399 Both the input bucket and the OutputConfig bucket MUST be in the400 same region as the Textract API call. Cross-region S3 causes401 InvalidS3Object or ProvisionedThroughputExceeded errors.4024035. **NEVER forget the notification role for SNS.** The404 NotificationChannel requires a RoleArn that trusts405 textract.amazonaws.com and has sns:Publish on the topic. Without406 it, the API call fails.4074086. **NEVER use AnalyzeDocument FORMS for invoices and receipts.**409 Invoices and receipts have a dedicated API (AnalyzeExpense /410 StartExpenseAnalysis) that returns structured vendor, total, and411 line-item fields. AnalyzeDocument FORMS does not.4124137. **NEVER assume Textract output is small.** Multipage documents can414 produce tens of MB of structured JSON. Use OutputConfig to write415 results to S3 rather than fetching them all via Get* pagination.4164178. **NEVER skip the KMS key policy for Textract.** If the input418 document is KMS-encrypted, Textract needs kms:Decrypt. If output419 encryption is configured, Textract needs kms:GenerateDataKey. Both420 must be granted to the Textract service principal.4214229. **NEVER assume confidence scores are binary (good/bad).** Set a423 threshold appropriate to your use case (typically 50-90%). Route424 low-confidence extractions to a human review queue.42542610. **NEVER confuse AnalyzeID with AnalyzeDocument.** Identity427 documents (driver's license, passport) use the dedicated AnalyzeID428 API. AnalyzeDocument does not return identity-document structured429 fields.430431## Output format432433```text434TEXTRACT_PIPELINE: <input-s3-uri> → <feature-types> → <output-s3-uri>435VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING436CHECKLIST:437 [✓|✗] Input bucket: s3://<bucket>/<key> (region <region>)438 [✓|✗] Output bucket: s3://<bucket>/<prefix> (region <region>)439 [✓|✗] API mode: Synchronous (AnalyzeDocument) | Asynchronous (StartDocumentAnalysis)440 [✓|✗] Feature types: FORMS | TABLES | QUERIES | SIGNATURES | EXPENSE | IDENTITY441 [✓|✗] Document format: <PDF|TIFF|PNG|JPEG> (<page-count> pages)442 [✓|✗] Page-count check: PASS (<n> ≤ 3000) | FAIL (<n> > 3000 — split required)443 [✓|✗] IAM — s3:GetObject on input: <role>444 [✓|✗] IAM — s3:PutObject on output: <role>445 [✓|✗] IAM — textract:Start*/Get*: <role>446 [✓|✗] KMS encryption: <key-id> (input + output) | Disabled447 [✓|✗] SNS notification: <topic-arn> (RoleArn <role>) | Disabled448 [✓|✗] Lambda integration: <function-name> (sync real-time) | Not used449 [✓|✗] OutputConfig: s3://<bucket>/<prefix>/<job-id>/450 [✓|✗] Queries config: <n> queries (if QUERIES feature) | Not used451 [✓|✗] Confidence threshold: <threshold>% (downstream review filter)452 [✓|✗] Document splitting: not required | <n> chunks of ≤3000 pages453 [✓|✗] Comprehend integration: <detect-entities|detect-pii|classify> | Not used454VERIFICATION_COMMANDS:455 aws textract get-document-analysis --job-id <job-id> --region <region>456 aws textract describe-document-text-detection --job-id <job-id> --region <region> (if StartDocumentTextDetection)457 aws s3 ls s3://<output-bucket>/<prefix>/<job-id>/ --recursive458```459460### Worked example — async multipage Forms+Tables with SNS, KMS, OutputConfig461462```text463TEXTRACT_PIPELINE: s3://doc-input/invoices/2026-q3.pdf → FORMS,TABLES → s3://doc-output/textract/464VERDICT: READY_TO_DEPLOY465CHECKLIST:466 [✓] Input bucket: s3://doc-input/invoices/2026-q3.pdf (region us-east-1)467 [✓] Output bucket: s3://doc-output/textract/ (region us-east-1)468 [✓] API mode: Asynchronous (StartDocumentAnalysis)469 [✓] Feature types: FORMS, TABLES470 [✓] Document format: PDF (1450 pages)471 [✓] Page-count check: PASS (1450 ≤ 3000)472 [✓] IAM — s3:GetObject on input: arn:aws:iam::123456789012:role/TextractProcessingRole473 [✓] IAM — s3:PutObject on output: arn:aws:iam::123456789012:role/TextractProcessingRole474 [✓] IAM — textract:StartDocumentAnalysis/GetDocumentAnalysis: TextractProcessingRole475 [✓] KMS encryption: arn:aws:kms:us-east-1:123456789012:key/abcd1234-... (input + output)476 [✓] SNS notification: arn:aws:sns:us-east-1:123456789012:TextractComplete (RoleArn TextractNotificationRole)477 [✓] OutputConfig: s3://doc-output/textract/<job-id>/478 [✓] Confidence threshold: 75% (route <75% to manual review)479 [✓] Document splitting: not required480VERIFICATION_COMMANDS:481 aws textract get-document-analysis --job-id <job-id> --region us-east-1482 aws s3 ls s3://doc-output/textract/<job-id>/ --recursive483```484485## Error handling486487InvalidS3Object, KMS AccessDenied, IN_PROGRESS/FAILED, ProvisionedThroughputExceeded, Lambda timeout, empty Queries — moved verbatim.488Full detail: [Error handling](references/error-handling.md).489490## References (load on demand)491492- [Async APIs and S3 output](references/async-and-s3.md) — async API mechanics, OutputConfig layout, KMS key policy, SNS notification role, document splitting493- [Sync APIs and Lambda](references/sync-and-lambda.md) — sync API limits, Lambda handler + IAM, bounding boxes and confidence filtering, Comprehend NLP chaining494- [Advanced patterns](references/advanced-patterns.md) — recent features (Queries, Signatures, Layout, Lending, OutputConfig CSV, region expansion)495- [Error handling](references/error-handling.md) — InvalidS3Object, KMS AccessDenied, job status, throughput, Lambda timeout, empty Queries496497## Domain498499AWS CloudOps / Amazon Textract Document Analysis & OCR Pipeline500Provisioning.501502## AWS documentation503504- **Textract Developer Guide** — https://docs.aws.amazon.com/textract/latest/dg/505- **AnalyzeDocument API** — https://docs.aws.amazon.com/textract/latest/dg/API_AnalyzeDocument.html506- **StartDocumentAnalysis API** — https://docs.aws.amazon.com/textract/latest/dg/API_StartDocumentAnalysis.html507- **DetectDocumentText API** — https://docs.aws.amazon.com/textract/latest/dg/API_DetectDocumentText.html508- **OutputConfig** — https://docs.aws.amazon.com/textract/latest/dg/API_OutputConfig.html509- **NotificationChannel** — https://docs.aws.amazon.com/textract/latest/dg/API_NotificationChannel.html510- **Queries feature** — https://docs.aws.amazon.com/textract/latest/dg/queryresponse.html511- **Expense Analysis** — https://docs.aws.amazon.com/textract/latest/dg/invoices-receipts.html512- **Identity Documents (AnalyzeID)** — https://docs.aws.amazon.com/textract/latest/dg/identitydocument.html513- **Textract quotas** — https://docs.aws.amazon.com/textract/latest/dg/limits-document.html514- **KMS encryption** — https://docs.aws.amazon.com/textract/latest/dg/security_iam_encrypt-with-kms.html