If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our vulnerability reporting page. Please do not create a public GitHub issue.
THIS APPLICATION IS A PII DETECTION AND REDACTION TOOL. WHILE IT USES ADVANCED AI AND OCR TECHNOLOGIES, IT IS NOT INFALLIBLE.
-
ALWAYS VERIFY REDACTIONS: Manually review all redacted documents to ensure:
- All PII has been detected and redacted
- No false positives (non-PII incorrectly redacted)
- No false negatives (PII missed by detection)
-
MULTIPLE VERIFICATION PASSES:
- Perform at least 2-3 independent reviews of redacted documents
- Use different reviewers for each pass
- Compare original and redacted versions side-by-side
-
SECURITY TEAM APPROVAL REQUIRED:
- Consult your organization's security team before deploying
- Obtain written approval for production use
- Establish review procedures and audit trails
-
COMPLIANCE VALIDATION:
- Verify compliance with applicable regulations (GDPR, HIPAA, CCPA, etc.)
- Document your verification process
- Maintain audit logs of all redactions
- AI models may hallucinate or miss PII
- OCR accuracy depends on document quality
- Complex layouts may cause detection failures
- AI models may have varying accuracy on unusual or context-specific PII types
Users are solely responsible for verifying the accuracy and completeness of all redactions. This tool is provided as-is without warranties of any kind.
You own your AWS infrastructure. You're responsible for securing your S3 buckets, DynamoDB tables, KMS keys, and IAM policies.
- Enable S3 Block Public Access on input and output buckets
- Use bucket policies with least privilege (Lambda execution role only)
- Enable S3 server-side encryption (SSE-KMS with customer keys recommended)
- Configure S3 access logging to track operations
- Set lifecycle policies to auto-delete documents after retention period
- Enable encryption at rest with customer-managed KMS keys
- Implement fine-grained access control:
- Table-level: IAM policies restricting access
- Record-level: DynamoDB condition keys for specific items
- Column-level: Attribute-based access for sensitive fields
- Enable point-in-time recovery for PII mappings table
- Configure CloudWatch alarms for unusual access
- Use customer-managed keys for sensitive data (input bucket, PII mappings)
- Set least privilege key policies (specific IAM roles only)
- Enable automatic key rotation (yearly)
- Use separate keys per service (S3, DynamoDB, SQS, CloudWatch)
- Enable CloudTrail logging for KMS API calls
- Set CloudWatch alarms for unusual key usage
- Use the provided least privilege templates for Lambda execution role
- Enable IAM Access Analyzer to catch overly permissive policies
- Add IAM condition keys for restrictions (source IP, MFA)
- Use AWS Organizations SCPs for multi-account guardrails
- Review and audit IAM policies regularly
- PII goes to Amazon Bedrock: this is required for AI detection to work
- Configure Bedrock in same region as S3 buckets (no cross-region transfer)
- Enable Bedrock opt-out to prevent AWS using your data for improvements
- Review AWS Bedrock data policies for compliance
- Document customer acknowledgment that PII will be processed by Bedrock
- Enable log encryption with customer-managed KMS keys
- Set retention policies (90+ days recommended)
- Add resource policies to prevent deletion
- Restrict DeleteLogGroup/DeleteLogStream permissions
- Export logs to S3 for long-term storage
- Enable CloudTrail to audit log modifications
- Enable SQS encryption with customer-managed KMS keys
- Configure dead-letter queue for failed messages
- Set message retention for your use case
Deploying Lambda in a VPC is optional but recommended for sensitive workloads. Set VpcSubnetIds and VpcSecurityGroupIds in your parameters file.
When deployed in a VPC, Lambda functions lose direct internet access. You must provide network connectivity to AWS services via VPC endpoints or NAT gateway.
Required VPC endpoints (if not using NAT gateway):
| Service | Endpoint Type | Required By |
|---|---|---|
| S3 | Gateway (free) | All Lambdas |
| DynamoDB | Gateway (free) | Router, Detection, Synthetic, Redact, Batch Trigger, Workflow Tracker |
| SQS | Interface | Router, Batch Trigger |
| Step Functions | Interface | Router |
| Bedrock Runtime | Interface | Detection, Synthetic, Redact |
| Textract | Interface | Detection, Redact |
| CloudWatch Logs | Interface | All Lambdas |
| KMS | Interface | All Lambdas (only if using customer-managed KMS keys) |
| STS | Interface | All Lambdas |
Security group requirements:
- Lambda security group: allow outbound HTTPS (443) to all destinations
- VPC endpoint security group (interface endpoints): allow inbound HTTPS (443) from the Lambda security group
If using NAT gateway: No VPC endpoints are required: Lambda traffic routes through NAT to reach all AWS services.
- Configure CloudWatch alarms for:
- Lambda errors and timeouts
- Unusual S3 access patterns
- DynamoDB throttling or anomalies
- KMS key usage spikes
- Enable AWS CloudTrail for API auditing
- Set up SNS notifications for critical events
- Add AWS Config rules for compliance monitoring
- Always verify redacted documents manually before sharing
- Use 2-3 independent reviewers
- Enable bounding box visualization to check PII coverage
- Test with sample documents before production
- Document your verification process for audits
The IaC templates ship with a secure baseline, but the following items are not enforced by default and are not covered elsewhere in this guide. Evaluate and apply them based on your compliance posture:
- SQS transport encryption policy. Beyond the at-rest SQS encryption in SQS Queue Security, the queues do not include a queue policy requiring SSL/TLS (the
aws:SecureTransportcondition). Add a deny policy for non-SSL access in production environments. - Lambda function-level Dead Letter Queue. The SQS redrive DLQ is provisioned, but the Lambda functions themselves do not set a function-level Dead Letter Queue, so asynchronous invocation failures (as distinct from SQS redrive) are not captured unless you add one.
- Container image pinning.
Dockerfile.layerreferencespublic.ecr.aws/sam/build-python3.13:latest. Pin this to a specific image digest for reproducible, tamper-resistant builds. - Lambda environment variable encryption. Lambda environment variables are encrypted at rest with AWS-managed keys by default. Pass a
kms_key_arnto theaws_lambda_functionresource if your compliance posture requires customer-managed envelope encryption. (Customer-managed KMS for S3, DynamoDB, SQS, and CloudWatch is covered in KMS Key Management.)
Each Lambda function gets its own IAM execution role (auto-created by CloudFormation). These roles need to be allowed in your bucket policies.
| Lambda | Input Bucket | Output Bucket |
|---|---|---|
| Router | s3:ListBucket |
None |
| Detection | s3:GetObject |
s3:PutObject |
| Synthetic | None | s3:GetObject, s3:PutObject |
| Redact | s3:GetObject |
s3:GetObject, s3:PutObject |
| Batch Trigger | s3:ListBucket |
None |
| S3 Notification | s3:GetBucketNotification, s3:PutBucketNotification |
None |
| Workflow Tracker | None | None |
- S3 buckets created with Block Public Access
- Customer-managed KMS keys created (if required)
- IAM policies follow least privilege
- VPC endpoints or NAT gateway configured (if using VPC)
- Security group allows outbound HTTPS (443)
- CloudWatch alarms set up
- CloudTrail enabled
- Security team approved deployment
- Compliance requirements documented (GDPR, HIPAA, etc.)
- Manual verification procedures established
- Incident response plan ready
Data Flow:
- Documents with PII → Encrypted S3 (customer KMS)
- Lambda → Bedrock (PII sent for AI) → Textract (OCR)
- PII mappings → Encrypted DynamoDB (customer KMS)
- Redacted documents → Encrypted S3 (customer KMS)
- All operations → Encrypted CloudWatch Logs (customer KMS)
Trust Boundaries:
- Customer AWS Account ↔ AWS Bedrock (PII crosses here)
- Lambda Role ↔ Customer Resources (S3, DynamoDB, KMS)
- Input Bucket ↔ Output Bucket (PII transformation)