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

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 two ways:

  • Visual editor: Select cloud services, actions, resources, and request conditions without the need to know policy syntax.
  • JSON: Edit JSON policies from scratch or based on an existing policy.

The following describes how to create a custom policy that allows users to modify VPC endpoint service policies in the visual editor and JSON view.

This section provides examples of common custom VPC Endpoint policies.

Creating a Custom Policy in the Visual Editor

  1. Log in to the management console.
  2. Choose Management & Deployment > Identity and Access Management.

    The IAM console is displayed.

  3. In the left navigation pane, choose Policies.
  4. Click Create Custom Policy.

    The Create Custom Policy page is displayed.

  5. Enter a policy name.
  6. Select a scope in which the policy will take effect based on the type of services to be set in this policy.
    • Global: Select this option if the services to which the policy is related must be deployed in the Global region. When creating custom policies for globally deployed services, specify the scope as Global services. Custom policies of this scope must be attached to user groups for global services.
    • Project-level: Select this option if the services to which the policy is related must be deployed in specific regions. When creating custom policies for regionally deployed services, specify the scope as Project-level services. Custom policies of this scope must be attached to user groups for specific projects except the global service project.

    Select Project-level services here.

    NOTE:

    A custom policy can contain actions of multiple services that are globally accessible or accessible through region-specific projects. To define permissions required to access both global and project-level services, create two custom policies and specify the scope as Global services and Project-level services.

  7. Select Visual editor for Policy View.
  8. In the Policy Content area, configure a custom policy.
    1. Select Allow or Deny.
    2. Select Cloud service.
      NOTE:

      Only one cloud service can be selected for each permission block. To configure permissions for cloud services, click Add Permissions or refer to Creating a Custom Policy in the JSON View.

    3. Select actions.
    4. (Optional) Select a resource type. For example, if you select Specific, you can click Specify resource path to specify the resource to be authorized.
    5. (Optional) Add request conditions by specifying condition keys, operators, and values.
      Table 1 Criterion

      Parameter

      Description

      Condition Key

      Specifies a key in the Condition element of a statement. There are global and service-level condition keys.

      • Global-level condition key: The prefix is g:, which is applicable to all operations, as shown in Table 2.
      • Project-level condition key: The prefix is the abbreviation of a service, for example, vpcep:. This key applies only to operations of the corresponding service.

      Operator

      An operator must be used together with a condition key to form a complete condition statement.

      Value

      A value is used together with a condition key and an operator that requires a keyword, to form a complete condition statement.

      Table 2 Global request condition

      Global Condition Key

      Type

      Description

      g:CurrentTime

      Time

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

      g:DomainName

      String

      Specifies the account name.

      g:MFAPresent

      Boolean

      Specifies whether to use multi-factor authentication (MFA) to obtain a token.

      g:MFAAge

      Value

      Specifies the validity period of the token obtained through MFA. This condition must be used together with g:MFAPresent.

      g:ProjectName

      String

      Specifies the project name.

      g:ServiceName

      String

      Specifies the service name.

      g:UserId

      String

      Specifies the IAM user ID.

      g:UserName

      String

      Specifies the IAM username.

  9. (Optional) Switch to the JSON view and modify the policy content in JSON format.
    NOTE:

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

  10. (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.
  11. (Optional) Describe the policy.
  12. Click OK.
  13. Assign the policy to a user group. Users in the group can inherit the permissions of the policy by referring to Creating a User and Granting VPC Endpoint Permissions.

Creating a Custom Policy in the JSON View

  1. Log in to the management console.
  2. Choose Management & Deployment > Identity and Access Management.

    The IAM console is displayed.

  3. In the left navigation pane, choose Policies.
  4. Click Create Custom Policy.

    The Create Custom Policy page is displayed.

  5. Enter a policy name.
  6. Select a scope in which the policy will take effect based on the type of services to be set in this policy.
    • Global: Select this option if the services to which the policy is related must be deployed in the Global region. When creating custom policies for globally deployed services, specify the scope as Global services. Custom policies of this scope must be attached to user groups for global services.
    • Project-level: Select this option if the services to which the policy is related must be deployed in specific regions. When creating custom policies for regionally deployed services, specify the scope as Project-level services. Custom policies of this scope must be attached to user groups for specific projects except the global service project.

    Select Project-level services here.

    NOTE:

    A custom policy can contain actions of multiple services that are globally accessible or accessible through region-specific projects. To define permissions required to access both global and project-level services, create two custom policies and specify the scope as Global services and Project-level services.

  7. Select JSON for Policy View.
  8. (Optional) Click Select Existing Policy, and select a policy to use it as template, such as VPCEndpoint FullAccess.
  9. Click Yes.
  10. Modify the statements in the template.
    • Effect: Set it to Allow or Deny.
    • Action: Enter the actions listed in the VPC Endpoint API actions table, for example, vpcep:epservices:update.
    NOTE:

    The version of each custom policy is fixed at 1.1.

  11. (Optional) Describe the policy.
  12. Click OK.

    If the policy list is displayed, the policy was created successfully. If a message indicating incorrect policy content is displayed, modify the policy.

  13. Assign the policy to a user group.

    Users in the group can inherit the permissions of the policy by referring to Creating a User and Granting VPC Endpoint 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