Lesson 2 of 5 AWS Config and AWS AppConfig

Evaluating Compliance with Config Rules and Conformance Packs

Recording configuration is useful; evaluating it against rules is what turns AWS Config into a compliance tool. This lesson explains managed and custom rules, trigger types and evaluation modes, conformance packs, and how rules and packs are deployed across an organisation.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish between managed rules, custom Lambda rules and custom policy rules written in Guard.
  • Explain configuration-change and periodic triggers and the detective and proactive evaluation modes.
  • Describe conformance packs and organisation-wide deployment of rules and packs.
  • Interpret compliance results and choose a rule design for a requirement.

Config Rules

A Config rule evaluates whether resources comply with a desired configuration and reports each resource as COMPLIANT, NON_COMPLIANT or NOT_APPLICABLE. Rules come in three forms.

Managed rules

Predefined by AWS, with parameters. There are hundreds, such as s3-bucket-public-read-prohibited, encrypted-volumes, rds-multi-az-support, restricted-ssh, iam-password-policy, required-tags, cloudtrail-enabled and access-keys-rotated. Managed rules should be used whenever one exists, because they need no code.

Custom Lambda rules

A Lambda function receives the configuration item or a periodic invocation, evaluates any logic, including calls to other APIs, and returns evaluations with PutEvaluations. They suit complex checks, such as comparing a resource with data in an external system.

Custom policy rules

Rules written in AWS CloudFormation Guard syntax and evaluated by Config without a Lambda function. They suit checks on the configuration item's properties and let teams reuse Guard rules from their pipelines, as described in the policy-as-code lesson.

Sort into groups

Choose the kind of rule

Exam skills 2.2.4

Choose the kind of Config rule for each requirement.

Log in to try this activity Interactive activities are free with an account.

Triggers and Evaluation Modes

A rule's trigger type decides when it runs. A configuration change trigger evaluates a resource whenever a CI is recorded for it, scoped by resource types, a tag or a specific resource; this gives near real-time detection. A periodic trigger runs at a fixed frequency of 1, 3, 6, 12 or 24 hours and suits account-level checks that are not tied to a resource change, such as whether CloudTrail is enabled or whether access keys are older than 90 days. Some rules support both.

A rule's evaluation mode is either detective, which evaluates resources that already exist, or proactive, which evaluates a resource configuration before it is deployed through the StartResourceEvaluation API. Proactive evaluation lets a provisioning process, such as a CloudFormation hook or a pipeline step, ask Config whether a planned resource would be compliant, and many managed rules support it.

Sort into groups

Choose the rule trigger

Exam skills 2.2.4 · 4.3.6

Choose when each Config rule should evaluate.

Log in to try this activity Interactive activities are free with an account.

Conformance Packs

A conformance pack is a collection of Config rules and remediation actions deployed and monitored as a single entity, defined in a YAML template similar to CloudFormation. AWS publishes sample packs for frameworks and best practices, such as Operational Best Practices for CIS AWS Foundations, PCI DSS, HIPAA, NIST 800-53 and individual services. A pack reports an overall compliance score, and its rules and remediations are created and removed together, which makes it easier to manage than many individual rules. Packs can include custom rules and parameters.

Deploying Across an Organisation

From the management account or a delegated administrator, organisation Config rules and organisation conformance packs deploy rules and packs to every account in the organisation, including new accounts, and member accounts cannot modify or delete them. Results are visible per account and in the aggregator. Alternatives are CloudFormation StackSets, which give more control over which accounts receive which rules, and AWS Control Tower detective controls, which deploy managed Config rules to OUs. Security Hub also uses Config rules internally for its security controls, so enabling Security Hub standards creates service-linked Config rules.

The table below compares the deployment options.

OptionScopeNotes
Organisation Config rules and conformance packsAll accounts in the organisationManaged from the management or delegated administrator account; protected from member changes
CloudFormation StackSetsSelected OUs, accounts and RegionsFlexible targeting and parameters per account
Control Tower detective controlsRegistered OUsManaged controls with guidance levels
Security Hub standardsAccounts where Security Hub is enabledService-linked rules for security controls
Worked example

Designing Rules for Requirements

A company has four requirements: every S3 bucket must block public access; every resource must have a CostCentre tag; IAM access keys must be rotated within 90 days; and every EC2 instance's AMI must be one approved in an internal list held in a DynamoDB table.

RequirementRuleTrigger
Bucket public access blockedManaged s3-bucket-level-public-access-prohibitedConfiguration change
CostCentre tagManaged required-tags with the tag key parameterConfiguration change
Key rotationManaged access-keys-rotated with maxAccessKeyAge 90Periodic
Approved AMIs from DynamoDBCustom Lambda rule that reads the tableConfiguration change on EC2 instances

The rules are packaged in an organisation conformance pack deployed from the security tooling account, so every account, including new ones, is evaluated identically. The custom rule's Lambda function lives in the security account, and each account's Config invokes it through a cross-account permission.

Check yourself

A team wants to check whether CloudTrail is enabled in every account and Region. Which trigger type should the rule use?

Show answer

Periodic. The check concerns the account rather than a resource change, so the managed cloudtrail-enabled rule runs on a schedule.

Exam Tips

Remember for the exam

  • Prefer managed Config rules; use custom Lambda rules for logic needing external data and Guard custom policy rules for property checks without code.
  • Configuration change triggers evaluate on each change; periodic triggers (1 to 24 hours) suit account-level checks.
  • Proactive evaluation (StartResourceEvaluation) checks planned resources before deployment.
  • Conformance packs group rules and remediations; organisation rules and packs deploy to every account and cannot be changed by members.