โšก Onwuachi Control Plane

AWS Config: Compliance and Auto-Remediation

Overview

AWS Config continuously records the configuration state of your AWS resources and evaluates them against rules you define. It answers two questions: “what did this resource look like at a point in time?” and “is this resource compliant with our standards right now?”

Why It Matters

Infrastructure drift is inevitable โ€” someone opens a security group port manually, a bucket loses its encryption setting, an IAM role gains excessive permissions. AWS Config detects these changes continuously and can trigger automated remediation, closing the loop without human intervention.

Where It Fits

DOP-C02 Domain 4 โ€” Monitoring and Logging

Resource created or changed | v AWS Config recorder (captures configuration snapshot) | v Config Rule evaluation (COMPLIANT or NON_COMPLIANT) | v EventBridge event (NON_COMPLIANT) | v SSM Automation (auto-remediate) or SNS (notify)


The Big Picture

Two core functions:

Configuration Timeline EC2 instance created โ†’ SG changed โ†’ instance terminated Full history of every configuration change, queryable by time Compliance Rules “All S3 buckets must have encryption” Config evaluates continuously โ†’ COMPLIANT or NON_COMPLIANT


Core Concepts

Rule types:

AWS Managed Rules (pre-built, 100+ available):

s3-bucket-server-side-encryption-enabled ec2-instance-no-public-ip iam-root-access-key-check restricted-ssh โ€” no 0.0.0.0/0 on port 22 mfa-enabled-for-iam-console-access cloudtrail-enabled

Custom Rules โ€” Lambda function evaluates compliance:

Conformance Packs โ€” bundled rule sets for frameworks:

Evaluation triggers:

Configuration change โ€” evaluates when resource config changes Periodic โ€” evaluates on a schedule (1hr, 3hr, 6hr, 12hr, 24hr)

Some rules only support one trigger type โ€” know which for the exam.

Auto-remediation pattern:

Config Rule: restricted-ssh | v Security group with 0.0.0.0/0 on port 22 โ†’ NON_COMPLIANT | v Config triggers SSM Automation: AWS-DisablePublicAccessForSecurityGroup | v SSM removes the offending rule automatically | v Re-evaluation โ†’ COMPLIANT

Aggregator โ€” multi-account/multi-region:

Cost:


Real-World Example

No live lab โ€” Config recorder has per-resource cost and requires careful scoping.

Exam decision tree โ€” compliance scenarios:

“Block action before it happens” โ†’ SCP (Service Control Policy) or IAM Permission Boundary

“Detect non-compliance and alert” โ†’ AWS Config Rule + SNS notification

“Detect and fix non-compliance automatically” โ†’ AWS Config Rule + SSM Automation remediation

“Audit who made a change” โ†’ CloudTrail (who) + Config timeline (what changed)

“See what a resource looked like before the change” โ†’ AWS Config configuration timeline

“Apply compliance rules across entire organization” โ†’ Config Conformance Pack via AWS Organizations

Config vs CloudTrail โ€” the common exam distinction:

CloudTrail โ†’ WHO made the API call (identity, source IP, timestamp) AWS Config โ†’ WHAT the resource looks like (configuration state, compliance)

Both together give you the full picture: Config shows the bucket lost encryption at 2pm; CloudTrail shows who made the PutBucketEncryption call at 2pm.


Engineering Analogy

AWS Config is the equivalent of continuous terraform plan output โ€” it shows you the diff between your desired state (Config rules) and actual state (recorded configuration) at all times. CloudFormation Drift Detection (which you ran in Domain 2) is the CloudFormation-scoped version of what Config does account-wide for all resource types continuously.


Best Practices


Common Mistakes


Pro Tip

AWS Config’s configuration timeline is invaluable during incident investigation โ€” navigate to any resource in the Config console, click Timeline, and see the exact configuration at any point in the past. Pair with CloudTrail’s lookup-events filtered by the same time window to get both what changed and who changed it.


Key Takeaways


Related Articles


References

System Context

โ† Back to Kb