Google Cloud

Sensitive Data Protection (formerly Cloud DLP) Complete Guide: PII Detection & Masking on GCP

2026-05-24
NicheeLab Editorial Team

Sensitive Data Protection (formerly Cloud DLP) is GCP's service for detecting and masking PII (Personally Identifiable Information). With 200+ built-in infoTypes and the Discovery feature, it automatically surfaces sensitive data in large-scale datasets. Rebranded in 2024, it has evolved into a unified platform combining Discovery and De-identification.

Key Features

  • Inspection: Detect PII in text, images, and structured data
  • Discovery: Automatic PII cataloging across BigQuery, Cloud SQL, and GCS
  • De-identification: Masking, Tokenization, and FPE
  • Risk Analysis: k-anonymity and l-diversity evaluation
  • Custom InfoTypes: Custom detection using regex or dictionary lists
  • Pub/Sub Integration: Real-time masking

Sample InfoTypes

CategoryInfoType
PersonalPERSON_NAME, EMAIL_ADDRESS, PHONE_NUMBER
FinancialCREDIT_CARD_NUMBER, IBAN_CODE, SWIFT_CODE
Government IDJAPAN_INDIVIDUAL_NUMBER (My Number), US_SOCIAL_SECURITY_NUMBER
MedicalJAPAN_HEALTH_INSURANCE_NUMBER, US_DRUG_ENFORCEMENT_AGENCY_NUMBER
ITIP_ADDRESS, MAC_ADDRESS, URL
LocationSTREET_ADDRESS, LOCATION
BiometricFACE_DETECTION (images)

Discovery: Auto PII Scanning on BigQuery

# Discovery Scan Config 作成
gcloud dlp discovery-configs create \
  --location=global \
  --project=my-project \
  --discovery-config-from-file=config.yaml

# config.yaml
displayName: "BQ PII Discovery"
status: RUNNING
targets:
  - bigQueryTarget:
      filter:
        otherTables: {}
      cadence:
        updateFrequency: UPDATE_FREQUENCY_DAILY
inspectTemplates:
  - "projects/my-project/inspectTemplates/pii-template"

Inspection Example (Python)

from google.cloud import dlp_v2

client = dlp_v2.DlpServiceClient()
parent = f"projects/my-project/locations/global"

inspect_config = {
    "info_types": [
        {"name": "EMAIL_ADDRESS"},
        {"name": "PHONE_NUMBER"},
        {"name": "JAPAN_INDIVIDUAL_NUMBER"},
    ],
    "min_likelihood": dlp_v2.Likelihood.POSSIBLE,
    "include_quote": True,
}

item = {"value": "山田太郎、メール: [email protected]、電話: 03-1234-5678、マイナンバー: 123456789012"}
response = client.inspect_content(
    request={"parent": parent, "inspect_config": inspect_config, "item": item}
)

for finding in response.result.findings:
    print(f"{finding.info_type.name}: {finding.quote} ({finding.likelihood.name})")
# 出力:
# EMAIL_ADDRESS: [email protected] (LIKELY)
# PHONE_NUMBER: 03-1234-5678 (LIKELY)
# JAPAN_INDIVIDUAL_NUMBER: 123456789012 (VERY_LIKELY)

De-identification Methods

MethodExampleReversibleUse Case
Masking***-****-1234NoDisplay
TokenizationUSR-A1B2C3Yes (lookup table)Analytics
Format-preserving Encryption4111-2222-3333 → 7281-9302-5841Yes (key)Format preservation
BucketingAge 32 → 30-39NoStatistical analytics
Date Shift2026-05-24 → 2026-05-15Yes (offset stored)Preserves time series
Cryptographic HashingSHA-256NoID generation

Pub/Sub Real-time Anonymization Pipeline

# Cloud Function でメッセージ受信時にマスキング
def deidentify_message(event, context):
    from google.cloud import dlp_v2
    import base64, json

    message = base64.b64decode(event['data']).decode('utf-8')
    data = json.loads(message)

    client = dlp_v2.DlpServiceClient()
    response = client.deidentify_content(
        request={
            "parent": "projects/my-project/locations/global",
            "deidentify_config": {
                "info_type_transformations": {
                    "transformations": [{
                        "primitive_transformation": {
                            "character_mask_config": {
                                "masking_character": "*",
                                "number_to_mask": 0,
                            }
                        }
                    }]
                }
            },
            "inspect_config": {
                "info_types": [{"name": "EMAIL_ADDRESS"}, {"name": "PHONE_NUMBER"}],
            },
            "item": {"value": data.get('text', '')},
        }
    )
    # マスク済みデータを別 Topic に転送
    publish_to_clean_topic(response.item.value)

Pricing Examples

