Lesson 6 of 6 Data Security

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.

ToolWhat it does
Redshift dynamic data maskingMasks values at query time according to the user's role
Lake Formation column and cell filtersHide sensitive columns and cells in the lake
Glue sensitive data detectionFinds PII in ETL jobs and redacts, hashes or partially masks it
DataBrew masking transformsMask during preparation
CloudWatch Logs data protectionMasks sensitive data in log events
Match the pairs

Masking tools

Exam skills 4.3.1

Match each requirement with the masking tool.

Log in to try this activity Interactive activities are free with an account.

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.

TechniqueEffect
RedactionRemoves the value entirely
Partial maskingShows part of the value, such as the last four digits of a card
HashingReplaces the value consistently, so joins still work, but cannot be reversed
TokenisationReplaces the value with a token that authorised systems can map back

The following diagram shows one ticket before and after masking.

Masking a support ticket during ETL. Glue sensitive data detection finds the email address, phone number and name in the free text. The email is hashed so the same customer can still be linked across tickets, the phone number keeps its last two digits, and the name is redacted. The curated table is pseudonymised personal data.
The ticket text, hash and number are illustrative.
Match the pairs

Masking techniques

Exam skills 4.3.1

Match each requirement with the masking technique.

Log in to try this activity Interactive activities are free with an account.

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.

True or false

Anonymisation and pseudonymisation

Exam skills 4.3.1 · 4.5.5

Decide whether each statement is true.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

EntityAction
Email addressesHash, so the same customer can still be linked across tickets
Phone numbersPartially mask, keeping the last two digits
Person namesRedact

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.

Check yourself

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.