Detecting Personally Identifiable Information (PII) - Amazon Comprehend

Detecting Personally Identifiable Information (PII)

To detect entities that contain personally identifiable information (PII) in a document, use the Amazon Comprehend DetectPiiEntities operation.

Detecting PII Using the AWS Command Line Interface

The following example uses the DetectPiiEntities operation with the AWS CLI.

The example is formatted for Unix, Linux, and macOS. For Windows, replace the backslash (\) Unix continuation character at the end of each line with a caret (^).

aws comprehend detect-pii-entities \ --text "Hello Paul Santos. The latest statement for your credit card \ account 1111-0000-1111-0000 was mailed to 123 Any Street, Seattle, WA \ 98109." \ --language-code en

Amazon Comprehend responds with the following:

{ "Entities": [ { "Score": 0.9999669790267944, "Type": "NAME", "BeginOffset": 6, "EndOffset": 18 }, { "Score": 0.8905550241470337, "Type": "CREDIT_DEBIT_NUMBER", "BeginOffset": 69, "EndOffset": 88 }, { "Score": 0.9999889731407166, "Type": "ADDRESS", "BeginOffset": 103, "EndOffset": 138 } ] }