Adding Amazon Config Rules
You can use the Amazon Config console or the Amazon SDKs to add rules.
Adding Rules (Console)
The Rules page shows your rules and their current compliance results in a table. The result for each rule is Evaluating... until Amazon Config finishes evaluating your resources against the rule. You can update the results with the refresh button. When Amazon Config finishes evaluations, you can see the rules and resource types that are compliant or noncompliant. For more information, see Viewing Compliance Information and Evaluation Results for your Amazon Resources.
Note
Amazon Config evaluates only the resource types that it is recording. For example, if you add the cloudtrail-enabled rule but don't record the CloudTrail trail resource type, Amazon Config can't evaluate whether the trails in your account are compliant or noncompliant. For more information, see Recording Amazon Resources.
To add a rule
Sign in to the Amazon Web Services Management Console and open the Amazon Config console at https://console.amazonaws.cn/config/
. -
In the Amazon Web Services Management Console menu, verify that the region selector is set to a region that supports Amazon Config rules. For the list of supported regions, see Amazon Config Regions and Endpoints in the Amazon Web Services General Reference.
-
In the left navigation, choose Rules.
-
On the Rules page, choose Add rule.
-
On the Specify rule type page, specify the rule type by completing the following steps:
-
Type in the search field to filter the list of managed rules by rule name, description, and label. For example, type EC2 to return rules that evaluate EC2 resource types or type periodic to return rules that are triggered periodically.
-
You can also create your own custom rule. Choose Create custom rule using Lambda or Create custom rule using Guard, and follow the procedure in Creating Amazon Config Custom Lambda Rules or Creating Amazon Config Custom Policy Rules.
-
-
On the Configure rule page, configure your rule by completing the following steps:
-
For Name, type a unique name for the rule.
-
For Description, type a description for the rule.
-
For Evaluation mode, choose when in the resource creation and management process you want Amazon Config to evaluate your resources. Depending on the rule, Amazon Config can evaluate your resource configurations before a resource has been deployed, after a resource has been deployed, or both.
-
Choose Turn on proactive evaluation to allow you to run evaluations on the configuration settings of your resources before they are deployed.
After you have turned on proactive evaluation, you can use the StartResourceEvaluation API and GetResourceEvaluationSummary API to check if the resources you specify in these commands would be flagged as NON_COMPLIANT by the proactive rules in your account in your Region.
For more information on using this commands, see Evaluating Your Resources with Amazon Config Rules. For a list of managed rules that support proactive evaluation, see List of Amazon Config Managed Rules by Evaluation Mode.
-
Choose Turn on detective evaluation to evaluate the configuration settings of your existing resources.
For detective evaluation, there are two types of triggers: When configuration changes and Periodic.
-
If the trigger types for your rule include Configuration changes, specify one of the following options for Scope of changes with which Amazon Config invokes your Lambda function:
-
Resources – When a resource that matches the specified resource type, or the type plus identifier, is created, changed, or deleted.
-
Tags – When a resource with the specified tag is created, changed, or deleted.
-
All changes – When a resource recorded by Amazon Config is created, changed, or deleted.
Amazon Config runs the evaluation when it detects a change to a resource that matches the rule's scope. You can use the scope to define which resources initiate evaluations.
-
-
If the trigger types for your rule include Periodic, specify the Frequency with which Amazon Config invokes your Lambda function.
-
-
-
For Parameters, you can customize the values for the provided keys if your rule includes parameters. A parameter is an attribute that your resources must adhere to before they are considered compliant with the rule.
-
-
On the Review and create page, review all your selections before adding the rule to your Amazon Web Services account. If your rule is not working as expected, you might see one of the following for Compliance:
-
No results reported - Amazon Config evaluated your resources against the rule. The rule did not apply to the Amazon resources in its scope, the specified resources were deleted, or the evaluation results were deleted. To get evaluation results, update the rule, change its scope, or choose Re-evaluate.
This message may also appear if the rule didn't report evaluation results.
-
No resources in scope - Amazon Config cannot evaluate your recorded Amazon resources against this rule because none of your resources are within the rule’s scope. To get evaluation results, edit the rule and change its scope, or add resources for Amazon Config to record by using the Settings page.
-
Evaluations failed - For information that can help you determine the problem, choose the rule name to open its details page and see the error message.
-
Adding Rules (Amazon SDKs)
The following code examples show how to use PutConfigRule
.