Masking and Redacting Sensitive Data
This lesson explains how masking hides sensitive values from people who use a system but do not need to see them, so analysts can work with data while personal details stay hidden.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the services that mask data and where each applies.
- Choose between redaction, partial masking, hashing and tokenisation.
- Distinguish anonymisation from pseudonymisation.
Tools
Several services hide sensitive values, at different points. Redshift dynamic data masking masks values when they are queried, according to the user's role, so the stored data is unchanged. Lake Formation column and cell filters hide sensitive columns and cells in the lake from users who lack permission. Glue sensitive data detection finds personally identifiable information (PII) during ETL and redacts, hashes or partially masks it before it is written. DataBrew masking transforms do the same during data preparation, and CloudWatch Logs data protection masks sensitive data that appears in log events. The following table summarises the tools.
| Tool | What it does |
|---|---|
| Redshift dynamic data masking | Masks values at query time according to the user's role |
| Lake Formation column and cell filters | Hide sensitive columns and cells in the lake |
| Glue sensitive data detection | Finds PII in ETL jobs and redacts, hashes or partially masks it |
| DataBrew masking transforms | Mask during preparation |
| CloudWatch Logs data protection | Masks sensitive data in log events |
Masking tools
Techniques
The masking technique decides what remains usable. Redaction removes the value entirely, which is safest when nobody downstream needs it. Partial masking shows part of the value, such as the last four digits of a card, so support staff can confirm a card without seeing it. Hashing replaces a value with a consistent result that cannot be reversed: the same email always produces the same hash, so tables can still be joined and counted on it. Tokenisation replaces the value with a token that authorised systems can map back to the original, for processes that occasionally need it. The following table summarises the techniques.
| Technique | Effect |
|---|---|
| Redaction | Removes the value entirely |
| Partial masking | Shows part of the value, such as the last four digits of a card |
| Hashing | Replaces the value consistently, so joins still work, but cannot be reversed |
| Tokenisation | Replaces the value with a token that authorised systems can map back |
The following diagram shows one ticket before and after masking.

Masking techniques
Anonymisation and pseudonymisation
Two techniques reduce the privacy risk of data about people, and they differ in whether individuals can be re-identified. Anonymisation removes or transforms identifying information so that people cannot be re-identified, even by combining fields. Properly anonymised data falls outside many privacy regulations, but anonymisation is difficult to achieve, because combinations of ordinary fields, such as postcode, birth date and gender, can identify individuals.
Pseudonymisation replaces identifiers with tokens or hashes. The data remains personal data under regulations such as the GDPR, because it can be linked back to individuals by whoever holds the mapping, but exposure is reduced, and analysts can still count, join and track records for the same person without seeing who it is.
Anonymisation and pseudonymisation
Masking PII during ETL
Raw support tickets contain customer names, emails and phone numbers in free text. Data scientists need the text for analysis but must not see personal details. The Glue job applies sensitive data detection with the actions described in the following table.
| Entity | Action |
|---|---|
| Email addresses | Hash, so the same customer can still be linked across tickets |
| Phone numbers | Partially mask, keeping the last two digits |
| Person names | Redact |
The curated table contains no direct identifiers, so data scientists receive access to it, while the raw zone remains restricted. Because hashed emails can still be linked to a person, the curated data is treated as pseudonymised personal data.
How can sensitive values be masked at query time by role in Redshift?
Show answer
With dynamic data masking.
Exam Tips
Remember for the exam
- To redact or hash PII during ETL, use Glue sensitive data detection.
- To mask values at query time by role in Redshift, use dynamic data masking.
- To hide sensitive lake columns, use Lake Formation column or cell filters.
- Hashing keeps joins working while hiding the original value.
- Pseudonymised data is still personal data; anonymised data is not.