SkillSprout
Chapter 10 · Lesson 3
Intermediate
6 min read

AWS Config

Overview

AWS Config continuously records the configuration of your AWS resources and evaluates it against rules that describe how things should be configured. It keeps a timeline for every resource, so you can answer "what did this security group look like last month?" and "which of my S3 buckets are not encrypted right now?".

If CloudTrail is the camera that records who acted, Config is the inventory manager that photographs the state of every item after each change and flags anything that breaks the policy handbook.

Config is a detective control for governance, compliance auditing and change management. It does not block actions by itself, but it can trigger automatic remediation, which makes it a frequent answer to exam questions about compliance and drift.

Key Concepts

  • Config records configuration items (CIs): a snapshot of a resource's attributes, relationships and metadata at a point in time.
  • Config rules evaluate resources as COMPLIANT or NON_COMPLIANT; they are either AWS managed (e.g. s3-bucket-public-read-prohibited) or custom (Lambda or CloudFormation Guard).
  • Rules can be change-triggered (when a resource changes) or periodic (every 1, 3, 6, 12 or 24 hours).
  • Remediation actions use Systems Manager Automation documents to fix non-compliant resources automatically.
  • Conformance packs bundle rules and remediations as a single deployable template (e.g. CIS or PCI-DSS pack).
  • An aggregator collects configuration and compliance data across accounts and Regions; Config is regional and must be enabled per Region.
  • Config stores history and snapshots in S3 and can send change notifications to SNS and EventBridge.
  • Config is not preventive: it does not deny API calls (use IAM/SCPs for that).

Detailed Notes

How Config works

When recording is enabled, Config discovers resources in the Region and records a configuration item each time something changes. It stores:

  • The current and historical configuration (timeline view).
  • Relationships (e.g. an EC2 instance -> its security group, subnet, EBS volumes).
  • A link to the CloudTrail event that caused the change.

Configuration history files are delivered to an S3 bucket roughly every six hours, and configuration snapshots are delivered on request or on a schedule. You can record all supported resource types, or only chosen types, and include global resources (IAM) in a single Region.

Config rules

Rule typeHow it worksExample
Managed rulesPrebuilt by AWS (over 300)encrypted-volumes, restricted-ssh, rds-multi-az-support, root-account-mfa-enabled
Custom - LambdaYour function evaluates the CICheck that tags match a naming standard
Custom - GuardPolicy-as-code with CloudFormation GuardResource-property assertions

Triggers: configuration change (evaluates when relevant resources change) or periodic (scheduled). Results appear in the compliance dashboard and can be queried with advanced queries (SQL-like).

json
{
  "ConfigRuleName": "s3-bucket-versioning-enabled",
  "Source": {
    "Owner": "AWS",
    "SourceIdentifier": "S3_BUCKET_VERSIONING_ENABLED"
  },
  "Scope": { "ComplianceResourceTypes": ["AWS::S3::Bucket"] }
}

Remediation

Attach a remediation action, which runs an SSM Automation document, to a rule. Remediation can be manual or automatic with retry settings. For instance, AWS-DisablePublicAccessForSecurityGroup can close a security group that exposes SSH to the world. You can also notify through EventBridge (compliance change events) and build custom flows.

Multi-account governance

An aggregator (in a central account, often a delegated administrator) collects data from multiple accounts and Regions without recreating rules. Conformance packs and organisation-level rules deploy a consistent compliance baseline across AWS Organizations.

bash
aws configservice put-config-rule --config-rule file://rule.json
aws configservice describe-compliance-by-config-rule --compliance-types NON_COMPLIANT
aws configservice get-resource-config-history --resource-type AWS::EC2::SecurityGroup \
  --resource-id sg-0abc1234

Config vs. CloudTrail vs. CloudWatch

NeedUse
Who called the API?CloudTrail
What is the resource's configuration now and in the past, is it compliant?Config
Metrics and alarms for utilisationCloudWatch
Prevent a non-compliant actionIAM policies, SCPs, permission boundaries

Pricing and operational notes

Config is billed per configuration item recorded and per rule evaluation. Continuous recording records every change, while daily recording reduces cost for less volatile resources. Config is regional, so enable it in every Region you use, and store the history in a central, protected S3 bucket.

Real World Example

Scenario — a payments company continuously proves PCI-DSS compliance.

Auditors ask: "Show that all production EBS volumes and RDS instances are encrypted, that no security group allows SSH from the internet, and tell us when any exception occurred."

The cloud team enables AWS Config in all accounts and Regions through an organisation setup and deploys a PCI-DSS conformance pack containing managed rules such as encrypted-volumes, rds-storage-encrypted and restricted-ssh. A multi-account aggregator in the security account shows a single compliance dashboard.

When a developer opens port 22 to 0.0.0.0/0, Config marks the security group NON_COMPLIANT within minutes. An automatic remediation using an SSM Automation document revokes the rule, and EventBridge posts the event to the SOC channel. CloudTrail identifies who made the change, and Config's timeline shows the exact before and after state. The audit evidence is produced with a few advanced queries rather than weeks of screenshots.

Architecture Diagram

AWS Config recording, evaluating and remediating
Architecture
AWS Cloud
Security groups
EBS volumes
S3 buckets
AWS Configrecorder + rules
EventBridge
SSM Automationremediation
SNS alert
S3 history bucket

Resource changes are recorded, evaluated against rules and automatically fixed when non-compliant.

  1. 1Config's recorder detects a resource change and stores a new configuration item.
  2. 2Managed or custom rules evaluate the item and mark it COMPLIANT or NON_COMPLIANT.
  3. 3A non-compliant result emits an event and can trigger an SSM Automation remediation and SNS alert.
  4. 4Configuration history and snapshots are delivered to S3 for audit; an aggregator provides a multi-account view.

Best Practices

  • ✓Enable Config in every Region and account, using AWS Organizations and an aggregator for central visibility.
  • ✓Deploy conformance packs for standards (CIS, PCI-DSS, HIPAA) rather than hand-crafting rules.
  • ✓Automate remediation with SSM Automation for low-risk, well-understood violations.
  • ✓Pair Config with CloudTrail: Config shows the state change, CloudTrail shows who did it.
  • ✓Use SCPs and IAM for prevention; use Config for detection and evidence.
  • ✓Protect the S3 delivery bucket with encryption, versioning and restricted access in a log-archive account.
  • ✓Control cost by recording only needed resource types or using daily recording for stable resources.
  • ✓Send compliance change events to EventBridge and SNS to alert owners quickly.

Common Interview Questions

Exam Tips

SAA-C03 focus

  • "Assess, audit and record configuration changes / compliance of resources" -> AWS Config.
  • "Who made the change" -> CloudTrail; "what changed and is it compliant" -> Config.
  • Config is detective, not preventive. Prevention = IAM/SCP.
  • Auto-remediate non-compliant resources -> Config rule + SSM Automation remediation action.
  • Multi-account/multi-Region compliance view -> Config aggregator; deploy standards with conformance packs.
  • Config is regional; history is stored in S3; notifications via SNS/EventBridge.
  • Examples of managed rules: encrypted-volumes, restricted-ssh, s3-bucket-public-read-prohibited, rds-multi-az-support, root-account-mfa-enabled.
  • Custom rules are implemented with Lambda or CloudFormation Guard.

Finished this lesson?

0 of 64 lessons done · 0% of the course