Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 38 ยท Network and Data Protection

Data Classification, DLP and Backup Protection

Classify cloud data, find sensitive information with pattern matching and checksums, prevent data loss, and protect backups from ransomware with the 3-2-1 rule, plus runnable examples.

You cannot protect data you do not know about. The final lesson of this chapter ties the data controls together: first decide how sensitive each kind of data is, then find where it lives, then put the right protections around it, including backups that survive an attack. We build a small sensitive-data finder and a backup health check along the way.

Data classification

Classification means labeling data by how much harm its exposure would cause. A common four-level scheme:

Level Examples Typical handling
Public Marketing pages, published docs No special controls
Internal Org charts, internal wiki Employees only
Confidential Customer records, contracts, source code Encryption, need-to-know access, logging
Restricted Payment card data, health records, secrets, keys Strongest controls, minimal copies, strict audit

Make classification practical:

  1. Define the levels once and give an example of each.
  2. Label at the source with tags on buckets, databases and tables, or labels on documents.
  3. Tie controls to labels. For example: restricted data requires customer-managed keys, private networking and access logging; policies check the tag.
  4. Assign owners who decide the label and approve access.
  5. Review when the purpose of data changes.

Know your regulated data

Laws and standards define special categories: personal data (names, emails, identifiers), special categories such as health or biometric data, payment card data, and financial or government identifiers. We return to them in the governance chapter. For now, remember that knowing where personal data lives is a prerequisite for protecting it and for answering deletion requests.

Discovering sensitive data

Cloud providers offer data discovery services that scan storage and databases for sensitive patterns using pattern matching and machine learning. The idea is easy to model: search text for patterns (emails, card numbers, national identifiers) and reduce false positives with validity checks, such as the Luhn checksum that payment card numbers satisfy.

The program below scans made-up text. The card numbers are well-known test values and the other data is invented.

Python Find sensitive data with patterns and checksums

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The 16-digit values in order-ids.csv look like card numbers but fail the Luhn check, so they are correctly ignored. Real scanners also use context, such as nearby words like "card", to lower false positives further.

Data loss prevention (DLP)

DLP controls reduce the chance that sensitive data leaves where it belongs. In the cloud it usually combines:

  • Discovery and labeling as above.
  • Policy rules that block or alert when labeled data is shared externally, emailed, uploaded to unapproved apps or made public.
  • Egress controls such as firewall rules and proxies that limit where workloads can send data.
  • Masking and tokenization. Replace real values with masked or random tokens in test and analytics environments, as the mask function above does for cards. Tokenization stores the real value in a vault and gives applications a meaningless token.
  • Least data. Do not collect or keep data you do not need. Data you do not have cannot leak.
  • Retention rules that delete data after its purpose ends.
  • Monitoring for unusual downloads, large exports and access from new locations.

Data protection chain

Classify Label by sensitivity
Discover Scan for hidden data
Protect Encrypt, restrict, mask
Monitor Alert on leaks

Each step feeds the next; skip one and the chain breaks.

1 / 2

Backups and ransomware resilience

Backups are your last line of defense against deletion, corruption and ransomware, but only if the attacker cannot destroy them too. Modern attacks target backups first.

  • The 3-2-1 rule: keep at least 3 copies of data, on 2 different kinds of storage, with 1 copy offsite or in a separate account. A common cloud version adds "1 immutable".
  • Immutability. Use object lock or WORM (write once, read many) retention so backups cannot be changed or deleted before their retention date, even by an administrator.
  • Separate account and credentials. Backups live in a different account with different administrators, so one stolen admin credential cannot delete everything.
  • Versioning on storage keeps previous versions of overwritten or deleted objects.
  • Encrypt backups with a key that is also protected and backed up (losing the key means losing the backup).
  • Test restores. A backup you have never restored is a hope, not a backup. Measure recovery time (RTO) and recovery point (RPO) against what the business needs.
  • Monitor backup jobs and alert on failures and on unusual deletions.
flowchart LR
    P["Production<br/>account"] -->|"scheduled copy"| B["Backup account<br/>immutable, versioned"]
    B -->|"periodic copy"| R["Second region"]
    B -.->|"restore test"| T["Test environment"]

Backups sit in a separate account and region, with immutability and regular restore tests.

Runnable example: backup health check

The checker below evaluates a backup catalog against the rules: the 3-2-1 rule, immutability, recency (RPO) and a restore test within the last quarter. All data is invented.

Python Check backups against 3-2-1 and RPO

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

orders-db passes every check; uploads fails almost all of them, which is typical of data nobody thought was important until it was lost.

Retention versus deletion rights. Immutable backups conflict with the need to erase personal data on request. Plan for it: keep backup retention short and documented, and be able to show that deleted data ages out of backups on schedule.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Why do scanners use a Luhn check when looking for card numbers?

    Valid card numbers satisfy the Luhn checksum, so failing it means the digits are probably something else.
  2. 2. What does the 3-2-1 backup rule mean?

    Multiple copies on different media and one separate copy protect against many failure types.
  3. 3. Why are immutable backups important against ransomware?

    Ransomware operators often try to destroy backups first; object lock prevents that.
  4. 4. What is tokenization?

    Applications use tokens instead of real data, so a leak of the tokens reveals nothing.
  5. 5. When is a backup truly proven to work?

    Only a restore test shows that the data is complete and can be recovered within the required time.

Summary

  • Classify data into a small number of levels, label it at the source and tie controls to labels.
  • Discovery tools find sensitive data with patterns, checksums and context; masking and tokenization limit exposure.
  • DLP combines labeling, policy, egress control, monitoring and collecting less data.
  • Protect backups with 3-2-1, separate accounts, immutability, encryption and regular restore tests.

Next: Container Image Security