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

Creating a WAF profile

Written by
Yandex Cloud
Updated at September 24, 2025
Management console
Terraform
API
  1. In the management console, select the folder where you want to create a WAF profile.
  2. In the list of services, select Smart Web Security.
  3. In the left-hand panel, select WAF profiles and click Create WAF profile.
  4. Name the profile.
  5. Optionally, provide a description.
  6. Optionally, add labels to your profile.
  7. Enable one or multiple rule sets. OWASP Core Rule Set, Yandex Ruleset, Yandex ML Ruleset. Click the row with the rule set to view its rules.
  8. For OWASP Core Rule Set, select a rule set version.
  9. If multiple rule sets are enabled:
    • Select the profile trigger conditions:
      • Verdict returned in at least one selected rule set: At least one rule set has recognized the request as a threat.
      • Verdict returned in all rule sets: All added rule sets have recognized the request as a threat.
    • Arrange rule sets in the order of priority in which the rules will analyze the request. Top positions indicate higher priority.
  10. Click Create.

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 relevant documentation on the Terraform website or its mirror.

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

  1. In the configuration file, describe the resources you want to create:

    # In the basic set, rules of this paranoia level and below will be enabled
    locals {
      waf_paranoia_level = <paranoia_level>
    }
    
    # OWASP Core Rule Set data source
    data "yandex_sws_waf_rule_set_descriptor" "owasp4" {
      name    = "OWASP Core Ruleset"
      version = "4.0.0"
    }
    
    # WAF profile
    resource "yandex_sws_waf_profile" "default" {
      name = "<WAF_profile_name>"
    
      # Basic rule set
      core_rule_set {
        inbound_anomaly_score = <anomaly_threshold>
        paranoia_level        = local.waf_paranoia_level
        rule_set {
          name    = "OWASP Core Ruleset"
          version = "4.0.0"
        }
      }
    
      # Enabling rules from the basic set if their paranoia level is not higher than the value defined in the waf_paranoia_level variable
      dynamic "rule" {
        for_each = [
          for rule in data.yandex_sws_waf_rule_set_descriptor.owasp4.rules : rule
          if rule.paranoia_level <= local.waf_paranoia_level
        ]
        content {
          rule_id     = rule.value.id
          is_enabled  = true
          is_blocking = false
        }
      }
    

    Where:

    • waf_paranoia_level: Paranoia level which classifies rules based on how aggressive they are. The higher the paranoia level, the better the protection, but also the greater the risk of WAF false positives.
    • data "yandex_sws_waf_rule_set_descriptor": Terraform data source for the basic rule set. From the data source, you can get a list of rules and their IDs.
    • resource "yandex_sws_waf_profile": Terraform resource to manage the WAF profile.
      • name: WAF profile name.

      • core_rule_set: Basic rule set:

        • inbound_anomaly_score: Anomaly threshold which is the total anomaly score of triggered rules that results in blocking the request. The possible values range from 2 to 10,000. The higher the value, the more likely it is that the request matching the rules is in fact an attack.

        • paranoia_level: Paranoia level which classifies rules based on how aggressive they are. The higher the paranoia level, the better the protection, but also the greater the risk of false positives. The possible values range from 1 to 4.

          Note

          The paranoia level itself has no effect on enabling or disabling rules but serves as a recommendation for users to enable all rules with paranoia_level less than or equal to the specified value.

        • rule_set: Rule set. Specify its name and version.

      • dynamic "rule": Dynamically enabling the rules in the basic set if their paranoia level is not higher than the value defined in the waf_paranoia_level variable. You can manually edit the settings of dynamically configured rules. For example, you can turn a rule into a blocking one or enable a rule with the paranoia level higher than the one defined in the variable.

        • rule_id: Rule ID.
        • is_enabled: Flag to enable or disable a rule.
        • is_blocking: Blocking rule flag.

    For more information about yandex_sws_waf_profile properties, see this Terraform provider article.

  2. Create the resources:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

Terraform will create all the required resources. You can check the new resources in the management console.

After creating a WAF profile, you can configure a set of basic rules and exclusion rules.

Use the create REST API method for the WafProfile resource or the WafProfile/Create RPC API call.

See alsoSee also

  • Configuring WAF rule sets
  • Adding a rule to a security profile
  • Editing basic settings of a security profile
  • Setting up basic protection in Smart Web Security
  • Deleting a WAF profile

Was the article helpful?

Previous
Disconnecting a profile from a resource
Next
Editing basic profile settings
© 2025 Direct Cursus Technology L.L.C.