Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • 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
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 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 the new condition format in the API, CLI, and Terraform
    • Overview
    • Security profiles
    • WAF
    • ARL (request limit)
    • Rules
    • Conditions
    • Lists
    • Managing bot traffic
    • Protecting domains
    • Response templates
    • 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 17, 2026
View in Markdown
Management console
Terraform
API
  1. In the management console, select the folder where you want to create a WAF profile.
  2. Navigate to 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. Select a rule set version.
  9. If multiple rule sets are enabled:

    • Select the profile trigger conditions:

      • Verdict DENY returned in at least one selected rule set: At least one rule set has recognized the request as a threat.
      • Verdict DENY returned in each selected rule set: 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 guides on the Terraform website or its mirror.

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

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

  1. In the configuration file, define the parameters of the resources you want to create:

    locals {
      # In the basic set, rules of this paranoia level and below will be enabled
      waf_paranoia_level = <paranoia_level>
    }
    
    # Data source: rule set
    data "yandex_sws_waf_rule_set_descriptor" "source" {
      name    = "<set_name>"
      version = "<set_version>"
    }
    
    # WAF profile
    resource "yandex_sws_waf_profile" "default" {
      name = "<WAF_profile_name>"
    
      # Rule set
      rule_set {
        action     = "<action>"
        is_enabled = <true_or_false>
        priority   = <priority>
    
        # Basic rule set
        core_rule_set {
          inbound_anomaly_score = <anomaly_threshold>
          paranoia_level        = local.waf_paranoia_level
          rule_set {
            name    = "<set_name>"
            version = "<set_version>"
            id      = "<set_ID>"
            type    = "<set_type>"
          }
        }
      }
    
      # 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.source.rules : rule
          if rule.paranoia_level <= local.waf_paranoia_level
        ]
        content {
          rule_id     = rule.value.id
          is_enabled  = true
          is_blocking = false
        }
      }
    }
    
    Example of a WAF profile description in the Terraform configuration
    # Declaring local variables
    locals {
      # In the basic set, rules of this paranoia level and below will be enabled
      waf_paranoia_level = 1
    
      # OWASP Core Ruleset identification
      ruleset_name    = "OWASP Core Ruleset"
      ruleset_version = "4.0.0"
      ruleset_id      = "OWASP_CRS_4_0_0"
      ruleset_type    = "CORE"
    }
    
    # OWASP Core Rule Set data source
    data "yandex_sws_waf_rule_set_descriptor" "source" {
      name    = local.ruleset_name
      version = local.ruleset_version
    }
    
    # WAF profile
    resource "yandex_sws_waf_profile" "default" {
      name = "waf-profile-owasp"
    
      # Rule set
      rule_set {
        action     = "DENY"
        is_enabled = true
        priority   = 1
    
        # Basic rule set
        core_rule_set {
          inbound_anomaly_score = 2
          paranoia_level        = local.waf_paranoia_level
          rule_set {
            name    = local.ruleset_name
            version = local.ruleset_version
            id      = local.ruleset_id
            type    = local.ruleset_type
          }
        }
      }
    
      # 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.source.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: Level of paranoia. It classifies rules based on their level of aggressiveness. The higher the paranoia level, the better the protection, but also the greater the risk of WAF false positives. The possible values range from 1 to 4.

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

      • rule_set: Rule section.

        • action: Action to perform when the rule set is triggered:

          • RULE_SET_ACTION_UNSPECIFIED: Allow the query.
          • DENY: Block the query.
          • CAPTCHA: Send the query to SmartCaptcha.
        • is_enabled: Flag to enable or disable a set of rules.

        • priority: Rule set priority. The possible values range from 1 to 1,000,000.

        • 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: Level of paranoia. It classifies rules based on their level of aggressiveness. 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 does not affect whether rules are enabled or disabled. It only recommends the user to enable all rules with the paranoia_level less than or equal to the specified one.

          • rule_set: Rule set. In this section, specify the ID, name, version, and type of the rule set.

            Possible values
            name version id type
            OWASP Core Ruleset 4.8.0 OWASP_CRS_4_8_0 CORE
            OWASP Core Ruleset 4.0.0 OWASP_CRS_4_0_0 CORE
            Yandex Ruleset 0.1.1 YARS_0_1_1 YA
            Yandex Ruleset 0.1.0 YARS_0_1_0 YA
            Yandex ML Ruleset latest YAMS_LATEST ML
      • dynamic "rule": Dynamic activation of the basic set rules if their paranoia level is not higher than the waf_paranoia_level variable. For dynamically configured rules, you can update settings manually. 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. If true, the rule becomes the blocking one.

    For more on the properties of the yandex_sws_waf_profile resource, see this provider guide.

  2. Create the resources:

    1. In the terminal, navigate to the configuration file directory.

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

      terraform validate
      

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

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

      terraform plan
      

      You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

    4. Apply the configuration changes:

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

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

After creating a WAF profile, you can modify the set of basic rules and customize the set of exception rules.

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

Useful linksUseful links

  • Configuring WAF rule sets
  • Adding a rule to a security profile
  • Editing basic WAF profile settings
  • 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
© 2026 Direct Cursus Technology L.L.C.