Help Center/ TaurusDB/ User Guide/ Permissions Management/ Creating a TaurusDB Custom Policy
Updated on 2024-12-30 GMT+08:00

Creating a TaurusDB Custom Policy

Custom policies can be created to supplement the system-defined policies of TaurusDB.

You can create a custom policy 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: Write policies from scratch or based on an existing policy.

For details, see Creating a Custom Policy. This section provides examples of common TaurusDB custom policies.

Example Custom Policies

  • Example 1: Allowing users to create TaurusDB instances
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "gaussdb:instance:create"
                ]
            }
        ]
    }
  • Example 2: Denying TaurusDB instance deletion

    A policy with only "Deny" permissions must be used in conjunction with other policies. If the permissions assigned to a user contain both "Allow" and "Deny", the "Deny" permissions take precedence over the "Allow" permissions.

    The following method can be used if you need to assign permissions of the GaussDB FullAccess policy to a user but you want to prevent the user from deleting TaurusDB instances. Create a custom policy for denying TaurusDB instance deletion, and attach both policies to the group the user belongs to. Then, the user can perform all operations on TaurusDB instances except deleting TaurusDB instances. The following is an example of a deny policy:

    {
        "Version": "1.1",
        "Statement": [
            {
              "Effect": "Deny"
              "Action": [
                    "gaussdb:instance:delete"
                ],
              }
        ]
    }
  • Example 3: Defining permissions for multiple services in a policy

    A custom policy can contain the actions of one or multiple services that are of the same type (global or project-level). The following is an example policy containing actions of multiple services:

    {  
            "Version": "1.1",  
            "Statement": [  
                    {  
                            "Action": [  
                                    "gaussdb:instance:create",  
                                    "gaussdb:instance:modify",  
                                    "gaussdb:instance:delete",  
                     "vpc:publicIps:list",  
                     "vpc:publicIps:update"  
                            ],  
                            "Effect": "Allow"  
                    }  
            ]  
    }