Back to Blog
AWS Glue Data Catalog for AI Data Governance
Technical Guide·10 min read·

AWS Glue Data Catalog for AI Data Governance

C

Claw GRC Team

Claw GRC Team

How to use AWS Glue Data Catalog and Lake Formation for AI data governance, training data documentation, lineage tracking, and compliance with NIST AI RMF, ISO 42001, and EU AI Act.

AWS Glue Data Catalog for AI Data Governance

Every AI compliance framework converges on the same requirement: you must document and govern the data that trains, tunes, and grounds your models. The EU AI Act makes it legally binding. NIST AI RMF makes it a best practice. ISO 42001 makes it a certification requirement. SOC 2 auditors are starting to ask about it.

The problem is that most organizations have no idea what data their ML pipelines consume. Training datasets are scattered across S3 buckets with vague names. Data lineage exists only in the heads of the engineers who built the pipeline. When an auditor asks "what data trained this model, where did it come from, and who approved its use?" the answer is usually an uncomfortable silence.

AWS Glue Data Catalog solves this by providing a centralized metadata repository for every dataset in your AI pipeline. Combined with Lake Formation for access control and Glue Data Quality for validation, it gives you a governance layer that satisfies auditors and protects your organization.


Why Data Governance Matters for AI Compliance

Data governance for AI is not the same as traditional data governance. Traditional data governance focuses on data quality, access control, and retention. AI data governance adds three additional dimensions:

Provenance and consent. Where did the training data come from? Was it collected with informed consent? Does it include data from jurisdictions with restrictions on AI training use? The EU AI Act Article 10 requires "appropriate data governance and management practices" for training data. You need metadata that answers these questions.

Bias and representativeness. Is the training dataset representative of the population the model will serve? Are certain demographics underrepresented? NIST AI RMF Measure 2.6 requires bias evaluation, and that starts with understanding the composition of your training data.

Integrity and tampering. Can you prove that training data was not modified between collection and training? NIST AI RMF MS.2.1 requires test set integrity. If an attacker poisons your training data, you need lineage records that help you identify the scope of the compromise.

Glue Data Catalog addresses all three dimensions through structured metadata, automated classification, and integration with the broader AWS governance ecosystem.


Setting Up Glue Data Catalog for Training Data

The first step is registering your training datasets in the Glue Data Catalog with rich metadata that supports compliance queries.

Creating a Governed Training Data Database

import boto3
from datetime import datetime

glue = boto3.client("glue")

# Create a database specifically for ML training data
glue.create_database(
    DatabaseInput={
        "Name": "ml_training_data",
        "Description": "Governed training datasets for ML models",
        "Parameters": {
            "governance_owner": "ml-platform-team",
            "data_classification": "confidential",
            "compliance_frameworks": "nist-ai-rmf,iso-42001,eu-ai-act",
            "retention_policy": "7-years",
            "created_by": "data-governance-automation",
        },
    }
)

