

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Amazon EventBridge 中管理事件匯流排許可
<a name="eb-event-bus-permissions-manage"></a>

使用下列程序修改現有事件匯流排的許可。如需如何使用 CloudFormation 建立事件匯流排政策的資訊，請參閱 [AWS::Events::EventBusPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html)。

**管理現有事件匯流排的權限**

1. 訪問 [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/) 開啟 Amazon EventBridge 主控台。

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 AWS 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>"
          }
        }
    }]
  }
```