This topic describes how to create a rule. A rule is a piece of logic judgment code
that is stored in a rule function of Function Compute. You can create a rule based
on a managed rule that is provided by Cloud Config. You can also create a rule by
using Function Compute or Visual Editor. If you require other managed rules, you can
submit a ticket to Alibaba Cloud. If the rules are appropriate, Alibaba Cloud will
support them and implement rules with universal applicability as managed rules in
Cloud Config.
Background information
Before you create a rule, you must familiarize yourself with the definition of rules
and how rules work. For more information, see Rule definition and implementation.
Create a rule by using a managed rule
You can create a rule based on an existing rule function in Function Compute. For
more information, see Managed rules.
- Log on to the Cloud Config console.
- In the left-side navigation pane, click Rules.
- On the Rules page, click Create Rule.
- In the Basic Settings step, set the Method parameter to Managed Rule, select a managed rule and risk level in the Managed rule and Risk Level sections, and then click Next.
- In the Parameter Settings step, specify the threshold values of the input parameters and click Next.

Note When you create a rule by using a managed rule, the default settings for the trigger
type, related resources, and input parameters are used.
- In the Remediation Settings step, set the Remediation Method parameter to Disable Remediation and click Submit.
- View the rule creation result.
In the
Complete step, view the creation result.
- Click View Details. The details page of the rule appears. You can view the detailed information on the
Rule Details and Correction Details tabs.
- Click Return to Rule List. The Rules page appears, where you can view the information of the rule. The rule is in the
Active state.
Create a rule by using Function Compute
You can create a rule function in Function Compute and use the rule function to create
a rule. For more information, see Create a custom rule by using Function Compute.
- Log on to the Cloud Config console.
- In the left-side navigation pane, click Rules.
- On the Rules page, click Create Rule.
- In the Basic Settings step, set the Method parameter to Function Compute, enter a rule name in the Rule Name field, select a function from the Function ARN drop-down list, select a risk level in the Risk Level section, and then click Next.

You can select a function only after you have created one in Function Compute. If
you have not created a function in Function Compute, click Create New Function to create a function in the Function Compute console.For more information, see Function operations.
- In the Parameter Settings step, select the trigger type and related resources, specify the input parameters,
and then click Next.

- After you select the resource types, Cloud Config monitors all your resources of the
specified types based on the rule. Each rule can be applied to one or more resource
types.
- You can click Add Rule Parameter to add an input parameter. You must enter the key
and value for each input parameter in the Key and Value fields. The key of an input parameter must be the same as the configuration name
of the resource.
- In the Remediation Settings step, set the Remediation Method parameter to Disable Remediation and click Submit.
- View the rule creation result.
In the
Complete step, view the creation result.
- Click View Details. The details page of the rule appears. You can view the detailed information on the
Rule Details and Correction Details tabs.
- Click Return to Rule List. The Rules page appears, where you can view the information of the rule. The rule is in the
Active state.
Create a rule by using Visual Editor
- Log on to the Cloud Config console.
- In the left-side navigation pane, click Rules.
- On the Rules page, click Create Rule.
- In the Basic Settings step, set the Method parameter to Visual Editor, enter a rule name in the Rule Name field, select a risk level in the Risk Level section, and then click Next.
- In the Parameter Settings step, select the related resource, specify the input parameters, and then click Next.

- After you select a resource type, Cloud Config monitors all your resources of the
specified type based on the rule. Each rule can be applied to one resource type.
- You must set the Key, Relation, and Value parameters for the input parameters.
- In the Remediation Settings step, set the Remediation Method parameter to Disable Remediation and click Submit.
- View the rule creation result.
In the
Complete step, view the creation result.
- Click View Details. The details page of the rule appears. You can view the detailed information on the
Rule Details and Correction Details tabs.
- Click Return to Rule List. The Rules page appears, where you can view the information of the rule. The rule is in the
Active state.