Building an Automated Compliance Monitoring Platform on AWS with AI

AWS Config + CloudTrail + Security Hub + Amazon Bedrock
Imagine managing an AWS environment with multiple accounts, hundreds of resources, and applications deployed across different Regions.
A developer accidentally exposes an S3 bucket. Another team modifies a security group. An IAM policy becomes more permissive than expected.
These changes can happen in seconds, but discovering them may take hours or days.
Traditional compliance processes often depend on periodic audits, manual reviews, and spreadsheets. That approach becomes increasingly difficult as cloud infrastructure grows.
What if AWS could continuously detect configuration violations, correlate security events, investigate findings, and help engineers identify corrective actions?
In this article, we will explore how to build an Automated Compliance Monitoring Platform on AWS using native AWS security services and AI.
1. What Are We Building?
The goal is to create a centralized platform that continuously monitors AWS environments and helps security teams respond to compliance risks.
The solution combines:
- AWS Config: Evaluates resource configurations against compliance rules.
- AWS CloudTrail: Records API activity and helps identify who changed what.
- AWS Security Hub CSPM: Centralizes security findings and posture information.
- Amazon EventBridge: Routes important security events.
- AWS Lambda: Coordinates investigation and automation workflows.
- Amazon Bedrock: Generates AI-assisted explanations and remediation recommendations.
- Amazon S3, Glue, Athena, and QuickSight: Support historical evidence storage and compliance reporting.
The architecture can support multiple AWS accounts managed through AWS Organizations.
2. High-Level Architecture
Here is the conceptual workflow:
AWS Organizations | +--------------+--------------+ | | | Account A Account B Account C | | | AWS Config AWS Config AWS Config | | | CloudTrail CloudTrail CloudTrail | | | +--------------+--------------+ | Security Hub | EventBridge | AWS Lambda | Amazon Bedrock | AI Investigation Report | Security Team | Human Approval | Approved Remediation | Systems Manager / Lambda | Config Reevaluation CloudTrail logs can also be delivered to a centralized Amazon S3 logging account for long-term audit and investigation purposes.
The architecture separates detection, investigation, decision-making, and remediation. This is important because AI-generated recommendations should not automatically become production infrastructure changes.
3. Detect Configuration Violations with AWS Config
Configuration drift is one of the most common cloud security challenges.
A resource may be compliant when created but become non-compliant after a configuration change.
For example, an S3 bucket may initially block public access. Later, someone modifies its bucket policy and unintentionally exposes data.
AWS Config continuously records supported resource configurations and evaluates them against compliance rules.
Organizations can use AWS-managed rules, custom rules, and conformance packs.
Example: Prevent Public Read Access to S3 Buckets
The following CloudFormation resource creates an AWS Config managed rule:
Resources: S3PublicReadComplianceRule: Type: AWS::Config::ConfigRule Properties: ConfigRuleName: s3-public-read-prohibited Source: Owner: AWS SourceIdentifier: S3_BUCKET_PUBLIC_READ_PROHIBITED This rule evaluates whether S3 buckets allow public read access.
For a production environment, make sure AWS Config recording is enabled for the relevant resource types and Regions.
You can extend the rule set to monitor encryption, security group exposure, IAM configurations, and other requirements.
4. Investigate Changes Using AWS CloudTrail
Detecting a violation is only the first step.
Security teams also need to understand how it happened.
Consider an S3 bucket that suddenly becomes publicly accessible.
The investigation needs to answer:
- Which identity changed the bucket policy?
- Which API operation was performed?
- When did the change occur?
- Was the change initiated through the console, CLI, SDK, or automation?
- Were other resources modified around the same time?
AWS CloudTrail records AWS account activity and API events.
For multi-account environments, organizations can configure an organization trail and centralize logs in a dedicated S3 logging account.
A useful investigation workflow correlates an AWS Config finding with relevant CloudTrail events.
This helps security teams move from identifying a configuration violation to understanding its origin.
CloudTrail logs should be protected using appropriate access controls, encryption, retention policies, and integrity validation where required.
5. Centralize Findings with AWS Security Hub
Managing security findings independently across multiple accounts can create operational complexity.
AWS Security Hub CSPM helps centralize security posture information and findings from integrated AWS services and supported security products.
It also supports security standards and controls, including AWS Foundational Security Best Practices.
Security Hub findings use the AWS Security Finding Format (ASFF), providing a standardized structure for processing findings.
For example, a high-severity finding can trigger an EventBridge workflow.
EventBridge Rule Example
The following pattern is a starting point for routing active high- and critical-severity Security Hub findings:
{ "source": ["aws.securityhub"], "detail-type": ["Security Hub Findings - Imported"], "detail": { "findings": { "Severity": { "Label": ["HIGH", "CRITICAL"] }, "RecordState": ["ACTIVE"] } } } The EventBridge rule can invoke a Lambda function to begin an investigation.
Validate the event structure and filtering against the events emitted by your Security Hub environment before deploying the rule.
6. Add AI-Assisted Investigation with Amazon Bedrock
Security tools can identify risks, but engineers still need to understand findings and decide what to do next.
This is where Amazon Bedrock becomes useful.
An AI-assisted investigation workflow can transform technical security findings into understandable summaries.
For example, when a public S3 bucket finding is detected, the system can ask an approved foundation model to explain:
- What the finding means.
- Why it may create security or compliance risk.
- What evidence should be reviewed.
- Which remediation options may be appropriate.
- What additional checks are required before taking action.
Python Example: Invoke Amazon Bedrock
The following example uses the Bedrock Runtime Converse API:
import boto3 bedrock = boto3.client("bedrock-runtime") response = bedrock.converse( modelId="YOUR_APPROVED_MODEL_ID", messages=[ { "role": "user", "content": [ { "text": """ Analyze this AWS security finding. Finding: An S3 bucket may allow public read access. Explain: 1. Potential security impact. 2. Evidence that should be reviewed. 3. Recommended investigation steps. 4. Possible remediation options. Do not assume the finding is confirmed. Do not perform remediation. """ } ] } ], inferenceConfig={ "maxTokens": 600, "temperature": 0.2 } ) result = response["output"]["message"]["content"][0]["text"] print(result) Replace YOUR_APPROVED_MODEL_ID with a model identifier available to your account and Region.
This example demonstrates the model invocation only. A production implementation should pass the actual finding details, relevant evidence, and carefully scoped context.
It should also handle throttling, access errors, timeouts, and model output validation.
Important: AI should assist investigation, not act as the final compliance authority. Model-generated recommendations must be checked against actual resource configurations and organizational policies.
7. Build a Controlled Remediation Workflow
Detecting and investigating findings is valuable, but organizations also need a way to resolve them.
However, automatically changing production infrastructure based on AI recommendations can introduce additional risk.
A safer approach is to combine predefined remediation actions with human approval.
For example:
| Risk category | Recommended workflow |
|---|---|
| Low risk | Execute an approved, tested automation |
| Medium risk | Require engineer approval |
| High impact | Require explicit security or change-management approval |
AWS Systems Manager Automation and AWS Lambda can execute approved remediation workflows.
A typical process looks like this:
Security Finding | v EventBridge | v Investigation Lambda | v Amazon Bedrock | v Investigation Report | v Human Review | v Approval | v Systems Manager Automation | v AWS Config Reevaluation | v Updated Compliance Status Every remediation action should be logged and associated with an authorized identity.
The system should verify the resource configuration again after remediation rather than assuming that a successful automation execution means the issue is resolved.
8. Create a Centralized Compliance Dashboard
Security teams need more than individual alerts.
They need to understand trends across accounts, Regions, and workloads.
A reporting architecture can use:
Amazon S3: Store historical findings and audit evidence.
AWS Glue: Catalog supported datasets.
Amazon Athena: Query compliance and security information.
Amazon QuickSight: Build dashboards for security and management teams.
A dashboard could display:
- Compliance status by AWS account.
- Active high- and critical-severity findings.
- Repeated configuration violations.
- Remediation progress.
- Compliance trends over time.
- Resources with recurring security issues.
This creates better visibility for security operations and audit preparation.
9. Mapping Technical Controls to Compliance Frameworks
The platform can help monitor technical controls that support frameworks such as:
- CIS AWS Foundations Benchmark.
- PCI DSS.
- SOC 2.
- ISO 27001.
- NIST SP 800-53.
For example, infrastructure checks can help evaluate encryption settings, storage access restrictions, identity permissions, logging coverage, and network exposure.
However, technical monitoring alone does not establish full compliance or certification.
Organizations must also address governance, operational procedures, evidence requirements, risk management, and other framework-specific obligations.
Treat this platform as a continuous technical control monitoring capability that supports a broader compliance program.
10. Security Considerations
A compliance platform must itself follow strong security practices.
Use least-privilege IAM roles for Lambda, EventBridge, and other services.
Protect centralized CloudTrail logs and compliance evidence against unauthorized modification and deletion.
Encrypt data at rest and in transit.
Avoid including unnecessary sensitive information in AI prompts.
Validate AI responses before using them in operational workflows.
Use approved remediation runbooks instead of giving an AI model unrestricted infrastructure permissions.
Monitor failed executions and consider retry mechanisms and dead-letter queues for asynchronous workflows.
Most importantly, maintain a complete audit trail of investigation decisions and remediation actions.
11. What Makes This Architecture Valuable?
The biggest benefit is the shift from periodic compliance reviews to continuous monitoring.
AWS Config identifies configuration drift.
CloudTrail helps explain the changes that caused it.
Security Hub provides centralized security visibility.
EventBridge and Lambda connect detection to investigation workflows.
Amazon Bedrock helps engineers interpret findings and understand possible remediation options.
S3, Athena, Glue, and QuickSight provide a foundation for historical reporting.
Together, these services help reduce manual investigation effort and improve visibility across a growing AWS environment.
Conclusion
Cloud compliance should not be something organizations check only before an audit.
It should be part of everyday cloud operations.
By combining AWS Config, CloudTrail, Security Hub, EventBridge, Lambda, and Amazon Bedrock, organizations can build a platform that continuously monitors infrastructure, investigates security findings, and supports controlled remediation.
The goal is not to replace security engineers or compliance teams.
It is to give them better evidence, faster investigations, consistent workflows, and greater visibility.
Detect continuously. Investigate intelligently. Remediate responsibly.
That is the foundation of an AI-assisted compliance monitoring platform on AWS.