ItemPrice
Storage Inspection (BQ/GCS)$1.50/GB
Discovery (continuous scan)$1.00/GB
Streaming (Pub/Sub)$0.05/GB
API Inspection$0.01/1000 unit
De-identificationSame as Inspection

Typical Use Cases

  • Finance: Automatic masking of customer PII (for Looker and analytics)
  • Healthcare: De-identification of medical records (for research)
  • Customer support: PII masking on call recordings
  • SaaS: Monitoring tenant data leakage risk
  • GDPR: Periodic scans of EU personal data
  • Security audits: PII cataloging across all BigQuery tables

What is the relationship between Sensitive Data Protection and Cloud DLP?

They are the same service, rebranded in 2024. Cloud DLP was renamed to Sensitive Data Protection. Features and APIs are unchanged.

Which PII types are supported?

200+ built-in infoTypes: credit cards, SSN, Japan Individual Number (My Number), phone numbers, emails, IP addresses, medical codes, and more. Japanese types (My Number, Health Insurance Number, etc.) are supported.

What is Discovery?

Automatic PII discovery across BigQuery, Cloud SQL, and GCS. It catalogs sensitive data automatically across terabyte-scale datasets and integrates with Dataplex.

What de-identification methods are available?

Masking (****), Tokenization (pseudo IDs), Format-preserving Encryption (preserves the original format), Bucketing (e.g. age → age range), and Date Shift (offset dates).

Can data be re-identified?

Format-preserving Encryption and Tokenization can be reversed with a key. Masking and Bucketing are irreversible. Choose the method that fits your use case.

What is the pricing model?

Inspection: $1.00/GB (Discovery), $1.50/GB (Storage Inspection), $0.05/GB (Streaming). De-identification is priced the same as Inspection.

How does it compare with AWS Macie and Azure Purview?

All three detect PII. GCP offers the most infoTypes, Japanese language support, and Discovery at scale. Macie focuses on S3; Purview is tightly integrated with Microsoft 365 and Azure.

Is real-time monitoring possible?

Yes. You can detect and mask PII in real time via the DLP API as messages flow through Pub/Sub, and also before Streaming Inserts into BigQuery.

Related: Security & Privacy

Database Migration Service (DMS) 完全ガイド|Oracle/MySQL/PG → Cloud SQL/AlloyDB (GCP)

Google Cloud Database Migration Service の全機能解説。Oracle / MySQL / PostgreSQL / SQL Server / MongoDB → Cloud SQL / AlloyDB / BigQuery / Firestore 移行。Heterogeneous 移行、Continuous Migration、料金、AWS DMS 比較を 2026 年最新版で網羅。

GCP Associate Data Practitioner (ADP) 完全ガイド|2024 新試験・BigQuery・SQL 中心

Google Cloud Associate Data Practitioner (ADP、2024 新設) の試験範囲、BigQuery / Cloud Composer / Dataform / Looker Studio、SQL スキル要件、AWS DEA / Databricks DE / Azure DP-700 比較を詳解。

GCP Professional Cloud Developer (PCD) 完全ガイド|Cloud Run・GKE・CI/CD・APM

Google Cloud Professional Cloud Developer の試験範囲、Cloud Run / GKE / Cloud Build / Cloud Trace、AWS DVA / Azure AZ-204 比較、学習ロードマップを徹底解説。

GCP Professional Cloud Database Engineer (PCDBE) 完全ガイド|Spanner・AlloyDB・Cloud SQL

Google Cloud Professional Cloud Database Engineer の試験範囲、Spanner / AlloyDB / Cloud SQL / Bigtable / Firestore、AWS DBS・Azure DP-300 比較を詳解。

* Google Cloud is a trademark of Google LLC. For the latest information, see the official Sensitive Data Protection documentation.

Check what you learned with practice questions

Practice with certification-focused question sets

Go to the GCP exam prep page
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Google Cloud

Google Cloud Certification Roadmap (2026)

Choose your GCP certification path — Foundational, Associate...

Google Cloud

CDL Cloud Digital Leader: Complete Exam Guide (2026)

Pass the Cloud Digital Leader exam — cloud business value, G...

Google Cloud

GAIL Generative AI Leader: Complete Exam Guide (2026)

Pass the Generative AI Leader exam — Gemini, Vertex AI, Work...

Google Cloud

Vertex AI Fundamentals for GCP Certs (2026)

Vertex AI basics every cert candidate needs — Workbench, Pip...

Google Cloud

Associate Cloud Engineer (ACE): Complete Guide (2026)

Pass the Associate Cloud Engineer exam — Console, gcloud, pr...

Browse all Google Cloud articles (103)
© 2026 NicheeLab All rights reserved.