Automation rules
Automation rules can be used to automatically update findings in Security Hub. As findings are ingested, Security Hub can apply a variety of rule actions, such as suppressing findings, changing their severity, and adding notes to findings. Such rule actions take effect when findings match your specified criteria, such as which resource or account ID the finding is associated with or its title.
Examples of use cases for automation rules include:
-
Elevating a finding’s severity to
CRITICAL
if the finding's resource ID refers to a business-critical resource. -
Elevating a finding’s severity from
HIGH
toCRITICAL
if the finding affects resources in specific production accounts. -
Assigning specific findings that have a severity of
INFORMATIONAL
aSUPPRESSED
workflow status.
Automation rules can be used to update select finding fields in the AWS Security Finding Format (ASFF). Rules apply to both new findings and updated findings.
You can create a custom rule from scratch, or use a rule template provided by Security Hub. If you use a rule template, you can modify it as needed for your use case.
How automation rules work
Only the Security Hub administrator account can create, delete, edit, and view automation rules. A rule that an administrator creates applies to findings in the administrator account and member accounts.
By defining member account IDs as criteria, Security Hub administrators can also use automation rules to update findings or take action on findings in specific member accounts.
You create an automation rule by defining criteria. When a finding matches the defined criteria, Security Hub applies the rule action to it. For more information about available criteria and actions, see Available rule criteria and rule actions.
Important
The delegated administrator must create an automation rule in each Region and account in which you want the rule to
apply to findings, regardless of the rule criteria. To deploy a rule across multiple
Regions, the delegated administrator can use a multi-Region automation rules deployment script
To get a history of how automation rules have changed your findings, see Finding history.
Automation rules apply to new and updated findings that Security Hub generates or ingests after you create the rule. Security Hub updates control findings every 12-24 hours or when the associated resource changes state. For more information, see Schedule for running security checks.
Security Hub currently supports a maximum of 100 automation rules for an administrator account.
Rule order
When creating automation rules, you assign each rule an order. This determines the order in which Security Hub applies your automation rules, and becomes important when multiple rules relate to the same finding or finding field.
When multiple rule actions relate to the same finding or finding field, the rule with the highest numerical value for rule order applies last and has the ultimate effect.
When you create a rule in the Security Hub console, Security Hub automatically assigns rule order based on the order of rule creation. The most recently created rule has the lowest numerical value for rule order and therefore applies first. Security Hub applies subsequent rules in ascending order.
When you create a rule through the Security Hub API or AWS CLI, Security Hub applies the rule with
the lowest numerical value for RuleOrder
first. It then applies
subsequent rules in ascending order. If multiple findings have the same
RuleOrder
, Security Hub applies a rule with an earlier value for the
UpdatedAt
field first (that is, the rule which was most recently
edited applies last).
You can modify rule order at any time.
Example of rule order:
Rule A (rule order is 1
):
-
Rule A criteria
-
ProductName
=Security Hub
-
Resources.Type
isS3 Bucket
-
Compliance.Status
=FAILED
-
RecordState
isNEW
-
Workflow.Status
=ACTIVE
-
-
Rule A actions
-
Update
Confidence
to95
-
Update
Severity
toCRITICAL
-
Rule B (rule order is 2
):
-
Rule B criteria
-
AwsAccountId
=123456789012
-
-
Rule B actions
-
Update
Severity
toINFORMATIONAL
-
Rule A actions apply first to Security Hub findings that match Rule A criteria. Next,
Rule B actions apply to Security Hub findings with the specified account ID. In this
example, since Rule B applies last, the end value of Severity
in
findings from the specified account ID is INFORMATIONAL
. Based on the
Rule A action, the end value of Confidence
in matched findings is
95
.
Available rule criteria and rule actions
The following ASFF fields are currently supported as criteria for automation rules.
ASFF field | Filters | Field type |
---|---|---|
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
Select: [ |
|
|
Number |
|
|
Date (formatted as 2022-12-01T21:47:39.269Z) |
|
|
Number |
|
|
String |
|
|
Date (formatted as 2022-12-01T21:47:39.269Z) |
|
|
String |
|
|
String |
|
|
Date (formatted as 2022-12-01T21:47:39.269Z) |
|
|
String |
|
|
Date (formatted as 2022-12-01T21:47:39.269Z) |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
String |
|
|
Map |
|
|
String |
|
|
String |
|
|
String |
|
|
Map |
|
|
Select (see Resources supported by ASFF) |
|
|
Select: [ |
|
|
String |
|
|
String |
|
|
String |
|
|
Date (formatted as 2022-12-01T21:47:39.269Z) |
|
|
Map |
|
|
String |
|
|
Select: [ |
The following ASFF fields are currently supported as actions for automation rules:
-
Confidence
-
Criticality
-
Note
-
RelatedFindings
-
Severity
-
Types
-
UserDefinedFields
-
VertificationState
-
Workflow
For more information about specific ASFF fields, see AWS Security Finding Format (ASFF) syntax and ASFF examples.
Tip
If you want Security Hub to stop generating findings for a specific control, we recommend disabling the control instead of using an automation rule. When you disable a control, Security Hub stops running security checks on it and stops generating findings for it, so you won't incur charges for that control. We recommend using automation rules to change the values of specific ASFF fields for findings that match defined criteria. For more information about disabling controls, see Enabling and disabling controls in all standards.
Creating automation rules
You can create a custom rule from scratch or use a pre-populated Security Hub rule template.
You can only create one automation rule at a time. To create multiple automation rules, follow the console procedures multiple times, or call the API or command multiple times with your desired parameters.
You must create an automation rule in each Region and account in which you want the rule to apply to findings.
When you create an automation rule in the Security Hub console, Security Hub shows you a preview of the findings to which your rule applies. The preview is currently not supported if your rule criteria include a CONTAINS or NOT_CONTAINS filter. You can choose these filters for map and string field types.
Important
AWS recommends that you don't include personally identifying, confidential, or sensitive information in your rule name, description, or other fields.
Creating a rule from a template (console only)
Currently, only the Security Hub console supports rule templates. These templates reflect common use cases for automation rules and can help you get started with the feature. Complete the following steps to create an automation rule from a template in the console.
Creating a custom rule
Choose your preferred method, and complete the following steps to create a custom automation rule.
Viewing automation rules
Choose your preferred method, and follow the steps to view your automation rules and the details of each rule.
Editing automation rules
When you edit an automation rule, the changes apply to new and updated findings that Security Hub generates or ingests after the rule edit.
Choose your preferred method, and follow the steps to edit the contents of an automation rule. You can edit one or more rules with a single request. For instructions on editing rule order, see Editing rule order.
Editing rule order
In some cases, you might want to keep the rule criteria and actions as is, but change the order in which Security Hub applies an automation rule. Choose your preferred method, and follow the steps to edit rule order.
Deleting automation rules
When you delete an automation rule, Security Hub removes it from your account and no longer applies the rule to findings.
Choose your preferred method, and follow the steps to delete an automation rule. You can delete one or more rules in a single request.
Tip
As an alternative to deletion, you can disable a rule. This retains the rule for future use, but Security Hub won't apply the rule to any matching findings until you enable it.
Automation rule examples
This section include some example automation rules for common use cases. These examples correspond to rule templates in the Security Hub console.
Elevate severity to Critical when specific resource such as an S3 bucket is at risk
In this example, the rule criteria are matched when the ResourceId
in
a finding is a specific Amazon Simple Storage Service (Amazon S3) bucket. The rule action is to change the
severity of matched findings to CRITICAL
. You can modify this template
to apply to other resources.
Example API request:
{ "IsTerminal":
true
, "RuleName": "Elevate severity of findings that relate to important resources
", "RuleOrder":1
, "RuleStatus": "ENABLED
", "Description": "Elevate finding severity to
", "Criteria": { "ProductName": [{ "Value": "CRITICAL
when specific resource such as an S3 bucket is at riskSecurity Hub
", "Comparison": "EQUALS
" }], "ComplianceStatus": [{ "Value": "FAILED
", "Comparison": "EQUALS
" }], "RecordState": [{ "Value": "ACTIVE
", "Comparison": "EQUALS
" }], "WorkflowStatus": [{ "Value": "NEW
", "Comparison": "EQUALS
" }], "ResourceId": [{ "Value": "arn:aws:s3:::examplebucket/developers/design_info.doc
", "Comparison": "EQUALS
" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label": "CRITICAL
" }, "Note": { "Text": "This is a critical resource. Please review ASAP.
", "UpdatedBy": "sechub-automation
" } } }] }
Example CLI command:
aws securityhub create-automation-rule \ --is-terminal \ --rule-name
"
\ --rule-orderElevate severity of findings that relate to important resources
"\ --rule-status
1
"
\ --descriptionENABLED
""
\ --criteria '{ "ProductName": [{ "Value":Elevate finding severity to
"CRITICAL
when specific resource such as an S3 bucket is at risk"
, "Comparison":Security Hub
""
}], "ComplianceStatus": [{ "Value":EQUALS
""
, "Comparison":FAILED
""
}], "RecordState": [{ "Value":EQUALS
""
, "Comparison":ACTIVE
""
}], "WorkflowStatus": [{ "Value":EQUALS
""
, "Comparison":NEW
""
}], "ResourceId": [{ "Value":EQUALS
""arn:aws:
, "Comparison":s3:::examplebucket/developers/design_info.doc
""
}] }' \ --actions '[{ "Type":EQUALS
""FINDING_FIELDS_UPDATE"
, "FindingFieldsUpdate": { "Severity": { "Label":"
}, "Note": { "Text":CRITICAL
""
, "UpdatedBy":This is a critical resource. Please review ASAP.
""
} } }]' \ --regionsechub-automation
"
us-east-1
Elevate severity of findings that relate to resources in production accounts
In this example, the rule criteria are matched when a HIGH
severity
finding is generated in specific production accounts. The rule action is to change
the severity of matched findings to CRITICAL
.
Example API request:
{ "IsTerminal":
false
, "RuleName": "Elevate severity for production accounts
", "RuleOrder":1
, "RuleStatus": "ENABLED
", "Description": "Elevate finding severity from
", "Criteria": { "ProductName": [{ "Value": "HIGH
toCRITICAL
for findings that relate to resources in specific production accountsSecurity Hub
", "Comparison": "EQUALS
" }], "ComplianceStatus": [{ "Value": "FAILED
", "Comparison": "EQUALS
" }], "RecordState": [{ "Value": "ACTIVE
", "Comparison": "EQUALS
" }], "WorkflowStatus": [{ "Value": "NEW
", "Comparison": "EQUALS
" }], "SeverityLabel": [{ "Value": "HIGH
", "Comparison": "EQUALS
" }], "AwsAccountId": [ { "Value": "111122223333
", "Comparison": "EQUALS
" }, { "Value": "123456789012
", "Comparison": "EQUALS
" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Severity": { "Label": "CRITICAL
" }, "Note": { "Text": "A resource in production accounts is at risk. Please review ASAP.
", "UpdatedBy": "sechub-automation
" } } }] }
Example CLI command:
aws securityhub create-automation-rule \ --no-is-terminal \ --rule-name
"
\ --rule-orderElevate severity of findings that relate to resources in production accounts
"\ --rule-status
1
"
\ --descriptionENABLED
""
\ --criteria '{ "ProductName": [{ "Value":Elevate finding severity from
"HIGH
toCRITICAL
for findings that relate to resources in specific production accounts"
, "Comparison":Security Hub
""
}], "ComplianceStatus": [{ "Value":EQUALS
""
, "Comparison":FAILED
""
}], "RecordState": [{ "Value":EQUALS
""
, "Comparison":ACTIVE
""
}], "SeverityLabel": [{ "Value":EQUALS
""
, "Comparison":HIGH
""
}], "AwsAccountId": [ { "Value":EQUALS
""
, "Comparison":111122223333
""
}, { "Value":EQUALS
""
, "Comparison":123456789012
""
}] }' \ --actions '[{ "Type":EQUALS
""FINDING_FIELDS_UPDATE"
, "FindingFieldsUpdate": { "Severity": { "Label":"
}, "Note": { "Text":CRITICAL
""
, "UpdatedBy":A resource in production accounts is at risk. Please review ASAP.
""
} } }]' \ --regionsechub-automation
"
us-east-1
Suppress informational findings
In this example, the rule criteria are matched for INFORMATIONAL
severity findings sent to Security Hub from Amazon GuardDuty. The rule action is to change the
workflow status of matched findings to SUPPRESSED
.
Example API request:
{ "IsTerminal":
false
, "RuleName": "Suppress informational findings
", "RuleOrder":1
, "RuleStatus": "ENABLED
", "Description": "Suppress GuardDuty findings with
", "Criteria": { "ProductName": [{ "Value": "INFORMATIONAL
severityGuardDuty
", "Comparison": "EQUALS
" }], "RecordState": [{ "Value": "ACTIVE
", "Comparison": "EQUALS
" }], "WorkflowStatus": [{ "Value": "NEW
", "Comparison": "EQUALS
" }], "SeverityLabel": [{ "Value": "INFORMATIONAL
", "Comparison": "EQUALS
" }] }, "Actions": [{ "Type": "FINDING_FIELDS_UPDATE", "FindingFieldsUpdate": { "Workflow": { "Status": "SUPPRESSED
" }, "Note": { "Text": "Automatically suppress GuardDuty findings with
", "UpdatedBy": "INFORMATIONAL
severitysechub-automation
" } } }] }
Example CLI command:
aws securityhub create-automation-rule \ --no-is-terminal \ --rule-name
"
\ --rule-orderSuppress informational findings
"\ --rule-status
1
"
\ --descriptionENABLED
""
\ --criteria '{ "ProductName": [{ "Value":Suppress GuardDuty findings with
"INFORMATIONAL
severity"
, "Comparison":GuardDuty
""
}], "ComplianceStatus": [{ "Value":EQUALS
""
, "Comparison":FAILED
""
}], "RecordState": [{ "Value":EQUALS
""
, "Comparison":ACTIVE
""
}], "WorkflowStatus": [{ "Value":EQUALS
""
, "Comparison":NEW
""
}], "SeverityLabel": [{ "Value":EQUALS
""
, "Comparison":INFORMATIONAL
""
}] }' \ --actions '[{ "Type":EQUALS
""FINDING_FIELDS_UPDATE"
, "FindingFieldsUpdate": { "Workflow": { "Status":"
}, "Note": { "Text":SUPPRESSED
""
, "UpdatedBy":Automatically suppress GuardDuty findings with
"INFORMATIONAL
severity"
} } }]' \ --regionsechub-automation
"
us-east-1