

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Amazon 中管理活动总线权限 EventBridge
<a name="eb-event-bus-permissions-manage"></a>

使用以下过程修改现有事件总线的权限。有关 Amazon CloudFormation 如何使用创建事件总线策略的信息，请参阅[AWS::Events::EventBus策略](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html)。

**管理现有事件总线的权限**

1. 打开 Amazon EventBridge 控制台，网址为[https://console.aws.amazon.com/events/](https://console.amazonaws.cn/events/)。

1. 在左侧导航窗格中，选择**事件总线**。

1. 在**名称**中，选择要管理权限的事件总线的名称。

   如果有某个资源策略附加到此事件总线，则会显示该策略。

1. 选择**管理权限**，然后执行以下操作之一：
   + 输入策略，其中包含要为事件总线授予的权限。您可以粘贴其他来源的策略，也可以为此策略输入 JSON。
   + 要使用策略模板，请选择**加载模板**。根据您的环境修改策略，并添加其他操作，授权策略中的主体使用。

1. 选择**更新**。

该模板提供了示例策略语句，您可以根据自己的账户和环境对其进行自定义。模板不是有效策略。您可以根据您的使用场景修改模板，也可以复制其中一个示例策略并对其进行自定义。

该模板加载的策略包括一个示例，展示如何向账户授予使用 `PutEvents` 操作的权限、如何向组织授予权限以及如何向该账户授予权限，以管理账户中的规则。您可以为特定账户自定义模板，然后从模板中删除其他部分。本部分的后续部分会包含更多策略示例。

如果您尝试更新总线的权限，但策略中包含错误，则会显示一条错误消息，指明策略中的具体问题。

```
  ### Choose which sections to include in the policy to match your use case. ###
  ### Be sure to remove all lines that start with ###, including the ### at the end of the line. ###

  ### The policy must include the following: ###

  {
    "Version": "2012-10-17",		 	 	 
    "Statement": [

      ### To grant permissions for an account to use the PutEvents action, include the following, otherwise delete this section: ###

      {

        "Sid": "AllowAccountToPutEvents",
        "Effect": "Allow",
        "Principal": {
          "AWS": "<ACCOUNT_ID>"
        },
        "Action": "events:PutEvents",
        "Resource": "arn:aws:events:us-east-1:123456789012:event-bus/default"
      },

      ### Include the following section to grant permissions to all members of your Amazon Organizations to use the PutEvents action ###

      {
        "Sid": "AllowAllAccountsFromOrganizationToPutEvents",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "events:PutEvents",
        "Resource": "arn:aws:events:us-east-1:123456789012:event-bus/default",
        "Condition": {
          "StringEquals": {
            "aws:PrincipalOrgID": "o-yourOrgID"
          }
        }
      },

      ### Include the following section to grant permissions to the account to manage the rules created in the account ###

      {
        "Sid": "AllowAccountToManageRulesTheyCreated",
        "Effect": "Allow",
        "Principal": {
          "AWS": "<ACCOUNT_ID>"
        },
        "Action": [
          "events:PutRule",
          "events:PutTargets",
          "events:DeleteRule",
          "events:RemoveTargets",
          "events:DisableRule",
          "events:EnableRule",
          "events:TagResource",
          "events:UntagResource",
          "events:DescribeRule",
          "events:ListTargetsByRule",
          "events:ListTagsForResource"],
        "Resource": "arn:aws:events:us-east-1:123456789012:rule/default",
        "Condition": {
          "StringEqualsIfExists": {
            "events:creatorAccount": "<ACCOUNT_ID>"
          }
        }
    }]
  }
```