3.2.3.7. Configuring S3 Events to Process Log Files (Lambda) and Deliver Log Files to Another Destination (OpenSearch Service, CloudWatch Logs)
3.2.3.7. AWS Config Rules Automated Remediation
Detecting non-compliance is useful; automatically fixing it is transformational. Config rules with automated remediation create a self-healing compliance posture.
Remediation architecture:
- AWS Config detects a non-compliant resource
- Remediation configuration triggers an SSM Automation document
- SSM Automation executes the fix (e.g., enable encryption, restrict security group)
- Config re-evaluates the resource
- Resource marked as COMPLIANT
Common remediation examples:
| Config Rule | SSM Automation Document | Action |
|---|---|---|
s3-bucket-public-read-prohibited | AWS-DisableS3BucketPublicReadWrite | Remove public ACL |
encrypted-volumes | AWS-EnableEbsEncryptionByDefault | Enable EBS encryption |
restricted-ssh | Custom: RemoveSSHFromSG | Remove 0.0.0.0/0:22 rule |
rds-multi-az-support | Custom: EnableRDSMultiAZ | Modify RDS to Multi-AZ |
# Custom SSM Automation: Remove unrestricted SSH from security group
schemaVersion: '0.3'
parameters:
SecurityGroupId:
type: String
mainSteps:
- name: RevokeSSH
action: aws:executeAwsApi
inputs:
Service: ec2
Api: RevokeSecurityGroupIngress
GroupId: "{{ SecurityGroupId }}"
IpPermissions:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
IpRanges:
- CidrIp: "0.0.0.0/0"
Config remediation settings:
Automatic: true— remediation runs without approvalMaximumAutomaticAttempts: How many times to retry (1-25)RetryAttemptSeconds: Wait between retriesResourceIdparameter mapping: Config passes the non-compliant resource ID to the SSM documentAutomationAssumeRole: the IAM role SSM Automation assumes to make the fix. It needs the corrective permission (e.g.,ec2:CreateTags); without it the rule fires but the remediation execution fails
Exam Trap: Automatic remediation can cause unintended disruptions. Removing an SSH rule or enabling encryption on a running instance may break active connections. Use Automatic: false (manual) for production-critical resources and Automatic: true for development/sandbox environments. The exam tests whether you understand the risk of fully automated remediation in production.