After you enable non-compliance event delivery in Cloud Config, non-compliance events are automatically sent to CloudMonitor when resource configurations violate rules. You can view these events in CloudMonitor and set up event-based alert notifications.
Scenarios
In this example, a high-risk rule based on the ecs-instance-deletion-protection-enabled managed rule is created in the Cloud Config console. Cloud Config audits all Elastic Compute Service (ECS) instances within the current account or multiple accounts and checks whether release protection is enabled. If some ECS instances do not have release protection enabled, Cloud Config delivers the non-compliance events to CloudMonitor, where event-based alerting triggers notifications.
Delivery and alerting for the non-compliance events of the current account
Step 1: Enable the non-compliance event delivery feature for the current account
-
Log on to the Cloud Config console.
-
In the left-side navigation pane, click Deliveries, and then click the Integrate Service tab.
-
Turn on the Deliver Non-compliance Events for Current Account switch.
This switch is in the Non-compliance Events section of the CloudMonitor card on the Integrate Service tab.
Step 2: Create a rule
-
Log on to the Cloud Config console.
-
In the left-side navigation pane, choose .
-
On the Rules page, click Create Rule.
-
On the Select Create Method page, select Based on managed rule, search for the ecs-instance-deletion-protection-enabled managed rule, and then click Next.
-
On the Set Basic Properties page, keep the default settings for the rule name, parameters, risk level, trigger, and description, and then click Next.
-
On the Set Effective Scope page, keep the default resource type and click Next.
-
On the Set Correction page, click Submit.
-
View the compliance check results of the non-compliance events.
-
View the compliance check results of the non-compliance events in the Cloud Config console
In the left-side navigation pane, choose Compliance & Audit > Rules, and click the name of the target rule to open its details page. On the Evaluation Results tab, you can view a data summary, including the Number of Non-compliant Resources, the total number of audited resources, and the number of compliant resources, as well as a list of the latest evaluation data filtered by compliance status. To modify the rule, click Edit or Re-evaluate in the upper-right corner.
-
View the compliance check results of the non-compliance events in the CloudMonitor console
In the left-side navigation pane, choose Event Center > System Events. In the filter criteria, select Cloud Config for Product and Non-compliance Event for Event Type. In the search box, enter the rule name, such as
ecs-instance-deletion-protection-enabled, click Search. In the Actions column of the event list, click Details to view the non-compliance event details.
-
Step 3: Configure an alert rule
This section describes how to create an alert contact to receive notifications by SMS and email.
-
Create an alert contact.
-
Log on to the Cloud Monitor console.
-
In the left-side navigation pane, choose .
-
On the Alert Contacts tab, click Create Alert Contact.
-
In the Set Alert Contact panel, enter the name, mobile number, and email address of the alert contact.
NoteFor more information about how to send alert notifications by using DingTalk, Lark, WeCom, and Slack, see the Create an alert contact section of the "Create an alert contact or alert contact group" topic.
-
After you confirm the information, complete the slider verification and click OK.
-
Activate the email address and mobile number of the alert contact.
By default, the status of the email address and mobile number of an alert contact is Pending Activation. The alert contact must click the activation links in the email and SMS message within 24 hours. Otherwise, the contact cannot receive alert notifications. After activation, you can view the mobile number and email address of the alert contact in the alert contact list.
-
-
Create an alert contact group.
On the Alert Contacts page, click the Alert Contact Group tab.
On the Alert Contact Group tab, click Create Alert Contact Group.
In the Create Alert Contact Group panel, enter a name for the group and select the desired alert contacts.
Click OK.
-
Create an event subscription policy.
After Cloud Config delivers non-compliance events to CloudMonitor, you can create a system event subscription policy to receive alert notifications for these events by SMS and email.
-
In the left-side navigation pane, choose .
-
On the Subscription Policy tab, click Create Subscription Policy.
-
On the Create Subscription Policy page, configure the parameters for the subscription policy.
-
Basic Information: Enter a name for the subscription policy.
-
Alert Subscription: Set Subscription Type to System Events. Under Subscription Scope, set Products to Cloud Config, Event Type to Notifications, Event Name to Non-compliance Event, and Event Level to Notification (Info). You can enter keywords in the Event Content field to filter events or leave the field empty. Leave Application grouping and Event Resources unconfigured.
Note-
For more information about the system events supported by Cloud Config, see the events listed on the CloudConfig page.
-
The Event Content field filters events by keyword. For example, if you enter Critical, the policy matches only Cloud Config rules whose Risk Level is High. You can leave this parameter unconfigured or specify other keywords.
-
-
Combined Noise Reduction: Keep the default settings.
-
Notifications: When you create the notification configuration, select the alert contact group that you created in Step 2. In the Custom Notification Method section, add Info to the Alert Level for SMS, and leave the Alert Level for Mail unchanged.
Note-
For more information about how to create a notification configuration, see the Create a notification policy section of the "Manage notification configurations" topic.
-
CloudMonitor automatically sends alert notifications based on the notification methods of the alert contacts in the Alert Contact Group and the alert levels specified in the Custom Notification Method section.
-
-
Push and Integration: No configuration is required.
-
-
Click Submit.
-
Delivery and alerting for the non-compliance events of multiple accounts
The management account can enable non-compliance event delivery for multiple accounts, so that non-compliance events from members in an account group are delivered to CloudMonitor for event-based alerting.
Prerequisites
-
A resource directory is enabled and the required Alibaba Cloud accounts are added to it. For more information, see Enable a resource directory on the Resources page.
-
An account group is created. For more information, see Create an account group.
Step 1: Enable the non-compliance event delivery feature for multiple accounts
-
Log on to the Cloud Config console.
-
In the left-side navigation pane, click Deliveries, and then click the Integrate Service tab.
-
Turn on the Deliver Non-compliance Events for Multiple Accounts switch.
-
This switch is in the CloudMonitor section.
Step 2: Create a rule
-
Log on to the Cloud Config console.
-
In the upper-left corner, select the target account group, such as Test-fofo, from the account group drop-down list.
-
In the left-side navigation pane, choose .
-
On the Rules page, click Create Rule.
-
On the Select Create Method page, select Based on managed rule, search for the ecs-instance-deletion-protection-enabled managed rule, and then click Next.
-
On the Set Basic Properties page, keep the default settings for the rule name, parameters, risk level, trigger, and description, and then click Next.
-
On the Set Effective Scope page, keep the default resource type and click Next.
-
On the Set Correction page, click Submit.
-
View the compliance check results of the non-compliance events.
-
View the compliance check results of the non-compliance events in the Cloud Config console
In the left-side navigation pane of the Cloud Config console, choose Compliance & Audit > Rules. From the account group drop-down list, select Test-fofo. Click the target rule ecs-instance-deletion-protection-enabled to open its details page. On the Evaluation Results tab, view the data summary. If the Number of Non-compliant Resources is 4 and the total number of audited resources is also 4, this indicates that release protection is disabled for all four ECS instances, and they are therefore evaluated as non-compliant.
-
View the compliance check results of the non-compliance events in the CloudMonitor console
In the left-side navigation pane, choose Event Center > System Events. In the filter criteria, select Cloud Config for Product and Non-compliance Event for Event Type. In the search box, enter the rule name, such as ecs-instance-deletion-protection-enabled, and click Search. In the Actions column of the event list, click Details to view the non-compliance event details.
-
Step 3: Configure an alert rule
This section describes how to create an alert contact to receive notifications by SMS and email.
-
Create an alert contact.
-
Log on to the Cloud Monitor console.
-
In the left-side navigation pane, choose .
-
On the Alert Contacts tab, click Create Alert Contact.
-
In the Set Alert Contact panel, enter the name, mobile number, and email address of the alert contact.
NoteFor more information about how to send alert notifications by using DingTalk, Lark, WeCom, and Slack, see the Create an alert contact section of the "Create an alert contact or alert contact group" topic.
-
After you confirm the information, complete the slider verification and click OK.
-
Activate the email address and mobile number of the alert contact.
By default, the status of the email address and mobile number of an alert contact is Pending Activation. The alert contact must click the activation links in the email and SMS message within 24 hours. Otherwise, the contact cannot receive alert notifications. After activation, you can view the mobile number and email address of the alert contact in the alert contact list.
-
-
Create an alert contact group.
On the Alert Contacts page, click the Alert Contact Group tab.
On the Alert Contact Group tab, click Create Alert Contact Group.
In the Create Alert Contact Group panel, enter a name for the group and select the desired alert contacts.
Click OK.
-
Create an event subscription policy.
After Cloud Config delivers non-compliance events to CloudMonitor, you can create a system event subscription policy to receive alert notifications for these events by SMS and email.
-
In the left-side navigation pane, choose .
-
On the Subscription Policy tab, click Create Subscription Policy.
-
On the Create Subscription Policy page, configure the parameters for the subscription policy.
-
Basic Information: Enter a name for the subscription policy.
-
Alert Subscription: Set Subscription Type to System Events. Under Subscription Scope, set Products to Cloud Config, Event Type to Notifications, Event Name to Non-compliance Event, and Event Level to Notification (Info). You can enter keywords in the Event Content field to filter events or leave the field empty. Leave Application grouping and Event Resources unconfigured.
Note-
For more information about the system events supported by Cloud Config, see the events listed on the CloudConfig page.
-
The Event Content field filters events by keyword. For example, if you enter Critical, the policy matches only Cloud Config rules whose Risk Level is High. You can leave this parameter unconfigured or specify other keywords.
-
-
Combined Noise Reduction: Keep the default settings.
-
Notifications: When you create the notification configuration, select the alert contact group that you created in Step 2. In the Custom Notification Method section, add Info to the Alert Level for SMS, and keep the Alert Level for Mail unchanged.
Note-
For more information about how to create a notification configuration, see the Create a notification policy section of the "Manage notification configurations" topic.
-
CloudMonitor automatically sends alert notifications based on the notification methods of the alert contacts in the Alert Contact Group and the alert levels specified in the Custom Notification Method section.
-
-
Push and Integration: No configuration is required.
-
-
Click Submit.
-