A rule is logic code stored in a function of Function Compute. You can create a rule based on a managed rule provided by Cloud Config or create a custom rule function in Function Compute. You can also submit a ticket and provide your required rules to Alibaba Cloud after-sales engineers. The engineers will evaluate the rules and add them as managed rules as required.

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 principles.

You can create up to 200 rules.

Create a rule based on a managed rule

You can create a rule based on an existing rule function in Function Compute. For more information, see Managed rules.

  1. Log on to the Cloud Config console.
  2. In the left-side navigation pane, click Rules.
  3. On the Rules page, click Create Rule.
  4. In the Basic Settings step of the Create Rule wizard, set Created By to Managed Rule, select a rule in the Rule ARN section, set the name and risk level of the rule, and then click Next.
    Basic Settings step
  5. In the Scheduling Settings step of the Create Rule wizard, set the Value parameter in the Rule Parameters section and click Next.
    Scheduling Settings step
    Note When you create a rule based on a managed rule, the default settings for the trigger type, related resources, and input parameters are used.
  6. In the Correction Settings step of the Create Rule wizard, set Correction Method to Disable Correction and click Submit.

    You can bind a correction template to the current rule. For more information, see Set automatic correction or Set manual correction.

    Set Correction Method to Disable Correction
  7. View the rule creation result.
    In the Complete step of the Create Rule wizard, you can view the rule creation result.
    • Click View Details. On the page that appears, you can view the basic information about the current rule, correction details, trigger of the rule, and compliance results of resources evaluated by the rule.
    • Click Return to Rule List. On the Rules page, you can view the rule, the status of which is Active.

Create a rule by using the rule function you create in Function Compute

You can create a custom rule function in Function Compute and use the rule function to create a rule. For more information, see Create a custom rule.

  1. Log on to the Cloud Config console.
  2. In the left-side navigation pane, click Rules.
  3. On the Rules page, click Create Rule.
  4. In the Basic Settings step of the Create Rule wizard, set Created By to Function Compute, set parameters in the Function ARN section, set the name and risk level of the rule, and then click Next.
    Basic Settings step - Function Compute

    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.

  5. In the Scheduling Settings step of the Create Rule wizard, set the Trigger Type parameter, select the type of resources to be evaluated by the rule, add and set one or more input parameters as required, and then click Next.
    Scheduling Settings step - Function Compute
    • After you select a resource type, the rule monitors all resources of the specified type under your account. A rule can be used to monitor one or more types of resources.
    • If you need to add more input parameters, click Add Rule Parameter and set the Key, Relation, and Value parameters. The name of an input parameter must be the same as that of the actual configuration item of a resource.
  6. In the Correction Settings step of the Create Rule wizard, set Correction Method to Disable Correction and click Submit.

    You can bind a correction template to the current rule. For more information, see Set automatic correction or Set manual correction.

    Set Correction Method to Disable Correction
  7. View the rule creation result.
    In the Complete step of the Create Rule wizard, you can view the rule creation result.
    • Click View Details. On the page that appears, you can view the basic information about the current rule, correction details, trigger of the rule, and compliance results of resources evaluated by the rule.
    • Click Return to Rule List. On the Rules page, you can view the rule, the status of which is Active.

Create a rule by using Visual Editor

  1. Log on to the Cloud Config console.
  2. In the left-side navigation pane, click Rules.
  3. On the Rules page, click Create Rule.
  4. In the Basic Settings step of the Create Rule wizard, set Created By to Visual Editor, set the name and risk level for the rule, and then click Next.
    Create a rule by using Visual Editor
  5. In the Scheduling Settings step of the Create Rule wizard, set the Trigger Type parameter, select the type of resources to be evaluated by the rule, add and set one or more input parameters as required, and then click Next.
    Scheduling Settings step - Visual Editor
    • After you select a resource type, the rule monitors all resources of the specified type under your account. A rule can be used to monitor one or more types of resources.
    • If you need to add more input parameters, click Add Rule Parameter and set the Key, Relation, and Value parameters.
  6. In the Correction Settings step of the Create Rule wizard, set Correction Method to Disable Correction and click Submit.

    You can bind a correction template to the current rule. For more information, see Set automatic correction or Set manual correction.

    Set Correction Method to Disable Correction
  7. View the rule creation result.
    In the Complete step of the Create Rule wizard, you can view the rule creation result.
    • Click View Details. On the page that appears, you can view the basic information about the current rule, correction details, trigger of the rule, and compliance results of resources evaluated by the rule.
    • Click Return to Rule List. On the Rules page, you can view the rule, the status of which is Active.