# Register a training dataset as a table with compliance metadata
glue.create_table(
    DatabaseName="ml_training_data",
    TableInput={
        "Name": "customer_churn_training_v3",
        "Description": "Customer churn prediction training data - enterprise accounts",
        "StorageDescriptor": {
            "Columns": [
                {"Name": "account_id", "Type": "string", "Comment": "Anonymized account identifier"},
                {"Name": "industry", "Type": "string", "Comment": "Industry vertical classification"},
                {"Name": "region", "Type": "string", "Comment": "Geographic region"},
                {"Name": "tenure_months", "Type": "int", "Comment": "Account tenure in months"},
                {"Name": "monthly_usage", "Type": "double", "Comment": "Normalized usage metric"},
                {"Name": "support_tickets", "Type": "int", "Comment": "Support ticket count (90 day)"},
                {"Name": "churned", "Type": "boolean", "Comment": "Target variable - did account churn"},
            ],
            "Location": "s3://ml-training-data/churn/v3/",
            "InputFormat": "org.apache.hadoop.mapred.TextInputFormat",
            "OutputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
            "SerdeInfo": {"SerializationLibrary": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"},
        },
        "Parameters": {
            "data_source": "internal-crm-export",
            "collection_date_start": "2024-01-01",
            "collection_date_end": "2025-12-31",
            "record_count": "45000",
            "consent_basis": "legitimate-interest",
            "pii_status": "anonymized",
            "anonymization_method": "k-anonymity-k5",
            "bias_review_date": "2026-03-15",
            "bias_review_status": "approved",
            "model_used_by": "churn-predictor-v3",
            "data_owner": "customer-success-team",
            "approval_ticket": "JIRA-ML-1234",
        },
    },
)

Every parameter in the table definition serves a compliance purpose. consent_basis documents the legal basis for data processing under GDPR and EU AI Act. anonymization_method proves that PII was removed. bias_review_date and bias_review_status provide evidence for NIST AI RMF Measure 2.6. approval_ticket creates an audit trail linking the dataset to an approved change request.


Metadata Annotations for Compliance

Glue Data Catalog supports custom metadata annotations at the database, table, and column level. Use these annotations systematically to build a compliance-ready data catalog.

Classification and Sensitivity Tagging

Tag every column with its data classification and sensitivity level. This enables automated policy enforcement through Lake Formation.

# Tag columns with classification metadata using Glue APIs
glue.update_table(
    DatabaseName="ml_training_data",
    TableInput={
        "Name": "customer_churn_training_v3",
        "StorageDescriptor": {
            "Columns": [
                {
                    "Name": "account_id",
                    "Type": "string",
                    "Comment": "Anonymized account identifier",
                    "Parameters": {
                        "sensitivity": "low",
                        "classification": "internal",
                        "pii_type": "pseudonymized-identifier",
                        "masking_required": "false",
                    },
                },
                {
                    "Name": "industry",
                    "Type": "string",
                    "Comment": "Industry vertical classification",
                    "Parameters": {
                        "sensitivity": "low",
                        "classification": "internal",
                        "pii_type": "none",
                        "demographic_attribute": "true",
                        "bias_sensitive": "true",
                    },
                },
                {
                    "Name": "region",
                    "Type": "string",
                    "Comment": "Geographic region",
                    "Parameters": {
                        "sensitivity": "low",
                        "classification": "internal",
                        "pii_type": "none",
                        "demographic_attribute": "true",
                        "bias_sensitive": "true",
                        "jurisdiction_relevant": "true",
                    },
                },
            ],
            "Location": "s3://ml-training-data/churn/v3/",
            "InputFormat": "org.apache.hadoop.mapred.TextInputFormat",
            "OutputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
            "SerdeInfo": {"SerializationLibrary": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"},
        },
    },
)

The bias_sensitive flag on industry and region columns is critical. When you run SageMaker Clarify bias analysis, you need to know which columns are protected attributes. Storing this in the Catalog means the information follows the data, not the pipeline configuration. For more on SageMaker lineage integration, see SageMaker ML Lineage Tracking.


Lake Formation for Fine-Grained Access to Training Data

Glue Data Catalog tells you what data you have. Lake Formation controls who can access it. For AI governance, fine-grained access control on training data is essential.

Column-Level and Row-Level Permissions

# Grant the ML training pipeline read access to non-sensitive columns only
aws lakeformation grant-permissions \
  --principal '{"DataLakePrincipal": {"DataLakePrincipalIdentifier": "arn:aws:iam::123456789:role/MLTrainingPipeline"}}' \
  --resource '{
    "Table": {
      "DatabaseName": "ml_training_data",
      "Name": "customer_churn_training_v3"
    }
  }' \
  --permissions '["SELECT"]' \
  --permissions-with-grant-option '[]'

# Restrict access to bias-sensitive columns to the fairness review team only
aws lakeformation grant-permissions \
  --principal '{"DataLakePrincipal": {"DataLakePrincipalIdentifier": "arn:aws:iam::123456789:role/FairnessReviewTeam"}}' \
  --resource '{
    "TableWithColumns": {
      "DatabaseName": "ml_training_data",
      "Name": "customer_churn_training_v3",
      "ColumnNames": ["industry", "region"]
    }
  }' \
  --permissions '["SELECT"]' \
  --permissions-with-grant-option '[]'

