Recording Configuration and Enforcing Compliance with AWS Config
This lesson explains how AWS Config records the configuration of resources over time and evaluates it against rules, showing what changed and whether resources comply with policy.
Learning outcomes
After completing this lesson, you will be able to:
- Describe configuration items and history.
- Explain how Config rules evaluate resources and trigger automatic remediation.
- Identify the services built on AWS Config.
Recording configuration
AWS Config records a configuration item for each supported resource whenever it changes, building a timeline that shows how the resource was configured at any point in the past. It also records relationships between resources, such as which instances use a security group, which shows the impact of a change.
Combined with AWS CloudTrail, Config answers both what changed and who changed it: Config shows the resulting configuration, and CloudTrail shows the API call that made the change.
Rules and remediation
AWS Config checks resource configurations against rules. Managed rules are prebuilt checks, such as no security group allowing SSH from anywhere or every EBS volume being encrypted, and custom rules implement your own checks as Lambda functions or in the Guard policy language. Each resource is marked compliant or non-compliant whenever it changes or on a schedule.
Automatic remediation runs a Systems Manager Automation document to fix a non-compliant resource, such as enabling encryption on a bucket. Conformance packs deploy a collection of rules and remediations together, for example for PCI DSS, across accounts. Aggregators collect compliance data from many accounts and Regions into one view. The following table summarises the features.
| Feature | Use |
|---|---|
| Managed rules | Prebuilt checks, such as no security group allowing 0.0.0.0/0 on port 22, or encrypted EBS volumes |
| Custom rules | Your own checks, written as Lambda functions or in Guard policy language |
| Automatic remediation | Systems Manager Automation documents fix non-compliant resources |
| Conformance packs | Collections of rules and remediations deployed together, such as for PCI DSS |
| Aggregators | Compliance across accounts and Regions in one view |
The following diagram shows a rule detecting and fixing an open security group.

Config features
Config and other services
Several services are built on AWS Config: Control Tower's detective controls, AWS Security Hub CSPM's security checks and AWS Firewall Manager all rely on Config recording resource configurations, which is why Config must be enabled in every account and Region they cover.
Config is detective: it finds non-compliant resources after they are created and can remediate them. Preventive controls, such as service control policies, stop non-compliant actions from happening in the first place. Well-governed environments use both, preventing what can be prevented and detecting the rest.
Preventive or detective?
Fixing open security groups automatically
Engineers keep opening SSH to the internet on security groups. The security team wants every such rule detected and removed within minutes, across all accounts.
| Component | Role |
|---|---|
Config managed rule restricted-ssh | Flags security groups allowing 0.0.0.0/0 on port 22 |
| Automatic remediation | A Systems Manager Automation document removes the rule |
| Conformance pack deployed to the organisation | Applies the rule in every account |
| Aggregator in the security account | One compliance view across accounts and Regions |
Config's timeline also shows what each group looked like before the change, and CloudTrail shows who made it.
Which service answers whether a resource complied with a rule last month?
Show answer
AWS Config, which records configuration history and evaluates resources against Config rules over time.
Exam Tips
Remember for the exam
- For configuration history and compliance rules, use AWS Config.
- To see what a resource's configuration looked like last week, use the AWS Config timeline.
- To fix non-compliant resources automatically, use Config rules with Systems Manager Automation remediation.
- To view compliance across all accounts, use a Config aggregator.