This project is not maintained any more: please reachout to rdk-maintainers@amazon.com for any questions. Please checkout branch Version2 for latest features which support a more complicated use cases and this version will remain as a minimum vialbe product
This package is a collaborative project to deploy and operate Config Rules at scale in an multi-account environment.
You can follow the steps below to install the Compliance Engine.
This project assist you to manage, deploy and operate Config Rules in large AWS environment. It completely automate those tasks via a preconfigured pipeline. Additionally, it provides recommended Config Rules to be deployed as Security Baseline, mapped to the CIS Benchmark and PCI (named RuleSets).
A RuleSet is a collection of Rules. For any AWS accounts, you can decide which RuleSet you want to deploy. For example, you might have a RuleSet for highly confidential accounts, or for high-available accounts or for particular standards (e.g. CIS, PCI or NIST).
Yes, we describe in the User Guide how to add new rules and new rulesets.
We expect the engine to work for 100s of accounts, we are yet to hit the limit. The limit for the number of rules per account is about 65 rules, due to CloudFormation template size limits.
Yes, the engine is able to deploy different sets of rules between regions and accounts. By default, it deploys 2 different baselines of rules (avoid to deploy multiple rules with global scope only once, i.e. rules on AWS IAM).
No, for simplicity of the deployment and due to the multiple dimensions of each account we decided not to use AWS Organizations.
Yes, the engine is compatible with an existing setup.
The engine for compliance-as-code design has the following key elements:
The set of Rules deployed in each Aplication Account depends on:
In Application Account, deploy (in the same region) the CloudFormation: application-account-initial-setup.yaml.
This Cloudformation does the following:
After few minutes, all the Config Rules defined as "baseline" (configurable) will be deployed in this new Application Account.
Certain resources may have a business need to not follow a particular rule. You can whitelist a resouce from being NON_COMPLIANT in the datalake, where you can query the compliance data. The resource will be then be noted as COMPLIANT, and the flag "WhitelistedComplianceType" will be set to "True" for traceability.
To add a resource in the whitelist:
Note: the resource will still be shown non-compliant in the AWS console of Config Rules.
Note 2: certain Rules might have a whitelist/exception in the parameters.json, but only for custom Config rules.
This is an advanced scenario, where you want to deploy more than the default baseline. In this scenario, you can chose precisely which rule get deployed in which account(s) in the main Region.
{
"AllAccounts": [{
"Accountname": "Test Account 1",
"AccountID": "123456789012",
"OwnerEmail": ["admin1@domain.com"],
"RootEmail" : "root1@domain.com",
"Tags": ["baseline", "confidentiality:high"]
}]
}
The engine matches the Tags in the account_list.json with the Tags in the parameters.json of the Rules. When a match is detected, the Rule is deployed in the target account.
This is an advanced scenario, where you want to deploy more than 2 different regional baselines. In this scenario, you can chose precisely which rule get deployed in which account(s) and in which region(s).
{
"AllAccounts": [{
"Accountname": "Test Account 1",
"AccountID": "123456789012",
"OwnerEmail": ["admin1@domain.com"],
"RootEmail" : "root1@domain.com",
"Region": "us-west-1",
"Tags": ["baseline", "confidentiality:high"]
}, {
"Accountname": "Test Account 1",
"AccountID": "123456789012",
"OwnerEmail": ["admin1@domain.com"],
"RootEmail" : "root1@domain.com",
"Region": "ap-southeast-1",
"Tags": ["otherregionsbaseline", "confidentiality:high"]
}]
}
The engine matches the Tags in the account_list.json with the Tags in the parameters.json of the Rules. When a match is detected, the Rule is deployed in the target region of the account.
Create the rule with the RDK (https://github.com/awslabs/aws-config-rdk)
Copy the entire RDK rule folder into the ./rules/ (including the 2 python files (code and test) and the parameters.json)
Use the RDK feature for "RuleSets" to add the rules to the appropriate RuleSet. By default, no RuleSet is configured. If you don't use the account_list.json, tag the rule with the value of the parameter "DefaultRuleSet" (the one in the CloudFormation template) to deploy in the main region and/or tag the rule with the value of the parameter "DefaultRuleSetOtherRegions" to deploy in the other region(s) (not main).
Add it into the "ruleset.zip" (see initial deployment section for details)
Run the CodePipeline pipeline named "Compliance-Engine-Pipeline"
Execute the saved Athena Queries that you can find in Athena > Saved Queries
See official documentation to import an Athena query in QuickSight: https://docs.aws.amazon.com/quicksight/latest/user/create-a-data-set-athena.html
Change the data type for the enginerecordedtime, resultrecordedtime & configruleinvokedtime from String to Data: yyyy-MM-dd HH:mm:ss
You need to create manually Calculated Fields. Here's some useful Formula examples:
DataAge: dateDiff({enginerecordedtime},now())
Confidentiality: ifelse(isNull({accountid[accountlist]}),"NOT REGISTERED",toUpper(split({tag2},":",2)))
WeightedConfidentiality: ifelse({Confidentiality} = "HIGH",3,{Confidentiality} = "MEDIUM",2,{Confidentiality} = "LOW",1,0)
WeightedRuleCriticity: ifelse({rulecriticity} = "1_CRITICAL",4,{rulecriticity} = "2_HIGH",3,{rulecriticity} = "3_MEDIUM",2,{rulecriticity} = "4_LOW",1,0)
ClassCriti: {WeightedClassification} * {WeightedRuleCriticity}
KinesisProcessingError: ifelse(isNull({configrulearn}),"ERROR", "OK")
The following are visual you can leverage. The format is:
Name of the Visual : type of QuickSight Visual - configuration of the Visual - filter on the Visual.
60-day trend on Number of AWS Accounts by Classification : Line Chart - X Axis: DataAge; Value: AccountID (Count Distinct); Color: AccountClassification - Filter: DataAge <= 60
Accounts with Critical Non-Compliant Rules : Horizontal Stack Bar Chart - Y Axis: AccountID; Value: RuleName (Count Distinct) - Filter: DataAge <= 1 & ClassCriti = [12,16] & ComplianceType = "NON_COMPLIANT"
60-day trend on Non-compliant Rule by ClassCriti : Line Chart - X Axis: DataAge; Value: AccountID (Count Distinct); Color: ClassCriti - Filter: DataAge <= 60
Resources in all Accounts : Horizontal Stack Bar Chart - Y Axis: ResourceType; Value: ResourceID (Count Distinct) - Filter: DataAge <= 1
Account Distribution by Account Classification : Horizontal Stack Bar Chart - Y Axis: accountclassification; Value: AccountID (Count Distinct) - Filter: DataAge = 0
Rule Distribution by Rule Criticity : Horizontal Stack Bar Chart - Y Axis: rulecriticity; Value: RuleName (Count Distinct) - Filter: DataAge <= 1
Non-Compliant Resources by RuleName and by ClassCriti : Heat Map - Row: RuleName ; Columns: ClassCriti; Values ResourceID (Count Distinct) - Filter: DataAge <= 1 & ComplianceType = "NON_COMPLIANT"
Trend of Non-Compliant Resources by Account Classification : Line Chart - X Axis: RecordedInDDBTimestamp; Value: ResourceID (Count Distinct); Color: accountclassification - Filter: ComplianceType = "NON_COMPLIANT"
List of Rules and Non-Compliant Resources: Table - Group by: rulename, resourceid; Value: ClassCriti (Max), AccountID (Count Distinct) - Filter: DataAge <= 1
Overall Compliance of Rules by Account Classification: Horizontal stacked 100% bar chart - Y axis: AccountClassification; Value: RuleArn (Count Distinct); Group/Color: ComplianceType - Filter: DataAge <= 1
Evolution of Compliance Status (last 50 days): Vertical stacked 100% bar chart - X axis: DataAge, Group/Color: ComplianceType - Filter: DataAge <= 50
Top 3 Account Non Compliant (weighted): Horizontal stacked bar chart - Y axis: AccountID , Value: DurationClassCriti (Sum), Group/Color: ClassCriti - Filter: ClassCriti >= 8
This project is licensed under the Apache 2.0 License