# Enable data cell filtering for row-level security on training data
aws lakeformation create-data-cells-filter \
  --table-data '{
    "TableCatalogId": "123456789",
    "DatabaseName": "ml_training_data",
    "TableName": "customer_churn_training_v3",
    "Name": "exclude-eu-data-for-non-gdpr-models",
    "RowFilter": {
      "FilterExpression": "region != '\''EU'\'' AND region != '\''EEA'\''"
    },
    "ColumnWildcard": {}
  }'

Row-level filtering is particularly important for multi-jurisdiction compliance. If you train a model that will only be deployed in the US, you may need to exclude EU data subjects to avoid GDPR complications. Lake Formation's data cell filters enforce this at the infrastructure level rather than relying on pipeline logic.

Compliance Tip: Lake Formation access logs are captured in CloudTrail. Every grant, revoke, and data access event is recorded. These logs map directly to SOC 2 CC6.1 (logical access controls) and CC6.3 (role-based access). Export them as evidence on a monthly basis.


Data Quality Rules for Training Pipelines

Training data quality directly affects model quality, and poor model quality is a compliance risk under every framework. Glue Data Quality lets you define validation rules that run automatically before training begins.

Defining Quality Rules for Training Datasets

import boto3

glue = boto3.client("glue")

# Create a data quality ruleset for the training dataset
glue.create_data_quality_ruleset(
    Name="churn-training-data-quality",
    Description="Quality rules for churn prediction training data",
    Ruleset="""
        Rules = [
            # Completeness checks - no null values in critical columns
            Completeness "account_id" >= 1.0,
            Completeness "churned" >= 1.0,
            Completeness "tenure_months" >= 0.99,
            Completeness "monthly_usage" >= 0.99,

            # Validity checks - values within expected ranges
            ColumnValues "tenure_months" between 0 and 360,
            ColumnValues "monthly_usage" >= 0,
            ColumnValues "churned" in ["true", "false"],

            # Uniqueness - no duplicate training records
            Uniqueness "account_id" >= 0.999,

            # Distribution checks - detect data drift or collection bias
            StandardDeviation "monthly_usage" between 0.5 and 5.0,
            ColumnValues "region" in ["US", "EU", "EEA", "APAC", "LATAM"],

            # Class balance - churned vs not churned should be reasonable
            CustomSql "SELECT CASE WHEN AVG(CASE WHEN churned = true THEN 1.0 ELSE 0.0 END) BETWEEN 0.05 AND 0.50 THEN 'PASS' ELSE 'FAIL' END AS result"

            # Freshness - data should not be stale
            DataFreshness "collection_date_end" <= 180 days
        ]
    """,
    TargetTable={
        "TableName": "customer_churn_training_v3",
        "DatabaseName": "ml_training_data",
    },
)

When quality rules fail, the training pipeline should halt and alert the data governance team. A model trained on invalid data produces unreliable predictions, which is a compliance failure under NIST AI RMF MS.2.1 (test set integrity) and ISO 42001 8.6 (data for AI systems).


Column-Level Encryption and Masking

Some training datasets contain columns that need encryption at rest or dynamic masking during access. AWS provides multiple mechanisms for this.

S3 server-side encryption with KMS protects data at rest. Use per-table KMS keys so that key policies can enforce access control independently of IAM:

# Create a dedicated KMS key for ML training data
aws kms create-key \
  --description "Encryption key for ML training datasets" \
  --key-usage ENCRYPT_DECRYPT \
  --origin AWS_KMS \
  --tags '[
    {"TagKey": "purpose", "TagValue": "ml-training-data"},
    {"TagKey": "compliance", "TagValue": "soc2-cc6.7"}
  ]'

# Set the S3 bucket to use this key by default
aws s3api put-bucket-encryption \
  --bucket ml-training-data \
  --server-side-encryption-configuration '{
    "Rules": [
      {
        "ApplyServerSideEncryptionByDefault": {
          "SSEAlgorithm": "aws:kms",
          "KMSMasterKeyID": "arn:aws:kms:us-east-1:123456789:key/mrk-training-data-key"
        },
        "BucketKeyEnabled": true
      }
    ]
  }'

Lake Formation column masking provides dynamic data masking for sensitive columns without modifying the underlying data. This is useful when data scientists need access to a dataset's structure but not its sensitive values:

aws lakeformation create-data-cells-filter \
  --table-data '{
    "TableCatalogId": "123456789",
    "DatabaseName": "ml_training_data",
    "TableName": "customer_churn_training_v3",
    "Name": "mask-sensitive-for-exploratory",
    "RowFilter": {"AllRowsWildcard": {}},
    "ColumnNames": ["tenure_months", "monthly_usage", "support_tickets", "churned"]
  }'

This filter grants access to only non-sensitive columns for exploratory analysis. The data scientist sees the schema and can validate data quality, but cannot access columns that might contain indirect PII.


Compliance Mapping Table

Glue / Lake Formation Feature NIST AI RMF ISO 42001 EU AI Act GDPR SOC 2 TSC
Data Catalog metadata annotations MS.2.1 (test set integrity) 8.6 (data for AI) Article 10 (data governance) Article 30 (records of processing) CC4.1 (monitoring)
Consent and provenance tracking Map 3.1 (risk mapping) 8.6 (data for AI) Article 10.2 (data examination) Article 25 (data protection by design) CC6.1 (access controls)
Lake Formation access controls Govern 1.1 (policies) A.9.1 (access control) Article 10.4 (appropriate measures) Article 25 (data protection by design) CC6.1, CC6.3 (role-based access)
Data cell filters (row/column) Govern 5.1 (risk policies) A.9.1 (access control) Article 10.4 (appropriate measures) Article 5.1.f (integrity and confidentiality) CC6.1, CC6.7 (data protection)
Data quality rules MS.2.1 (test set integrity) 8.6 (data for AI) Article 10.3 (appropriate properties) -- CC8.1 (change management)
Column-level encryption -- A.10.1 (cryptography) Article 10.4 (appropriate measures) Article 32 (security of processing) CC6.7 (encryption)
CloudTrail access logs Govern 1.1 (transparency) A.12.4 (logging) Article 12 (record-keeping) Article 30 (records of processing) CC7.1 (monitoring), CC7.2 (event evaluation)

Key Takeaway: Glue Data Catalog metadata is not just documentation -- it is compliance evidence. Every annotation you add to a training dataset becomes part of your audit trail. The combination of Catalog metadata, Lake Formation access controls, and CloudTrail logs provides end-to-end governance that satisfies regulators across jurisdictions.


How Claw GRC Tracks Training Data Provenance

Claw GRC integrates with AWS Glue Data Catalog and Lake Formation to automate training data governance:

Automated evidence collection:

  • Glue Data Catalog metadata snapshots for all ML training databases (daily)
  • Lake Formation permission configurations and changes (daily via CloudTrail)
  • Data quality rule evaluation results (per pipeline run)
  • KMS key usage logs for training data encryption verification (daily)
  • S3 access logs for training data buckets (daily)

Training data lineage visualization:

  • End-to-end view from raw data source through Catalog registration, quality validation, and model training
  • Integration with SageMaker ML Lineage for complete model provenance
  • Cross-reference between Glue Catalog metadata and Model Card training details

Compliance gap detection:

  • Identifies training datasets missing required metadata annotations (consent basis, bias review status, data classification)
  • Alerts when data quality rules are not configured for registered training datasets
  • Detects Lake Formation permission gaps where training data is accessible without documented business justification

For the comprehensive AWS AI governance picture, see Complete Guide to AWS AI/ML Governance.


Start governing your AI training data →

CG

Get started with Claw GRC

AI-native compliance automation. 1,026+ controls. MCP-native. Free workspace, no credit card.

Start Free →