You can create custom rules to supplement predefined rules.
Currently, only the eu-de region supports FunctionGraph, so you can only create custom policies for the eu-de region.
To create a custom rule, you need to use FunctionGraph functions. Each rule is associated with a Function Graph function. Config reports events to the function. The function collects rule parameters and resource attributes from the events; evaluates whether your resources comply with the rule; and returns evaluation results using Open APIs of Config. Config sends events based on the trigger type (configuration changes or periodic) of a rule. For details about how to use FunctionGraph, see FunctionGraph User Guide.
This section describes how to create a custom rule by performing the following two procedures:
To evaluate resources with rules, you need to enable the resource recorder. Resource evaluation is subject to the following rules:
For details about how to enable and configure the resource recorder, see Configuring the Resource Recorder.
The agency grants the function required permissions and must include the rms:policyStates:update permission.
For details about example code, see Example Functions (Python).
For more details, see Creating an Event Function.
Parameter |
Description |
---|---|
Policy Type |
Select Custom policy. You can use custom policies to create rules. |
Rule Name |
The name of the rule. A rule name must be unique. A rule name can contain digits, letters, underscores (_), and hyphens (-) and cannot exceed 64 characters. |
Description |
A rule description can contain any types of characters and cannot exceed 512 characters. |
FunctionGraph Function |
The URN of the function. For details about how to create a FunctionGraph function, see Creating a Function with FunctionGraph. NOTE:
You can use either of the following methods to obtain the URN of a function:
|
Grant Permissions |
This agency grants Config the read-only and call permissions of FunctionGraph. These permissions allow you to customize rules to query and send events to FunctionGraph functions. NOTE:
|
Parameter |
Description |
---|---|
Trigger Type |
The condition under which a rule will be triggered. Trigger types are as follows:
|
Filter Type |
The type of resources to be evaluated. Filter types are as follows:
This parameter is mandatory only when Trigger Type is set to Configuration change. |
Resource Scope |
If you set Filter Type to Specific resources, you need to specify a resource scope.
This parameter is mandatory only when Trigger Type is set to Configuration change and the Filter Type is set to Specific resources. |
(Optional) Filter Scope |
After you enable Filter Scope, you can filter resources by resource ID or tag. You can specify a specific resource for compliance evaluation. This parameter is optional for a rule whose trigger type is configuration change. |
Execute Every |
How often a rule will be triggered. Available options: 1 hour, 3 hours, 6 hours, 12 hours, 24 hours. This parameter is mandatory only when Trigger Type is set to Periodic execution. |
Configure Rule Parameters |
You can set up to 10 rule parameters for a custom rule. |
After you add a rule, the first evaluation is automatically triggered immediately.