Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Smart Web Security
  • Getting started
    • All guides
      • Creating a profile
      • Editing basic profile settings
      • Getting information about a profile
      • Deleting a profile
      • Adding a rule
      • Editing a rule
      • Deleting a rule
    • Managing address lists
    • Viewing operations with profiles
    • Configuring monitoring
    • Setting up alerts
    • Configuring logging
    • Overview
    • Security profiles
    • WAF
    • ARL (request limit)
    • Rules
    • Conditions
    • Lists
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Managing ARL profiles
  3. Adding a rule

Adding a rule to an ARL profile

Written by
Yandex Cloud
Updated at April 23, 2025

You can only add ARL rules to an ARL profile. Basic rules, as well as Smart Protection and WAF rules, are added to a security profile.

Management console
Terraform
API
  1. In the management console, select the folder the ARL profile resides in.

  2. From the list of services, select Smart Web Security.

  3. In the left-hand panel, select ARL profiles.

  4. Select the profile to add a rule to.

  5. Click Add rule and in the window that opens:

    1. Enter a name for the rule.

    2. Optionally, enter a description.

    3. Set the rule priority. This priority applies only to ARL rules and is independent of the rule priority in the security profile.

    4. (Optional) Enable Enable dry run (logging only) to test the rule and estimate the load on the web service. Requests will not be blocked in this mode.

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

    6. Under Request counting, select:

      • 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 path HTTP cookie: String in the cookie header
          HTTP method: Request method HTTP header: String in the HTTP header
          IP address: IP address the request came from Query params: String in the request parameters
          Region: IP address region of the requests
          Host: Domain receiving the request

          To 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 to 60 minutes) for the limit. All requests above the limit will be blocked.

    7. Click Save rule.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

To add a rule to your ARL profile:

  1. Open the Terraform configuration file and edit the part with the yandex_sws_advanced_rate_limiter_profile resource description: add the advanced_rate_limiter_rule section containing the security rule.

    # ARL profile
    
    resource "yandex_sws_advanced_rate_limiter_profile" "arl-profile" {
      name        = "<profile_name>"
      description = "<profile_description>"
    
      # Rule 1
    
      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 {
            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"]
              }
            }
          }
        }
      }
    }
    

    Where:

    • name: ARL profile name.
    • description: ARL profile description. This is an optional parameter.
    • labels: ARL profile labels. This is an optional parameter.
    • advanced_rate_limiter_rule: Rule section.
      • name: Rule name.
      • priority: Rule priority, a unique number from 1 to 999999. Rules with smaller numerical values apply first.
      • description: Rule description. This is an optional parameter.
      • dry_run: Dry run flag. Set to true to test the rule and estimate the load on your web service. Requests will not be blocked in this mode. However, rule triggering will be logged. This is an optional parameter.
      • static_quota: Request count mode where each request is counted individually without grouping. You can only specify one section, either static_quota or dynamic_quota.
        • action: Action if the limit is exceeded. The only available value is DENY.
        • limit: Maximum number of allowed queries per period.
        • period: Time period in seconds in which the limit applies.
        • condition: Condition for applying the rule. This is an optional parameter. For more information, see the advanced_rate_limiter_rule.static_quota.condition description in this provider article.
      • dynamic_quota: Request count mode where groups of requests sharing one or more properties are counted. You can only specify one section, either static_quota or dynamic_quota.
        • action: Action if the limit is exceeded. The only available value is DENY.
        • limit: Maximum number of allowed queries per period.
        • period: Time period in seconds in which the limit applies.
        • condition: Condition for applying the rule. This is an optional parameter. For more information, see the advanced_rate_limiter_rule.dynamic_quota.condition description in this provider article.
        • characteristic: Description of properties to group requests by. You can specify one section, either simple_characteristic or key_characteristic.
          • case_insensitive: Case insensitive, if true, or sensitive, if false.
          • key_characteristic: Section of parameters requiring a key (string) to group requests by.
            • type: Grouping type. The possible values are COOKIE_KEY, HEADER_KEY, and QUERY_KEY.
            • value: Key value (string) to group requests by.
          • simple_characteristic: Section with parameters for autogrouping, i.e., requests are automatically grouped by the specified parameter.
            • type: Grouping type. The possible values are REQUEST_PATH, HTTP_METHOD, IP, GEO, and HOST.

    For more information about the yandex_sws_advanced_rate_limiter_profile resource parameters, see the provider documentation.

  2. Apply the changes:

    1. In the terminal, change to the folder where you edited the configuration file.

    2. 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.
      
    3. 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.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

    You can check the resources’ updates in the management console.

Get information about the ARL profile and then update the ARL profile using the update REST API method for the AdvancedRateLimiterProfile resource or the AdvancedRateLimiterProfile/Update gRPC API call.

See alsoSee also

  • Editing a rule in a security profile
  • Deleting a rule from a security profile

Was the article helpful?

Previous
Deleting a profile
Next
Editing a rule
© 2025 Direct Cursus Technology L.L.C.