AWS Config
AWS Config for recording resource configurations and compliance, managed and custom Config rules, pricing, resource timelines, automatic remediation with SSM Automation, and notifications.
What it is
AWS Config helps with auditing and recording compliance of AWS resources.
- It records configurations and changes over time.
- Questions AWS Config can answer:
- Is there unrestricted SSH access to my security groups?
- Do my buckets have any public access?
- How has my ALB configuration changed over time?
- Alerts (SNS notifications) can be sent for any changes.
- AWS Config is a per-Region service.
- It can be aggregated across Regions and accounts (an aggregator).
- The configuration data can be stored in S3 (and analyse it with Athena).
Config rules
- Use AWS managed Config rules (hundreds of them; the slides say over 75).
- Make custom Config rules, defined in AWS Lambda (or with the Guard policy language):
- for example, evaluate whether each EBS disk is of type gp2;
- or whether each EC2 instance is a
t2.micro.
- Rules can be evaluated or triggered:
- for each configuration change;
- and/or at regular time intervals.
- AWS Config rules do not prevent actions from happening (no deny).
- Pricing: no free tier; about $0.003 per configuration item recorded per Region, and $0.001 per rule evaluation per Region.
Config resource view
For each resource, AWS Config shows:
- its compliance over time (compliant, non-compliant);
- its configuration over time (each change, field by field);
- the CloudTrail API calls made on it over time.
Remediations
- Automate remediation of non-compliant resources with SSM Automation documents.
- Use AWS-managed Automation documents, or create custom ones. Tip: a custom Automation document can invoke a Lambda function.
- Set remediation retries if the resource is still non-compliant after auto remediation.
For example, a rule finds IAM access keys older than 90 days (NON_COMPLIANT) and triggers the AWSConfigRemediation-RevokeUnusedIAMUserCredentials document, which deactivates them.
Notifications
- Use EventBridge to trigger notifications when AWS resources become non-compliant, and send them to Lambda, SNS, SQS…
- Send configuration changes and compliance state notifications to SNS (all events; use SNS filtering, or filter on the client side), for example to email an admin.
Real-world examples
- A security team uses the managed rule
restricted-sshto find every security group open to0.0.0.0/0on port 22, and an auto remediation removes the rule. - An auditor asks how a load balancer was configured on 3 March. The Config timeline shows its listeners, security groups and certificate on that day.
Exam tips
- "Is this resource compliant?", "track configuration changes over time" → AWS Config.
- "Automatically fix non-compliant resources" → Config rule + remediation with SSM Automation.
- "Notify when a resource becomes non-compliant" → Config + EventBridge (or SNS).
- "Compliance across accounts and Regions" → Config aggregator.
- "Custom compliance check" → custom Config rule with Lambda.
Common traps
- "Config prevents non-compliant changes." It only detects (and can remediate after the fact). To prevent, use IAM policies or SCPs.
- "Config is global." It's per Region; aggregate for one view.
Check yourself
Config charges for every configuration item it records as soon as it is turned on, so instead:
An AWS Config rule (such as s3-bucket-public-read-prohibited) with automatic remediation through an SSM Automation document that blocks public access; Config keeps the configuration timeline.
AWS Config shows each security group's compliance and configuration history, with links to the CloudTrail API calls that changed it.
AWS documentation
AWS CloudTrail
AWS CloudTrail for auditing API calls, trails and event history, management, data, network activity and Insights events, retention beyond 90 days, and reacting to API calls with EventBridge.
AWS CloudFormation
AWS CloudFormation as infrastructure as code, its benefits, the visual Infrastructure Composer editor, the CloudFormation service role and iam:PassRole, and StackSets for many accounts and Regions.