Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implementing AWS Config rules for continuous compliance monitoring of AWS resources, deploying managed and custom rules aligned to CIS and PCI DSS frameworks, configuring automatic remediation with SSM Automation, and aggregating compliance data across accounts.
.claude/skills/implementing-aws-config-rules-for-compliance/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-21 | ✗→✓ | ▲ Improved | — | — |
| case-22 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
| case-02 | ✗→✓ | ▲ Improved | — | — |
| case-10 | ✗→✓ | ▲ Improved | — | — |
Do not use for real-time threat detection (use GuardDuty), for application vulnerability scanning (use Inspector), or for one-time compliance assessments (use Prowler for faster ad-hoc audits).
config:*, ssm:*, and lambda:* permissions for rule managementSet up the Config recorder and delivery channel in each target account.
bash# Create S3 bucket for Config data aws s3api create-bucket \ --bucket config-compliance-data-ACCOUNT_ID \ --region us-east-1 # Create Config service role aws iam create-service-linked-role --aws-service-name config.amazonaws.com # Start the Config recorder aws configservice put-configuration-recorder \ --configuration-recorder name=default,roleARN=arn:aws:iam::ACCOUNT:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig \ --recording-group allSupported=true,includeGlobalResourceTypes=true # Set up delivery channel aws configservice put-delivery-channel \ --delivery-channel '{ "name": "default", "s3BucketName": "config-compliance-data-ACCOUNT_ID", "snsTopicARN": "arn:aws:sns:us-east-1:ACCOUNT:config-notifications", "configSnapshotDeliveryProperties": {"deliveryFrequency": "TwentyFour_Hours"} }' # Start recording aws configservice start-configuration-recorder --configuration-recorder-name default
Enable AWS-managed Config rules that map to CIS AWS Foundations Benchmark controls.
bash# S3 bucket security rules aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "s3-bucket-public-read-prohibited", "Source": {"Owner": "AWS", "SourceIdentifier": "S3_BUCKET_PUBLIC_READ_PROHIBITED"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "s3-bucket-server-side-encryption-enabled", "Source": {"Owner": "AWS", "SourceIdentifier": "S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "s3-bucket-ssl-requests-only", "Source": {"Owner": "AWS", "SourceIdentifier": "S3_BUCKET_SSL_REQUESTS_ONLY"} }' # IAM security rules aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "iam-root-access-key-check", "Source": {"Owner": "AWS", "SourceIdentifier": "IAM_ROOT_ACCESS_KEY_CHECK"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "mfa-enabled-for-iam-console-access", "Source": {"Owner": "AWS", "SourceIdentifier": "MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "iam-password-policy", "Source": {"Owner": "AWS", "SourceIdentifier": "IAM_PASSWORD_POLICY"}, "InputParameters": "{\"RequireUppercaseCharacters\":\"true\",\"RequireLowercaseCharacters\":\"true\",\"RequireSymbols\":\"true\",\"RequireNumbers\":\"true\",\"MinimumPasswordLength\":\"14\"}" }' # Network security rules aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "restricted-ssh", "Source": {"Owner": "AWS", "SourceIdentifier": "INCOMING_SSH_DISABLED"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "vpc-flow-logs-enabled", "Source": {"Owner": "AWS", "SourceIdentifier": "VPC_FLOW_LOGS_ENABLED"} }' # Encryption rules aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "rds-storage-encrypted", "Source": {"Owner": "AWS", "SourceIdentifier": "RDS_STORAGE_ENCRYPTED"} }' aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "encrypted-volumes", "Source": {"Owner": "AWS", "SourceIdentifier": "ENCRYPTED_VOLUMES"} }'
Build custom rules for organization-specific compliance requirements.
python# custom_config_rule.py - Ensure EC2 instances have required tags import json import boto3 config = boto3.client('config') REQUIRED_TAGS = ['Environment', 'Owner', 'CostCenter', 'Project'] def lambda_handler(event, context): invoking_event = json.loads(event['invokingEvent']) configuration_item = invoking_event.get('configurationItem', {}) if configuration_item['resourceType'] != 'AWS::EC2::Instance': return tags = {t['key']: t['value'] for t in configuration_item.get('tags', [])} missing_tags = [tag for tag in REQUIRED_TAGS if tag not in tags] if missing_tags: compliance = 'NON_COMPLIANT' annotation = f"Missing required tags: {', '.join(missing_tags)}" else: compliance = 'COMPLIANT' annotation = 'All required tags present' config.put_evaluations( Evaluations=[{ 'ComplianceResourceType': configuration_item['resourceType'], 'ComplianceResourceId': configuration_item['resourceId'], 'ComplianceType': compliance, 'Annotation': annotation, 'OrderingTimestamp': configuration_item['configurationItemCaptureTime'] }], ResultToken=event['resultToken'] )
bash# Deploy the custom rule aws configservice put-config-rule --config-rule '{ "ConfigRuleName": "ec2-required-tags", "Source": { "Owner": "CUSTOM_LAMBDA", "SourceIdentifier": "arn:aws:lambda:us-east-1:ACCOUNT:function:config-required-tags", "SourceDetails": [{ "EventSource": "aws.config", "MessageType": "ConfigurationItemChangeNotification" }] }, "Scope": {"ComplianceResourceTypes": ["AWS::EC2::Instance"]} }'
Set up SSM Automation documents for automatic remediation of non-compliant resources.
bash# Auto-remediate public S3 buckets aws configservice put-remediation-configurations --remediation-configurations '[{ "ConfigRuleName": "s3-bucket-public-read-prohibited", "TargetType": "SSM_DOCUMENT", "TargetId": "AWS-DisableS3BucketPublicReadWrite", "Parameters": { "S3BucketName": {"ResourceValue": {"Value": "RESOURCE_ID"}}, "AutomationAssumeRole": {"StaticValue": {"Values": ["arn:aws:iam::ACCOUNT:role/ConfigRemediationRole"]}} }, "Automatic": true, "MaximumAutomaticAttempts": 3, "RetryAttemptSeconds": 60 }]' # Auto-remediate unencrypted EBS volumes aws configservice put-remediation-configurations --remediation-configurations '[{ "ConfigRuleName": "encrypted-volumes", "TargetType": "SSM_DOCUMENT", "TargetId": "AWS-EnableEBSEncryptionByDefault", "Parameters": { "AutomationAssumeRole": {"StaticValue": {"Values": ["arn:aws:iam::ACCOUNT:role/ConfigRemediationRole"]}} }, "Automatic": true, "MaximumAutomaticAttempts": 1, "RetryAttemptSeconds": 300 }]' # Auto-remediate security groups allowing SSH from 0.0.0.0/0 aws configservice put-remediation-configurations --remediation-configurations '[{ "ConfigRuleName": "restricted-ssh", "TargetType": "SSM_DOCUMENT", "TargetId": "AWS-DisablePublicAccessForSecurityGroup", "Parameters": { "GroupId": {"ResourceValue": {"Value": "RESOURCE_ID"}}, "AutomationAssumeRole": {"StaticValue": {"Values": ["arn:aws:iam::ACCOUNT:role/ConfigRemediationRole"]}} }, "Automatic": true, "MaximumAutomaticAttempts": 3, "RetryAttemptSeconds": 60 }]'
Aggregate compliance data from all organization accounts into a central view.
bash# Create a Config aggregator for the organization aws configservice put-configuration-aggregator \ --configuration-aggregator-name org-compliance-aggregator \ --organization-aggregation-source '{ "RoleArn": "arn:aws:iam::ACCOUNT:role/ConfigAggregatorRole", "AllAwsRegions": true }' # Query aggregate compliance across all accounts aws configservice get-aggregate-compliance-details-by-config-rule \ --configuration-aggregator-name org-compliance-aggregator \ --config-rule-name s3-bucket-public-read-prohibited \ --compliance-type NON_COMPLIANT \ --query 'AggregateEvaluationResults[*].[AccountId,AwsRegion,EvaluationResultIdentifier.EvaluationResultQualifier.ResourceId,ComplianceType]' \ --output table # Get compliance summary by account aws configservice get-aggregate-compliance-summary-by-source \ --configuration-aggregator-name org-compliance-aggregator \ --query 'AggregateComplianceCounts[*].[GroupName,ComplianceSummary.CompliantResourceCount.CappedCount,ComplianceSummary.NonCompliantResourceCount.CappedCount]' \ --output table
| Term | Definition | |------|------------| | AWS Config Rule | A compliance check that evaluates whether AWS resource configurations meet specified requirements, either continuously or on a schedule | | Managed Rule | AWS-provided pre-built Config rule with standardized logic for common compliance checks like encryption and public access | | Custom Rule | Organization-specific Config rule backed by a Lambda function that evaluates custom compliance logic | | Remediation Action | SSM Automation document or Lambda function triggered to automatically fix non-compliant resources | | Configuration Aggregator | AWS Config feature that collects compliance data from multiple accounts and regions into a centralized view | | Conformance Pack | Collection of Config rules and remediation actions packaged as a deployable unit for specific compliance frameworks |
Context: A financial services company needs to demonstrate continuous CIS AWS Foundations Benchmark compliance across all 30 production accounts for their annual SOC 2 audit.
Approach:
Pitfalls: Config recording incurs costs per configuration item recorded. In accounts with many resources, costs can be significant. Use targeted recording groups to focus on compliance-relevant resource types rather than recording all resources. Auto-remediation of network rules (security groups) can disrupt applications if the rule was intentionally permissive.
AWS Config Compliance Report
===============================
Organization: Acme Financial (30 accounts)
Framework: CIS AWS Foundations 1.4
Report Date: 2026-02-23
Config Rules Active: 48
COMPLIANCE SUMMARY:
Overall Compliance: 87%
Compliant Resources: 4,234
Non-Compliant Resources: 612
Not Applicable: 189
TOP NON-COMPLIANT RULES:
encrypted-volumes: 89 resources (14 accounts)
vpc-flow-logs-enabled: 67 resources (12 accounts)
mfa-enabled-for-iam-console: 45 resources (8 accounts)
s3-bucket-ssl-requests-only: 34 resources (6 accounts)
restricted-ssh: 28 resources (5 accounts)
AUTO-REMEDIATION (Last 30 Days):
Public S3 buckets remediated: 12
Security groups restricted: 8
EBS default encryption enabled: 6
Total auto-remediated: 26
Failed remediation attempts: 3
ACCOUNT COMPLIANCE RANKING:
1. prod-core (account-001): 96% compliant
2. prod-data (account-002): 94% compliant
...
30. dev-sandbox (account-030): 68% compliant| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.