- What's New
- Service Overview
- Getting Started
-
User Guide
- Resource List
- Resource Recorder
-
Resource Compliance
- Overview
- Rules
- Organization Rules
- Viewing Noncompliant Resources
- Compliance Rule Concepts
-
Built-In Policies
- Predefined Policy List
-
General Policies
- Resource Names Meet Regular Expression Requirements
- Resources Have All the Specified Tags Attached
- Resources Have One of the Specified Tags Attached
- Tag Prefixes and Suffixes Check
- Resources Have at Least One Tags Attached
- Resource Tag Check
- Resources Are in Specified Enterprise Projects
- Resources Are in Specified Regions
- Resource Type Check by Specifying Allowed Resource Types
- Resource Type Check by Specifying Unallowed Resource Types
- API Gateway
- CodeArts Deploy
- MapReduce Service
- NAT Gateway
- VPC Endpoint
- Web Application Firewall
- Elastic Load Balance
- Elastic IP
- Auto Scaling
- Scalable File Service Turbo (SFS Turbo)
-
Elastic Cloud Server
- Flavor Check
- Image Check
- Image Check by Tag
- Security Group Check by ID
- VPC Check by ID
- ECSs Have Key Pairs Attached
- ECSs Cannot Be Accessed Through Public Networks
- An ECS Does Not Have Multiple EIPs Attached
- Idle ECS Check
- ECSs Have IAM Agencies Attached
- Image Check by Name
- ECSs Have Backup Vaults Attached
- Backup Time Check
- ECSs Have HSS Agents Attached
-
Distributed Cache Service
- DCS Memcached Instances Support SSL
- DCS Memcached Instances Are in a Specified VPC
- DCS Memcached Instances Do Not Have EIPs Attached
- Access Mode Check
- DCS Redis Instances Support SSL
- Cross-AZ Deployment Check
- DCS Redis Instances Are in the Specified VPC
- DCS Redis Instances Do Not Have EIPs Attached
- Access Mode Check
- FunctionGraph
- Content Delivery Network (CDN)
- Config
- Data Warehouse Service
- Data Replication Service
- Data Encryption Workshop
-
Identity and Access Management
- Key Rotation Check
- IAM Policies Do Not Allow Blocked Actions on KMS Keys
- Each User Group Has at Least One User
- Password Strength Check
- Unintended Policy Check
- Admin Permissions Check
- Custom Policies Do Not Allow All Actions for a Service
- The Root User Does Not Have Available Access Keys
- Access Mode Check
- Access Key Check
- IAM Users Are in Specified User Groups
- Last Login Check
- Multi-Factor Authentication Check
- A User Does Not have Multiple Active Access Keys
- MFA Has Been Enabled for Console Login
- The Root User Has MFA Enabled
- All IAM Policies Are in Use
- All IAM Roles Are in Use
- Login Protection Check
- IAM Agencies Contain Specified Policies
- The Admin User Group Only Contains the Root User
- IAM Users Do Not Have Directly Assigned Policies or Permissions
- Document Database Service
- Simple Message Notification
- Virtual Private Cloud
- Virtual Private Network
- Cloud Eye
- Cloud Container Engine
-
Cloud Trace Service
- CTS Trackers Have Traces Encrypted
- CTS Trackers Have Trace Transfer to LTS Enabled
- CTS Trackers Have Been Created for the Specified OBS Bucket
- Trace File Verification Is Enabled
- At Least One Tracker Is Enabled
- There Are CTS Trackers In the Specified Regions
- CTS Trackers Comply with Security Best Practices
-
Relational Database Service
- Error Log Collection Is Enabled for RDS Instances
- Error Log Collection Is Enabled for RDS Instances
- RDS Instances Support Slow Query Logs
- Single-AZ Cluster Check
- RDS Instances Do Not Have EIPs Attached
- RDS Instances Use KMS Encryption
- RDS Instances Are in the Specified VPC
- Both Error Logs and Slow Query Logs Are Collected for RDS Instances
- Flavor Check
- RDS Instances Have SSL Enabled
- RDS Instance Port Check
- Version Check for RDS Instance Engines
- RDS Instances Have Audit Log Enabled
- GaussDB
- TaurusDB
- GeminiDB
-
Cloud Search Service
- CSS Clusters Have the Security Mode Enabled
- The Snapshot Function Is Enabled for CSS Clusters
- Disk Encryption Is Enabled for CSS Clusters
- HTTPS Access Is Enabled for CSS Clusters
- CSS Clusters Are in Specified VPCs
- Single-AZ CSS Cluster Check
- A CSS Cluster Has at Least Two Instances
- CSS Clusters Are Not Publicly Accessible
- CSS Clusters Support the Security Mode
- CSS Clusters Have Access Control Enabled
- CSS Clusters Have Kibana Public Access Control Enabled
- CSS Clusters Have Slow Query Log Enabled
- Elastic Volume Service
- Cloud Certificate Manager
- Distributed Message Service for Kafka
- Distributed Message Service for RabbitMQ
- Distributed Message Service for RocketMQ
- Organizations
- Cloud Firewall
- Cloud Backup and Recovery
- Object Storage Service
- Image Management Service
- Bare Metal Server
- Graph Engine Service
- Resource Compliance Event Monitoring
-
Conformance Packages
- Overview
- Conformance Packages
- Organization Conformance Packages
- Custom Conformance Packages
-
Conformance Package Templates
- Overview
- Conformance Package for Classified Protection of Cybersecurity Level 3 (2.0)
- Conformance Package for the Financial Industry
- Conformance Package for Network Security
- Conformance Package for Identity and Access Management
- Conformance Package for Cloud Eye
- Conformance Package for Compute Services
- Conformance Package for ECS
- Conformance Package for ELB
- Conformance Package for Management and Regulatory Services
- Conformance Package for RDS
- Conformance Package for AS
- Conformance Package for CTS
- Conformance Package for AI and Machine Learning
- Conformance Package for Autopilot
- Conformance Package for Enabling Public Access
- Conformance Package for Logging and Monitoring
- Conformance Package for Architecture Reliability
- Conformance Package for Hong Kong Monetary Authority of China Requirements
- Conformance Package for ENISA Requirements
- Conformance Package for SWIFT CSP
- Conformance Package for Germany Cloud Computing Compliance Criteria Catalogue
- Conformance Package for PCI DSS
- Conformance Package for Healthcare Industry
- Best Practices of Network and Data Security
- Conformance Package for Landing Zone
- Architecture Security Best Practices
- Best Practices for Network and Content Delivery Service Operations
- Best Practices for Idle Asset Management
- Multi-AZ Deployment Best Practices
- Resource Stability Best Practices
- Best Practices for API Gateway
- Best Practices for Cloud Container Engine
- Best Practices for Content Delivery Network
- Best Practices for FunctionGraph
- Best Practices for GaussDB
- Best Practices for GeminiDB
- Best Practices for MapReduce Service
- Best Practices for NIST Requirements
- Best Practices for Singapore Financial Industry
- Best Practices for Secure Identity and Compliance Operations
- Conformance Package for Huawei Cloud Security Configuration Guide (Level 1)
- Conformance Package for Huawei Cloud Security Configuration Guide (Level 2)
- Best Practices for Static Data Encryption
- Best Practices for Data Transmission Encryption
- Best Practices for Cloud Backup and Recovery
- Best Practices for Cloud Search Service
- Best Practices for Distributed Cache Service
- Best Practices for Distributed Message Service
- Best Practices for Data Warehouse Service
- Best Practices for TaurusDB
- Best Practices for Object Storage Service
- Best Practices for Virtual Private Cloud
- Best Practices for Web Application Firewall
- Advanced Queries
- Resource Aggregation
- Cloud Trace Service
- Appendix
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs
-
Resource List
- Querying Resources of a Specific Type
- Querying Cloud Services
- Querying a Resource
- Querying All Resources Recorded by the Resource Recorder
- Querying How Many Resources Are Recorded by the Resource Recorder
- Querying Resource Tags Recorded by the Resource Recorder
- Querying Resource Overview Recorded by the Resource Recorder
- Querying a Specific Resource Recorded by the Resource Recorder
- Querying All Resources Under an Account
- Querying a Resource Under an Account
- Querying Resource Tags
- Querying the Number of Resources
- Querying Resource Overview
- Resource Recorder
- Resource Relationships
- Resource Change Records
-
Compliance
- Querying Built-in Policies
- Querying Specific Built-in Policy
- Adding a Rule
- Querying Rules
- Modifying a Rule
- Querying a Specific Rule
- Deleting a Rule
- Enabling a Rule
- Disabling a Rule
- Running a Resource Compliance Evaluation
- Querying the Evaluation Status of a Rule
- Querying the Compliance of a Resource
- Querying the Compliance of a Rule
- Querying Compliance of an Account
- Updating the Compliance Result
- Creating an Organization Rule
- Querying Organization Rules
- Querying a Specific Organization Rule
- Deleting an Organization Rule
- Updating an Organization Rule
- Querying the Deployment Status of an Organization Rule
- Querying Statuses of Organization Rule Deployment to Member Accounts
- Setting up or Updating Remediation Configurations
- Querying Remediation Configurations
- Deleting Remediation Configurations
- Batch Creating Remediation Exceptions
- Batch Deleting Remediation Exceptions
- Querying Remediation Exceptions
- Starting Remediation
- Querying Remediation Results
- Collect Remediation Results
- Region Management
- Advanced Queries
-
Resource Aggregators
- Creating a Resource Aggregator
- Querying Resource Aggregators
- Querying a Specific Resource Aggregator
- Querying Account Aggregation Statuses of a Specific Aggregator
- Updating a Resource Aggregator
- Deleting a Resource Aggregator
- Authorizing an Aggregator Account
- Querying Authorized Aggregator Accounts
- Deleting Authorization for an Aggregator Account
- Querying All Pending Aggregation Requests
- Deleting Pending Authorization Requests
- Querying the Number of Resources of an Aggregator Account
- Querying Resources of an Aggregator Account
- Querying Details About a Specific Resource in a Source Account
- Performing an Advanced Query on a Specific Aggregator
- Querying the Compliance Summary of One or More Source Accounts in an Aggregator
- Querying Aggregated Rules
- Querying Compliance Results of Aggregated Resources
- Querying Details About a Specified Aggregated Rule
-
Conformance Packages
- Querying Conformance Packages
- Creating a Conformance Package
- Querying a Specific Conformance Package
- Deleting a Conformance Package
- Updating Conformance Packages
- Querying Compliance of all Conformance Packages
- Querying Compliance of all Rules in a Conformance Package
- Querying Compliance of All Resources Evaluated with a Conformance Package
- Querying Scores of All Conformance Packages
- Querying Built-in Conformance Package Templates
- Querying the Template of a Built-in Conformance Package
- Creating organization conformance packages.
- Querying Organization Conformance Packages
- Querying an Organization Conformance Package
- Delete organization conformance packages.
- Updating Organization Conformance Packages
- Querying the Deployment Status of the Organization Conformance Package
- Querying the Statuses of Organization Conformance Package Deployment to Members.
- Resource Tags
-
Resource List
- Permissions Policies and Supported Actions
- Appendixes
- SDK Reference
-
Best Practices
- Creating Rules
- Querying Resource Details, Relationships, and Change Records
- Creating Alarm Rules for Noncompliant Resources with Cloud Eye
- Using Advanced Queries
- Querying Resources That Do Not Have Specific Tags
- Ensuring Resource Compliance by Tag, Region, and Organization
- Automating Resource Management
- FAQs
- General Reference
Copied.
Creating a Custom Query
Scenarios
You can use the query statements preset by Config or customize query statements based on resource configuration attributes to query specific cloud resource configurations.
This section includes the following content:
Creating a Custom Query
- Log in to the management console.
- Click
in the upper left corner. Under Management & Governance, click Config.
- In the navigation pane on the left, choose Advanced Queries.
- Choose the Custom Queries tab and click Create Query in the upper right corner.
Figure 1 Creating a query
- In the Query Editor, enter the query statements.
On the left of the page, the Schema information is displayed. Schema information shows detailed resource attributes that are specified by the properties parameter in the statement. For details about query statements, see Configuration Examples of Advanced Queries.
- Click Save Query and enter the query name and description.
A query name can contain only digits, letters, underscores (_), and hyphens (-). It cannot exceed 64 characters.
- Click OK.
Figure 2 Save Query
NOTE:
There is a limit to how many custom queries you can create. If you exceed this limit, you will receive a notification: "The maximum number of custom queries has been reached." Although the query cannot be saved, you can still run the query and export the results.
- Click Run and then view the query results. Up to 4,000 query results can be displayed and exported.
- Click Export above the list and select the format of the file to be exported (CSV or JSON).
- Click Execution Records to view details about when the query was executed and the query statements.
You can perform the following operations:
- Run: running the query
- Copy: copying the query statements
- Save: saving the query as a new query
NOTE:
After you close the browser window or log out, the execution records of advanced queries will be cleared.
Figure 3 Execution records
Using a Predefined Query
You can modify the name, description, and statement of a default query or a custom query and save it as a new query. The following procedure uses a default query as an example.
- Choose Advanced Queries > Default Queries.
All default queries are displayed in a list.
- Click Query in the Operation column for the target query.
Alternatively, click the query name and then click Query in the lower right corner of the query overview page.
Figure 4 Default queries - In the Query Editor, modify the query.
For details, see Configuration Examples of Advanced Queries.
- Click Save As and enter the query name and description.
- In the dialog box that is displayed, click OK.
After a new query is created, the new query becomes a custom query and will be displayed in the custom query list.
On the Execution Records page, you can also save an existing query as a new query. For details, see Step 10.
Figure 5 Saving a default query as a new query
Configuration Examples of Advanced Queries
Advanced queries use ResourceQL, a subset of SQL SELECT syntax, to query resource configuration data. You do not need to call specific APIs for the query or use multiple APIs to download full data and manually analyze the data. ResourceQL can only query data from the resources table.
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the resource ID. |
name |
String |
Specifies the resource name. |
provider |
String |
Specifies the cloud service name. |
type |
String |
Specifies the resource type. |
region_id |
String |
Specifies the region ID. |
project_id |
String |
Specifies the project ID. |
ep_id |
String |
Specifies the enterprise project ID. |
checksum |
String |
Specifies the resource checksum. |
created |
Date |
Specifies the time when the resource was created. |
updated |
Date |
Specifies the time when the resource was updated. |
provisioning_state |
String |
Specifies the result of an operation on resources. |
tag |
Array(Map<String,String>) |
Specifies the resource tag. |
properties |
Map<String,Object> |
Specifies the resource attribute details. |
Example quires are as follows:
- Example 1: List ECSs in the Stopped state.
SELECT name FROM resources WHERE provider = 'ecs' AND type = 'cloudservers' AND properties.status = 'SHUTOFF'
- Example 2: List EVS disks with certain specifications.
SELECT * FROM resources WHERE provider = 'evs' AND type = 'volumes' AND properties.size = 100
- Example 3: List OBS buckets queried by fuzzy search.
SELECT * FROM resources WHERE provider = 'obs' AND type = 'buckets' AND name LIKE '%figure%'
- Example 4: List ECSs and the EVS disks attached to each ECS.
SELECT ECS_EVS.id AS ecs_id, EVS.id AS evs_id FROM ( SELECT id, evs_id FROM ( SELECT id, transform(properties.ExtVolumesAttached, x -> x.id) AS evs_list FROM resources WHERE provider = 'ecs' AND type = 'cloudservers' ) ECS CROSS JOIN UNNEST(evs_list) AS t (evs_id) ) ECS_EVS, ( SELECT id FROM resources WHERE provider = 'evs' AND type = 'volumes' ) EVS WHERE ECS_EVS.evs_id = EVS.id
- Example 5: List ECSs and the EIPs bound to each ECS.
SELECT ECS.id AS ECS_id, publicIpAddress AS ip_address FROM ( SELECT id, transform(properties.addresses, x -> x.addr) AS ip_list FROM resources WHERE provider = 'ecs' AND type = 'cloudservers' ) ECS, ( SELECT name, properties.publicIpAddress FROM resources WHERE provider = 'vpc' AND type = 'publicips' AND properties.type = 'EIP' AND properties.status = 'ACTIVE' ) EIP WHERE CONTAINS (ECS.ip_list, EIP.name)
- Example 6: List resources with a quantity greater than 100 in each region.
WITH counts AS ( SELECT region_id, provider, type, count(*) AS number FROM resources GROUP BY region_id, provider, type ) SELECT * FROM counts WHERE number > 100
For details about query statements, see ResourceQL Syntax.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot