Updated on 2023-04-26 GMT+08:00

Custom Policies

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

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: Edit policies from scratch or based on an existing policy in JSON format.

For details, see Creating a Custom Policy. The following section contains examples of common EG custom policies.

Example Custom Policies

  • Example 1: Allow user to delete event sources
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "
                         eg:sources:delete
                         eg:sources:list
                     "
                ]
            }
        ]
    }
  • Example 2: Deny event source deletion

    A policy with only "Deny" permissions must be used in conjunction with other policies to take effect. If the permissions assigned to a user include 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 EG FullAccess policy to a user but also forbid the user from deleting event sources. Create a custom policy to disallow event source deletion and assign both policies to the group the user belongs to. Then the user can perform all operations on EG except deleting event sources. The following is an example of a deny policy:

    {
            "Version": "1.1",
            "Statement": [
                    {
                            "Effect": "Deny",
                            "Action": [
                                    "eg:sources:delete"
                            ]
                    }
            ]
    }