Updating a rule in an ARL profile
You can only update ARL rules in an ARL profile. Basic rules, as well as Smart Protection and WAF rules, are updated in a security profile.
- In the management console
, select the folder the ARL profile resides in. - From the list of services, select Smart Web Security.
- In the left-hand panel, select
ARL profiles. - Select the profile to update a rule in.
- In the rule row, click
and select Edit. In the window that opens:-
Edit the basic rule settings:
- Name.
- Description.
- Rule priority. The smaller the value, the higher is the rule priority.
- Dry run (logging without request blocking) settings.
-
Under Conditions for traffic, specify which traffic the rule will be used to analyze:
-
All traffic
: The rule will be used to analyze the whole traffic. -
On condition
: The rule will be used to analyze the traffic specified in the Conditions field:IP
: IP address, IP address range, IP address region, or address list.HTTP header
: HTTP header string.Request URI
: Request path.Host
: Domain receiving the request.HTTP method
: Request method.Cookie
: Cookie header string.
You can set multiple conditions. To do this, select all the condition types you need in the Conditions field.
You can also set multiple conditions of the same type. To do this, click
and or or in the section with the condition you need.To delete a condition, click
.
-
-
Change the request counting method and grouping criteria:
-
No grouping
: Counting each request individually. -
Grouping by property
: Counting request groups sharing one or more common properties.-
Select a grouping property:
Automatic grouping Grouping by key Request path
: Request pathHTTP cookie
: String in the cookie headerHTTP method
: Request methodHTTP header
: String in the HTTP headerIP address
: IP address the request came fromQuery params
: String in the request parametersRegion
: IP address region of the requestsHost
: Domain receiving the requestTo group by key, specify the key value.
-
(Optional) Enable
Case-sensitive
to put properties with the same values in different cases into different groups.
-
Specify a request limit or request limit per group as well as a time interval (from
1 second
to60 minutes
) for the limit. All requests above the limit will be blocked. -
-
Click Save rule.
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the documentation on the Terraform
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
To update a rule in an ARL profile:
-
Open the Terraform configuration file and update the
advanced_rate_limiter_rule
security rule section in theyandex_sws_advanced_rate_limiter_profile
ARL profile description.# ARL profile resource "yandex_sws_advanced_rate_limiter_profile" "arl-profile" { name = "<profile_name>" description = "<profile_description>" # Rule 1 advanced_rate_limiter_rule { name = "<new_rule_name>" priority = <new_rule_priority> description = "<new_rule_description>" dry_run = true static_quota { action = "DENY" limit = <new_rule_limit> period = <new_rule_period> condition { request_uri { path { exact_match = "/api" } } } } } # Rule 2 advanced_rate_limiter_rule { name = "<rule_name>" priority = <rule_priority> description = "<rule_description>" dry_run = true static_quota { action = "DENY" limit = <rule_limit> period = <rule_period> condition { source_ip { geo_ip_match { locations = ["ru", "kz"] } } } } } }
For more information about the
yandex_sws_advanced_rate_limiter_profile
resource parameters, see the provider documentation . -
Apply the changes:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
You can check the resources’ updates in the management console
. -
Use the update REST API method for the AdvancedRateLimiterProfile resource or the AdvancedRateLimiterProfile/Update gRPC API call.