Home › AWS › AWS data services › Comprehend
AWS data services · ML and AI · about 10 min read
Amazon Comprehend (incl. PII detection)
Ready-made text analysis on AWS: finds personal data, entities, key phrases, language and sentiment in free text, with no model to train.
In plain words
What it is
Free text is any field where people type what they like: a warranty note, a service ticket, a store manager's comment, a call-centre summary. It is useful, and also risky, because people type names, phone numbers, email addresses and account numbers into it. Structured columns can be checked by name; free text has to be read.
Amazon Comprehend is an AWS service that reads text with models AWS has already trained. You send text and get back what it found. The feature this platform cares about is PII detection. PII means personally identifiable information. Comprehend returns each piece of personal data it found, such as a name, address, phone number, email or bank account, with its type, position in the text and a confidence score. It can also return a copy of the text with those pieces masked. Other features find general entities, key phrases, the language of the text and sentiment, and you can train custom classifiers and custom entity recognisers.
A concrete example: a dealer writes, 'Customer Anna Silva, phone 555 0182, reports sidewall bulge after 3,000 km on the left front tyre.' Before that note enters bronze, the lander sends it to Comprehend. Comprehend returns a NAME at characters 9 to 19 and a PHONE at 27 to 35, each with a confidence above 0.99. The lander swaps both for tokens. Bronze stores, 'Customer [NAME_7f3a], phone [PHONE_91c2], reports sidewall bulge after 3,000 km on the left front tyre.' The real values go only to the separate token vault.
Comprehend has limits that matter. PII detection works in English and Spanish only. Synchronous calls accept up to 100 KB of text, and batch jobs up to 1 MB per document. Some older features are closed to new customers.
A trained proofreader at the door who underlines every name and phone number in a letter before it is filed, but who reads only English and Spanish.
Big picture
Where it fits
The lit lane is where Comprehend works. Boxes on the left feed it; boxes on the right use what it produces.
Comprehend sits at the very start of the data path, inside the lander that moves files from landing to bronze, although its group on this site is ML. The platform's privacy rule is 'tokenise at the door'. The lander swaps names, phone numbers and emails for tokens before bronze, so bronze, silver and gold never hold real personal values. Structured columns are tokenised by their declared PII tags. Free-text fields, such as warranty notes, go through a personal-data detector behind a port.
The port is the key design choice. The lander calls an internal interface, 'find personal data in this text in this language', and an adapter does the work. Comprehend is one adapter. Because the plants and dealers write in English and German, the platform design says the detector must handle both. Comprehend covers English and Spanish, so a second adapter, such as Presidio with German models, is needed for German text. Until that is confirmed, EU free text is held out of bronze.
Downstream, Macie scans the landing buckets weekly for personal data in the wrong place, as a safety net. Unity Catalog's data classification and column masks protect structured columns. Comprehend is the targeted tool for the one place structured rules cannot reach: the inside of free text.
How it works
The ideas you need
| Idea | What it means |
|---|---|
| PII entity | A piece of personal data found in text, such as NAME, ADDRESS, PHONE, EMAIL or BANK_ACCOUNT_NUMBER, with its position and a confidence score. |
| DetectPiiEntities | The synchronous call that returns the PII entities found in one document of up to 100 KB. |
| ContainsPiiEntities | A cheaper synchronous call that says only which PII types appear, without positions. |
| Redaction job | An asynchronous PII job over files in S3 that writes masked copies of the text back to S3. |
| Confidence score | A number from 0 to 1 for how sure the model is; you pick a threshold above which you mask. |
| Synchronous and asynchronous | Synchronous calls answer one request at once; asynchronous jobs process many files in S3 and finish later. |
| Custom classifier and custom entity recogniser | Models you train on your own labelled examples, for example to tag warranty notes by failure type. |
| Port and adapter | An internal interface the platform calls, with Comprehend as one replaceable implementation behind it. |
Choosing
When to use it, and when not
Use it when
- You must find personal data inside English or Spanish free text before it enters the lakehouse.
- You want a managed detector with no model to host, called from a Lambda or a lander job inside the AWS account.
- You have large backlogs of text files in S3 to mask once, where an asynchronous redaction job fits.
- You need key phrases, entities or language detection on support tickets or reviews, and a general model is good enough.
- You want a custom classifier for a fixed set of labels, such as failure categories, trained on a few thousand examples.
Avoid it when
- The text is in German, French, Italian or another language Comprehend's PII detection does not support.
- You are a new customer who needs topic modeling, event detection or prompt safety classification; those are closed to new customers.
- Personal data is in structured columns with known names; tag and tokenise those directly, which is cheaper and certain.
- You need open-ended extraction such as 'which part failed and why'; an LLM through the model port does it better.
Production grade
What goes wrong in production
| Problem | What breaks | What to do |
|---|---|---|
| Language gaps | German dealer notes go to Comprehend, which supports only English and Spanish PII detection, and names pass through unmasked. | Detect language first, route each language to an adapter that supports it, and hold any text with no supported adapter out of bronze. |
| Missed personal data | A detector misses a name spelled oddly or a phone number in a local format, so real data reaches bronze. | Set a low confidence threshold for masking, add pattern rules for local formats, and let Macie scan landing as a second check. |
| Over-masking | Tyre model names or plant names are tagged as person names and masked, so engineers lose useful words. | Keep an allow list of product, plant and part names, and review a sample of masked notes each month with the data owner. |
| Size limits | A long service report exceeds 100 KB and the synchronous call fails. | Split text into chunks on sentence boundaries, or use an asynchronous job, which accepts up to 1 MB per document. |
| Throttling at peak | A big backlog of notes arrives after a holiday, and synchronous calls are throttled. | Use asynchronous jobs for backlogs, add retries with backoff in the lander, and alarm on throttled requests. |
| Features closed to new customers | A design that relies on Comprehend topic modeling or event detection cannot be built in a new account. | Use a Bedrock model or a Databricks AI function for topics and events, behind the same port. |
Alternatives
What to compare it with
| Alternative | Pick the alternative when | Pick Comprehend when |
|---|---|---|
| Microsoft Presidio (open source) | You need German or other languages, custom recognisers, and full control, running in your own jobs. | You do not want to run and tune models and pattern rules yourself. |
| Databricks AI functions such as ai_mask | Text is already in a governed table and you want masking in SQL, with the model choice made in Databricks. | Text must be masked before it is ever written to a table. |
| Amazon Bedrock with Guardrails' PII filter | You already call an LLM on the text and want masking in the same step, or need more languages. | You want a cheap, deterministic-like detector at high volume. |
| Amazon Macie | You want to scan S3 buckets on a schedule to find personal data in the wrong place. | You need to mask text inline before it lands in bronze. |
| Azure AI Language PII detection | You are on Azure, or need its wider language list. | You need everything inside the AWS account. |
| Google Sensitive Data Protection | You are on Google Cloud. | You are on AWS. |
Cost
How you pay
Comprehend charges per unit of 100 characters of text processed, with a minimum charge of three units per request, and different prices for each feature. ContainsPiiEntities is priced lower than DetectPiiEntities. Asynchronous jobs are charged on the same text units. Custom models also charge for training time, model storage and, for real-time use, endpoints billed per inference unit per second. Check the Comprehend pricing page for current prices in your region.
What drives the bill
- Total characters of free text sent each month.
- Number of requests, because of the per-request minimum on short notes.
- Which features run on each text, since each is billed separately.
- Custom classifier endpoints left running.
Cost traps
- Sending every short field one call at a time pays the minimum charge again and again.
- Running PII detection on text that has already been masked upstream.
- Custom classifier endpoints bill per second even when idle.
- Running both ContainsPiiEntities and DetectPiiEntities on every note when one call is enough.
Prices change; check the AWS pricing page for your region before deciding.
Security and governance
Keeping it safe
- Call Comprehend through a VPC interface endpoint from the lander's private subnet so text does not cross the internet.
- Grant the lander role only the PII calls it needs, and give asynchronous jobs a data access role limited to the landing and output prefixes.
- Encrypt asynchronous job input, output and custom model volumes with customer managed KMS keys.
- Do not log the raw text or the detected values; log only counts, types and a record id.
- Delete landing files with personal data one day after the lander reads them, as the platform's privacy rules require.
- CloudTrail records Comprehend API calls; include the lander's role in the quarterly access review.
Operating it
What to watch, and the limits
| Watch | Why |
|---|---|
| SuccessfulRequestCount | Calls that worked, per operation; should track the volume of free-text records. |
| ThrottledCount | Throttled synchronous calls; rising values mean the lander needs backoff or batching. |
| ClientErrorCount and ServerErrorCount | Failed calls, such as oversized documents or unsupported languages. |
| Records held out of bronze | Notes held because their language has no supported detector; this should fall to zero once a second adapter is live. |
| PII found per 1,000 notes | From the lander's run log; a sudden drop may mean the detector stopped working. |
| Macie findings in landing | Personal data that the detector missed, found by the weekly Macie scan. |
| Limit | Value and notes |
|---|---|
| PII detection languages | English and Spanish only |
| Synchronous document size | 100 KB of UTF-8 text for entities and PII detection |
| Asynchronous document size | 1 MB per document; up to 5 GB per job |
| Asynchronous jobs | Up to 10 active jobs per operation |
| Closed features | Topic modeling, event detection and prompt safety classification closed to new customers |
Limits and quotas checked 2026-11-11; many can be raised through Service Quotas.
Decisions
Situations and verdicts
| Situation | Choice | Verdict |
|---|---|---|
| English warranty notes from UK and US dealers | Comprehend DetectPiiEntities in the lander behind the detector port, tokens before bronze | Pursue with care: fits well; keep a low threshold and a Macie safety net. |
| German warranty notes from EU dealers | Presidio with German models as a second adapter, or hold the text out of bronze until one is confirmed | Drop Comprehend for this text: it does not support German PII detection. |
| Group ten thousand notes into topics | A Bedrock model or Databricks ai_classify over tokenised silver text | Drop Comprehend topic modeling: closed to new customers. |
| Mask a one-off backlog of old service reports in S3 | Comprehend asynchronous PII redaction job to a new prefix, then delete the originals | Pursue: simple and cheap for English text. |
FAQ
Questions people ask
Which languages does Amazon Comprehend PII detection support?
English and Spanish. Other Comprehend features, such as general entity detection, support more languages, but PII detection and redaction do not. Route other languages to another detector.
Is Amazon Comprehend being discontinued?
No. Three features, topic modeling, event detection and prompt safety classification, are closed to new customers, and AWS suggests Bedrock models and Guardrails for them. PII detection, entities, key phrases, sentiment and custom models remain available.
Comprehend or Macie for finding personal data?
Macie scans S3 buckets on a schedule and reports where personal data sits. Comprehend reads text you send it, at once, so you can mask before storing. This platform uses both: Comprehend in the lander, Macie as the weekly check on landing.
Can Comprehend mask PII automatically?
Yes. An asynchronous PII job can write redacted copies of text files to S3, replacing each found entity with its type or a mask character. For inline tokenising, call DetectPiiEntities and replace the spans yourself.
How accurate is Comprehend PII detection?
It is good on common English formats, but no detector is perfect. Measure it on a labelled sample of your own notes, choose a low threshold for masking, and keep a second check downstream.
Sources
Checked against
- AWS docs: Languages supported in Amazon Comprehend
- AWS docs: Comprehend feature availability change
- AWS docs: Comprehend guidelines and quotas
- AWS docs: DetectPiiEntities API
- AWS: Comprehend pricing
Checked 2026-11-11.
Related
Where it connects
AWS and Databricks reference platform · Ingestion design · Amazon Macie · Amazon Bedrock · Medallion architecture · All AWS data services
← Bedrock · SageMaker AI →