Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Policy

Updated on 2024-10-15 GMT+08:00

A policy is a logical expression used to evaluate resource compliance.

A policy cannot work on its own. Instead, you need to attach a policy to a rule.

A policy can be a JSON expression. Table 1 lists policy (JSON expression) parameters.

Table 1 Policy parameters (JSON)

Parameter

Description

Remarks

id

Policy ID

N/A

name

Policy name

A policy name can contain up to 64 characters.

display_name

Display name of a policy

A policy display name can contain up to 64 characters.

description

Policy description

Policy description can contain up to 512 characters.

parameters

Policy parameters

The following attributes are used to describe each policy parameter:

  • name
  • description
  • type
  • default_value
  • allowed_values
  • minimum
  • maximum
  • min_items
  • max_items
  • min_length
  • max_length
  • pattern

The parameter names, such as name and description contained in the compliance policy remain unchanged.

  • name indicates the name of a rule.
  • description: supplementary information of parameters
  • type: the type of parameters, which can be String, Array, Boolean, Integer, or Float.
  • default_value: Specifies the default value of parameters. If the parameter is specified, you can use it when you add a rule.
  • allowed_values: Specifies the list of values allowed by parameters. If the parameter is specified, you can only select values from the list.
  • Minimum value, which is valid when type is set to Integer or Float.
  • Maximum value, which is valid when type is set to Integer or Float.
  • Minimum items, which is valid when type is set to Array.
  • Maximum items, which is valid when type is set to Array.
  • Minimum string length, which is valid when type is set to String or Array.
  • Maximum string length, which is valid when type is set to String or Array.
  • Regular expression requirements, which is valid when type is set to String or Array.

keywords

Policy keywords

Generally, the name abbreviation of the related product is used as a keyword.

policy_type

Policy type

The options are as follows:

  • builtin
  • custom
  • builtin: specifies the type of policies that are provided and maintained by Config. For details, see Built-In Policies.
  • custom: specifies the type of policies that are customized by users.

policy_rule_type

Policy syntax

Domain Specific Language (DSL): provided by Config to write policy expressions.

trigger_type

Trigger type.

The options are as follows:

  • resource
  • period
  • resource: runs when a specified resource is changed.
  • period: specifies the frequency at which a rule is triggered.

default_resource_types

Resource type

Most policies only apply to a limited scope of resources. You are advised to use a rule to only evaluate resource types in default_resource_types.

The following is an example policy used to check whether specified images are used for ECSs.

{
  "id": "5fa265c0aa1e6afc05a0ff07",
  "name": "allowed-images-by-id",
"description": "An ECS image is non-compliant if its ID is not within the specific image ID range.",
  "parameters": {
    "listOfAllowedImages": {
      "name": "null",
      "description": "The list of allowed image IDs",
      "type": "Array"
      "allowed_values": null,
      "default_value": null,
    }
  },
  "keywords": [
    "ecs",
    "ims"
  ],
  "policy_type": "builtin",
  "policy_rule_type": "dsl",
  "trigger_type": "resource",
  "policy_rule": {
    "allOf": [
      {
         "value": "${resource().provider}",
         "comparator": "equals",
         "pattern": "ecs"
      },
      {
       "value": "${resource().type}",
       "comparator": "equals",
       "pattern": "cloudservers"
      },
      {
       "value": "${resource().properties.metadata.meteringImageId}",
        "comparator": "notIn",
        "pattern": "${parameters('listOfAllowedImages')}"
      }
    ]
   },
}

For more examples, see Example Custom Rules.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback