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
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
Situation Awareness
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

Creating a Custom Policy

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

You can create custom policies to supplement system-defined policies and implement more refined access control.

You can create custom policies in either of the following ways:

  • Visual editor: Select cloud services, actions, resources, and request conditions. This does not require knowledge of policy syntax.
  • JSON: Create a JSON policy or edit an existing one.

Creating a Custom Policy in the Visual Editor

  1. Log in to the IAM console.
  2. On the IAM console, choose Permissions > Policies/Roles from the navigation pane, and click Create Custom Policy in the upper right corner.
  3. Enter a policy name.
  4. Select Visual editor for Policy View.
  5. Set the policy content.

    1. Select Allow or Deny.
    2. Select a cloud service.
      NOTE:
      • Only one cloud service can be selected for each permission block. To configure permissions for multiple cloud services, click Add Permissions, or switch to the JSON view (see Creating a Custom Policy in JSON View).
      • A custom policy can contain permissions for either global or project-level services. To define permissions required to access both global and project-level services, enclose the permissions in two separate custom policies for refined authorization.
    3. Select actions.
    4. (Optional) Select all resources, or select specific resources by specifying their paths.
      Table 1 Resource type

      Parameter

      Description

      Specific

      Permissions for specific resources. For example, to define permissions for buckets whose names start with TestBucket, specify the bucket resource path as OBS:*:*:bucket:TestBucket*.

      NOTE:
      • Specifying bucket resources

      Format: "OBS:*:*:bucket:Bucket name".

      For bucket resources, IAM automatically generates the prefix of the resource path: obs:*:*:bucket:. For the path of a specific bucket, add the bucket name to the end. You can also use a wildcard character (*) to indicate any bucket. For example, obs:*:*:bucket:* indicates any OBS bucket.

      • Specifying object resources

      Format: "OBS:*:*:object:Bucket name/object name".

      For object resources, IAM automatically generates the prefix of the resource path: obs:*:*:object:. For the path of a specific object, add the bucket name/object name to the end of the resource path. You can also use a wildcard character (*) to indicate any object in a bucket. For example, obs:*:*:object:my-bucket/my-object/* indicates any object in the my-object directory of the my-bucket bucket.

      All

      Permissions for all resources.

    5. (Optional) Add request conditions by specifying condition keys, operators, and values.
      Table 2 Condition parameters

      Name

      Description

      Condition Key

      A key in the Condition element of a statement. There are global and service-specific condition keys. Global condition keys (starting with g:) are available for operations of all services, whereas service-specific condition keys (starting with a service abbreviation name such as obs:) are available only for operations of the corresponding service. For details, see the user guide of the corresponding cloud service.

      Operator

      Used together with a condition key and condition value to form a complete condition statement.

      Value

      Used together with a condition key and an operator that requires a keyword, to form a complete condition statement.

      Table 3 Global condition keys

      Global Condition Key

      Type

      Description

      g:CurrentTime

      Time

      Time when an authentication request is received. The time is in ISO 8601 format, for example, 2012-11-11T23:59:59Z.

      g:DomainName

      String

      Account name.

      g:MFAPresent

      Boolean

      Whether to obtain a token through MFA authentication.

      g:MFAAge

      Number

      Validity period of a token obtained through MFA authentication. This condition must be used together with g:MFAPresent.

      g:ProjectName

      String

      Project name.

      g:ServiceName

      String

      Service name.

      g:UserId

      String

      IAM user ID.

      g:UserName

      String

      IAM user name.

  6. (Optional) Switch to the JSON view and modify the policy content in JSON format.

    NOTE:

    If the modified policy content is incorrect, check and modify the content again, or click Reset to cancel the modifications.

  7. (Optional) To add another permission block for the policy, click Add Permissions. Alternatively, click the plus (+) icon on the right of an existing permission block to clone its permissions.
  8. (Optional) Enter a brief description for the policy.
  9. Click OK.
  10. Attach the policy to a user group. Users in the group then inherit the permissions defined in this policy.

    NOTE:

    You can attach custom policies to a user group in the same way as you attach system-defined policies. For details, see Creating a User Group and Assigning Permissions.

Creating a Custom Policy in JSON View

  1. Log in to the IAM console.
  2. On the IAM console, choose Permissions > Policies/Roles from the navigation pane, and click Create Custom Policy in the upper right corner.
  3. Enter a policy name.
  4. Select JSON for Policy View.
  5. (Optional) Click Select Existing Policy/Role and select a policy/role to use it as a template, for example, select EVS Admin.

    NOTE:

    If you select multiple policies, all of them must have the same scope, that is, either Global services or Project-level services. To define permissions required to access both global and project-level services, enclose the permissions in two separate custom policies for refined authorization.

  6. Click OK.
  7. Modify the statement in the template.

    • Effect: Set it to Allow or Deny.
    • Action: Enter the actions listed in the API actions table of the EVS service, for example, evs:volumes:create.
      NOTE:

      The version of each custom policy is fixed at 1.1.

  8. (Optional) Enter a brief description for the policy.
  9. Click OK. If the policy list is displayed, the policy is created successfully. If a message indicating incorrect policy content is displayed, modify the policy.
  10. Attach the policy to a user group. Users in the group then inherit the permissions defined in this policy.

    NOTE:

    You can attach custom policies to a user group in the same way as you attach system-defined policies. For details, see Creating a User Group and Assigning Permissions.

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