About the Project

Inspiration

In today's cloud-first world, organizations face mounting pressure to comply with regulations like GDPR, HIPAA, and PCI-DSS. Manual compliance audits are slow, expensive, and error-prone—often catching violations only after they've caused damage. We were inspired to build Compliance Guardian AI after witnessing how development teams struggle to balance innovation velocity with regulatory requirements.

The key question that drove us: What if AI could continuously monitor infrastructure and code, detecting compliance violations in real-time before they become costly liabilities?

Traditional compliance tools rely on static rule matching, but regulations are complex and context-dependent. We envisioned a system that could understand regulatory language, interpret it intelligently, and apply it to real-world infrastructure—all powered by cutting-edge AI.

What it does

Compliance Guardian AI is an intelligent, serverless compliance monitoring system that provides comprehensive regulatory oversight:

  • Automatically scans cloud infrastructure, databases, and code repositories for compliance violations
  • Uses AI (AWS Bedrock) to interpret complex regulatory policies and identify non-compliance patterns
  • Generates risk assessments with severity scoring and intelligent prioritization
  • Provides automated remediation suggestions with actionable, context-aware fixes
  • Creates compliance reports mapped to specific regulatory frameworks (GDPR, HIPAA, PCI-DSS)
  • Runs continuously via serverless architecture for real-time monitoring without infrastructure overhead

The system acts as a 24/7 compliance officer, providing instant feedback to developers and security teams while maintaining detailed audit trails for regulatory reviews.

How we built it

Architecture Overview

We designed Compliance Guardian AI as a cloud-native, event-driven system leveraging AWS serverless technologies:

Core Technologies:

  • AWS Lambda for serverless compute and automatic scaling
  • Amazon Bedrock (Claude 3.5 Sonnet and Nova models) for AI-powered policy interpretation
  • Amazon API Gateway for RESTful API endpoints
  • Python 3.9+ as the primary development language
  • Multi-scanner framework supporting GDPR, HIPAA, and PCI-DSS regulations

Key Components

  1. Agent Gateway - Orchestrates compliance scanning workflows and coordinates between components
  2. Policy Interpreter - AI-powered engine that analyzes regulatory requirements and translates them into actionable checks
  3. Risk Assessor - Evaluates violation severity using quantitative risk models
  4. Scanner Modules - Framework-specific compliance checkers for different regulations
  5. Integration Connectors - APIs for GitHub, GitLab, AWS, and database systems

Technical Implementation

The core scanning workflow follows this pattern:

def scan_compliance(code_path, frameworks):
    """Main compliance scanning workflow"""
    # Load and parse code/infrastructure
    parsed_data = parser.analyze(code_path)

    # Run framework-specific scanners
    violations = []
    for framework in frameworks:
        scanner = get_scanner(framework)
        violations.extend(scanner.detect_violations(parsed_data))

    # AI-powered risk assessment
    risk_analysis = bedrock_agent.assess_risk(violations)

    # Generate remediation suggestions
    remediation = bedrock_agent.suggest_fixes(violations)

    # Compile comprehensive report
    return ComplianceReport(
        violations=violations,
        risk_score=risk_analysis.total_score,
        remediation_steps=remediation,
        framework_mapping=framework_compliance_map
    )

Risk Quantification Model

We developed a mathematical model to prioritize violations based on multiple factors:

For individual violations, risk is calculated as:

( Risk_i = Severity_i \times Likelihood_i \times Impact_i )

The total compliance risk score aggregates across all violations:

$$ Risk_{total} = \sum_{i=1}^{n} (Severity_i \times Likelihood_i \times Impact_i \times Weight_i) $$

Where:

  • ( Severity_i ) ranges from 1 (low) to 5 (critical)
  • ( Likelihood_i ) represents probability of exploitation (0-1)
  • ( Impact_i ) measures potential business/financial damage (1-10)
  • ( Weight_i ) adjusts for framework-specific importance

Deployment Pipeline

# Infrastructure setup
python setup_infrastructure.py

# Lambda deployment
python deploy_lambda.py

# API Gateway configuration
python redeploy_api.py

# Bedrock model configuration
python switch_to_nova.py

Challenges we ran into

1. AWS Bedrock Permissions Complexity

Configuring IAM policies for Bedrock access proved challenging. Model access requires region-specific permissions, and the intersection of Lambda execution roles, Bedrock model permissions, and cross-service access created a complex permission matrix. We had to:

  • Enable Bedrock model access in specific AWS regions
  • Configure fine-grained IAM policies with least-privilege principles
  • Handle cross-service authentication between Lambda and Bedrock
  • Debug permission errors that manifested inconsistently

Solution: We created automated scripts (fix_bedrock_permissions.py, enable_bedrock.py) to standardize the permission setup process.

2. AI Hallucination and Accuracy Control

Large language models can generate plausible but incorrect compliance advice. We needed to ensure the AI:

  • Provides accurate regulatory interpretations
  • Avoids false positives that waste developer time
  • Doesn't miss genuine violations (false negatives)
  • Generates actionable, not generic, remediation steps

Solution: We implemented a validation layer with rule-based checks to verify AI outputs, used structured prompts with regulatory references, and maintained a feedback loop to improve model accuracy.

3. Multi-Framework Regulatory Complexity

Each regulation (GDPR, HIPAA, PCI-DSS) has distinct requirements, terminology, and enforcement contexts:

  • GDPR focuses on data subject rights and consent
  • HIPAA emphasizes protected health information (PHI) safeguards
  • PCI-DSS requires specific technical controls for payment data

Solution: We designed a modular scanner architecture where each framework has dedicated logic while sharing common detection patterns and infrastructure.

4. Serverless Cold Start Optimization

Lambda cold starts can add 2-5 seconds of latency, problematic for real-time compliance checks. We optimized by:

  • Minimizing deployment package size
  • Using Lambda layers for shared dependencies
  • Implementing connection pooling for AWS services
  • Caching AI model responses for repeated patterns

5. Data Privacy Paradox

Building a compliance scanner creates an interesting paradox: the tool must analyze sensitive code and infrastructure data while itself maintaining strict privacy and security standards.

Solution: We implemented end-to-end encryption, temporary data processing (no persistent storage of scanned code), audit logging, and comprehensive access controls.

Accomplishments that we're proud of

Real AI-powered compliance - Unlike traditional rule-based tools, we leverage genuine AI capabilities for intelligent policy interpretation and context-aware analysis.

Production-ready architecture - Fully deployed serverless system with automated deployment scripts, comprehensive error handling, and monitoring infrastructure.

Multi-framework support - Successfully implemented scanners for three major regulatory frameworks (GDPR, HIPAA, PCI-DSS) with extensible architecture for future additions.

Comprehensive testing - Built automated end-to-end workflows with test coverage tracking and validation across multiple compliance scenarios.

Developer-friendly design - Created clear documentation, example scripts, and API guides that make compliance scanning accessible to development teams.

Cost-effective solution - Serverless architecture means zero cost when idle and automatic scaling under load, making enterprise-grade compliance accessible to organizations of all sizes.

What we learned

Technical Learnings

AWS Bedrock Best Practices

  • Effective prompt engineering techniques for compliance-specific queries
  • Model selection strategies (Claude for detailed analysis, Nova for speed)
  • Cost optimization through intelligent caching and batching
  • Error handling for AI service rate limits and availability

Compliance as Code Philosophy

  • Regulatory requirements can be expressed as programmable rules
  • Version control and testing apply to compliance policies
  • Automated compliance enables continuous regulatory alignment
  • Documentation and auditability are as important as the checks themselves

Serverless Design Patterns

  • Event-driven architecture enables scalable, continuous monitoring
  • State management in stateless functions requires careful design
  • Cold start optimization is critical for user experience
  • Proper error handling and retry logic are essential for reliability

Domain Knowledge

Regulatory Frameworks

  • Deep understanding of GDPR data protection principles
  • HIPAA privacy and security rule requirements
  • PCI-DSS technical and operational standards
  • How regulations intersect and sometimes conflict

Risk Assessment Methodology

  • Quantitative models for compliance risk scoring
  • Balancing false positives vs. false negatives
  • Context-dependent severity evaluation
  • Prioritization frameworks for remediation

Soft Skills

Security-First Mindset - Building tools that handle sensitive data requires paranoid attention to security at every layer.

User-Centric Design - Compliance tools must balance thoroughness with usability; overwhelming developers with alerts reduces adoption.

Documentation Discipline - Complex systems require excellent documentation; we learned to document as we build, not after.

What's next for Compliance Guardian AI

Near-term Enhancements (Q1 2026)

Machine Learning Enhancement Train custom models on historical violation patterns to enable predictive compliance—identifying potential violations before they occur based on code patterns and organizational behavior.

Dashboard and Visualization Build a web-based dashboard with real-time compliance metrics, trend analysis, and interactive violation exploration. Visualize compliance posture across frameworks and organizational units.

CI/CD Integration Create native plugins for GitHub Actions, GitLab CI, and Jenkins that enable pre-merge compliance checks, blocking pull requests that introduce violations.

Medium-term Goals (2026)

Multi-cloud Support Extend scanners beyond AWS to support Azure and Google Cloud Platform, enabling compliance monitoring for multi-cloud architectures.

Additional Regulatory Frameworks Add support for SOC 2, ISO 27001, CCPA, and industry-specific regulations (FERPA for education, FINRA for finance).

Automated Remediation Move beyond suggestions to automated fix application for common violations, with human approval workflows for sensitive changes.

Custom Policy Engine Enable organizations to define custom compliance policies beyond standard frameworks, supporting internal security standards and contractual obligations.

Long-term Vision (2027+)

Community Edition Open-source core scanner components to enable community contributions, custom framework development, and broader adoption.

Compliance Marketplace Create a marketplace for custom compliance policies, scanner plugins, and integration modules developed by the community.

Proactive Compliance Intelligence Use machine learning to predict regulatory changes, analyze their impact on existing infrastructure, and provide proactive remediation roadmaps.

Compliance Certification Support Automate evidence collection and report generation for formal compliance audits and certifications.


Built With

Languages & Frameworks

  • Python 3.9+
  • AWS Lambda (Serverless Framework)
  • Amazon Bedrock (Claude 3.5 Sonnet, Nova)

Cloud Services

  • AWS API Gateway
  • AWS IAM
  • AWS CloudWatch
  • AWS Lambda

APIs & Integrations

  • GitHub API
  • GitLab API
  • AWS Boto3 SDK

Development Tools

  • pytest (Testing Framework)
  • Coverage.py (Code Coverage)
  • Black (Code Formatting)
  • Pylint (Static Analysis)

Documentation

  • Markdown
  • LaTeX (Mathematical Notation)

Try It Out

GitHub Repository: compliance-guardian-ai

Documentation:

Demo Resources:

  • Demo Script: demo.py
  • Automated Demo: demo_auto.py
  • Example Usage: examples/basic_scan.py

Live API Endpoint: (Add your API Gateway endpoint here)


Built with passion for secure, compliant cloud infrastructure. Contributions welcome.

Built With

Share this project:

Updates