Help Center/ TaurusDB/ User Guide/ Permissions Management/ Creating a TaurusDB Custom Policy
Updated on 2025-07-11 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.

The following lists 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"  
                    }  
            ]  
    }
  • Example 4: Allowing users to manage specified instances and some functions of instances

    Assume that your account has multiple instances and you are a database administrator. If you want to allow users to manage specified instances and some functions of instances, you can create the following permission policy.

    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "gaussdb:instance:restart",
                    "gaussdb:instance:modify"
                ],
                "Resource": [
                   "GAUSSDB:*:*:instance:test*"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "gaussdb:param:list",
                    "gaussdb:tag:list",
                    "gaussdb:backup:list",
                    "gaussdb:instance:create",
                    "gaussdb:instance:list"
                ]
            }
        ]
    }
    
    • Users granted these permissions can view all instances, but can manage only authorized instances. In addition, the database administrator can still use APIs to directly manage these instances. Users granted the permissions can only reboot and modify all instances under this account.
    • test* is an example of an instance name for fuzzy match and is mandatory in the permission policy. Otherwise, the authorized users cannot view any instance on the console.