

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

# 開發人員工具主控台功能的安全性
<a name="security"></a>

的雲端安全性 AWS 是最高優先順序。身為 AWS 客戶，您可以受益於資料中心和網路架構，該架構專為滿足最安全敏感組織的需求而建置。

安全性是 AWS 與您之間的共同責任。[‬共同責任模型‭](https://aws.amazon.com/compliance/shared-responsibility-model/)‬ 將此描述為雲端*‬的‭*‬安全和雲端*‬內*‬的安全：
+ **雲端的安全性** – AWS 負責保護在 AWS Cloud 中執行 AWS 服務的基礎設施。 AWS 也為您提供可安全使用的服務。在 [AWS 合規計畫](https://aws.amazon.com/compliance/programs/)中，第三方稽核員會定期測試並驗證我們的安全功效。若要了解適用於 AWS CodeStar Notifications 和 AWS CodeConnections 的合規計劃，請參閱[AWS 合規計劃範圍內的服務](https://aws.amazon.com/compliance/services-in-scope/)。
+ **雲端的安全性** – 您的責任取決於您使用 AWS 的服務。您也必須對其他因素負責，包括資料的機密性、您公司的要求和適用法律和法規。

本文件可協助您了解如何在使用 AWS CodeStar Notifications 和 AWS CodeConnections 時套用共同責任模型。下列主題說明如何設定 AWS CodeStar Notifications 和 AWS CodeConnections 以符合您的安全與合規目標。您也會了解如何使用其他 AWS 服務來協助您監控和保護 AWS CodeStar Notifications 和 AWS CodeConnections 資源。

如需深入了解開發人員工具主控台中服務的安全性，請參閱下列內容：
+ [CodeBuild 安全性](https://docs.aws.amazon.com/codebuild/latest/userguide/security.html)
+ [CodeCommit 安全性](https://docs.aws.amazon.com/codecommit/latest/userguide/security.html)
+ [CodeDeploy 安全性](https://docs.aws.amazon.com/codedeploy/latest/userguide/security.html)
+ [CodePipeline 安全性](https://docs.aws.amazon.com/codepipeline/latest/userguide/security.html)

## 了解通知內容和安全性
<a name="security-notifications"></a>

通知會將資源相關資訊提供給訂閱您設定之通知規則目標的使用者。這些資訊可能包含開發人員工具資源的詳細資訊，包括儲存庫內容、建置狀態、部署狀態和管道執行。

例如，您可以將 CodeCommit 中儲存庫的通知規則設定為包含遞交或提取請求的註解。若是如此，為了回應該規則而傳送的通知可能包含該註解中參考的一行或多行程式碼。同樣地，也可將 CodeBuild 中建置專案的通知規則設定為包含建置狀態和階段的成功或失敗資訊。為了回應該規則而傳送的通知將包含該資訊。

您可將 CodePipeline 中管道的通知規則設定為包含手動核准相關資訊，而系統為了回應該規則而傳送的通知可能包含提供該核准的人員名稱。您可將 CodeDeploy 中應用程式的通知規則設定為指出部署成功，而系統為了回應該規則而傳送的通知可能包含部署目標的相關資訊。

通知可包含專案專屬資訊，例如建置狀態、具有註解的程式碼行、部署狀態，以及管道核准。為了協助確保專案的安全性，請務必定期檢閱通知規則的目標，以及指定為目標之 Amazon SNS 主題的訂閱者清單。此外，為了回應事件而傳送的通知內容可能會隨著其他功能新增到基礎服務而變更。此變更可能會在不通知現有通知規則的情況下發生。請考慮定期檢閱通知訊息的內容，以協助確保您了解傳送的內容以及傳送的對象。

如需通知規則可用的事件類型的詳細資訊，請參閱[通知概念](concepts.md)。

您可以選擇將通知中包含的詳細資訊限制為僅包含在事件中的資訊。這就是所謂的**基本**詳細資訊類型。這些事件包含的資訊與傳送到 Amazon EventBridge 和 Amazon CloudWatch Events 的資訊完全相同。

開發人員工具主控台服務 (例如 CodeCommit) 可能選擇在通知訊息中新增其部分或全部事件類型的相關資訊，而不僅止於事件中的資訊。您可以隨時新增此補充資訊，以增強目前的事件類型或補充未來的事件類型。您可以選擇 **Full (完整)** 詳細資訊類型，以決定將事件相關的補充資訊 (若有的話) 納入通知中。如需詳細資訊，請參閱[詳細資訊類型](concepts.md#detail-type)。

# 資料保護 in AWS CodeStar Notifications 和 AWS CodeConnections
<a name="data-protection"></a>

 AWS [共同責任模型](https://aws.amazon.com/compliance/shared-responsibility-model/)適用於 AWS CodeStar Notifications 和 AWS CodeConnections 中的資料保護。如此模型所述， AWS 負責保護執行所有 的 全域基礎設施 AWS 雲端。您負責維護在此基礎設施上託管內容的控制權。您也同時負責所使用 AWS 服務 的安全組態和管理任務。如需資料隱私權的詳細資訊，請參閱[資料隱私權常見問答集](https://aws.amazon.com/compliance/data-privacy-faq/)。如需有關歐洲資料保護的相關資訊，請參閱 *AWS 安全性部落格*上的 [AWS 共同的責任模型和 GDPR](https://aws.amazon.com/blogs/security/the-aws-shared-responsibility-model-and-gdpr/) 部落格文章。

基於資料保護目的，建議您保護 AWS 帳戶 登入資料，並使用 AWS IAM Identity Center 或 AWS Identity and Access Management (IAM) 設定個別使用者。如此一來，每個使用者都只會獲得授與完成其任務所必須的許可。我們也建議您採用下列方式保護資料：
+ 每個帳戶均要使用多重要素驗證 (MFA)。
+ 使用 SSL/TLS 與 AWS 資源通訊。我們需要 TLS 1.2 並建議使用 TLS 1.3。
+ 使用 設定 API 和使用者活動記錄 AWS CloudTrail。如需有關使用 CloudTrail 追蹤擷取 AWS 活動的資訊，請參閱*AWS CloudTrail 《 使用者指南*》中的[使用 CloudTrail 追蹤](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-trails.html)。
+ 使用 AWS 加密解決方案，以及其中的所有預設安全控制 AWS 服務。
+ 使用進階的受管安全服務 (例如 Amazon Macie)，協助探索和保護儲存在 Amazon S3 的敏感資料。
+ 如果您在 AWS 透過命令列界面或 API 存取 時需要 FIPS 140-3 驗證的密碼編譯模組，請使用 FIPS 端點。如需有關 FIPS 和 FIPS 端點的更多相關資訊，請參閱[聯邦資訊處理標準 (FIPS) 140-3](https://aws.amazon.com/compliance/fips/)。

我們強烈建議您絕對不要將客戶的電子郵件地址等機密或敏感資訊，放在標籤或自由格式的文字欄位中，例如**名稱**欄位。這包括當您使用 AWS CodeStar Notifications 和 AWS CodeConnections 或使用主控台、API AWS CLI或 AWS SDKs的其他 AWS 服務 時。您在標籤或自由格式文字欄位中輸入的任何資料都可能用於計費或診斷日誌。如果您提供外部伺服器的 URL，我們強烈建議請勿在驗證您對該伺服器請求的 URL 中包含憑證資訊。

# AWS CodeStar Notifications 和 AWS CodeConnections 的身分和存取管理
<a name="security-iam"></a>

AWS Identity and Access Management (IAM) 是一種 AWS 服務 ，可協助管理員安全地控制對 AWS 資源的存取。IAM 管理員可控制誰可以*進行身分驗證* （登入） 和*授權* （具有許可），以使用 AWS CodeStar Notifications 和 AWS CodeConnections 資源。IAM 是您可以免費使用 AWS 服務 的 。

**注意**  
在新服務字首下建立的資源動作`codeconnections`可供使用。在新服務字首下建立資源將在資源 ARN `codeconnections`中使用 。`codestar-connections` 服務字首的動作和資源仍然可用。在 IAM 政策中指定資源時，服務字首需要符合資源的字首。

**Topics**
+ [目標對象](#security_iam_audience)
+ [使用身分驗證](#security_iam_authentication)
+ [使用政策管理存取權](#security_iam_access-manage)
+ [開發人員工具主控台中的功能如何與 IAM 搭配使用](security_iam_service-with-iam.md)
+ [AWS CodeConnections 許可參考](#permissions-reference-connections)
+ [身分型政策範例](security_iam_id-based-policy-examples.md)
+ [使用標籤控制對 AWS CodeConnections 資源的存取](connections-tag-based-access-control.md)
+ [在主控台中使用通知和連線](#security_iam_id-based-policy-examples-console)
+ [允許使用者檢視他們自己的許可](#security_iam_id-based-policy-examples-view-own-permissions)
+ [疑難排解 AWS CodeStar Notifications 和 AWS CodeConnections 身分和存取權](security_iam_troubleshoot.md)
+ [使用 AWS CodeStar Notifications 的服務連結角色](using-service-linked-roles.md)
+ [使用 的服務連結角色 AWS CodeConnections](service-linked-role-connections.md)
+ [AWS 的 受管政策 AWS CodeConnections](security-iam-awsmanpol.md)

## 目標對象
<a name="security_iam_audience"></a>

使用方式 AWS Identity and Access Management (IAM) 會根據您的角色而有所不同：
+ **服務使用者** — 若無法存取某些功能，請向管理員申請所需許可 (請參閱 [疑難排解 AWS CodeStar Notifications 和 AWS CodeConnections 身分和存取權](security_iam_troubleshoot.md))
+ **服務管理員** — 負責設定使用者存取權並提交相關許可請求 (請參閱 [開發人員工具主控台中的功能如何與 IAM 搭配使用](security_iam_service-with-iam.md))
+ **IAM 管理員** — 撰寫政策以管理存取控制 (請參閱 [身分型政策範例](security_iam_id-based-policy-examples.md))

## 使用身分驗證
<a name="security_iam_authentication"></a>

身分驗證是您 AWS 使用身分憑證登入 的方式。您必須以 AWS 帳戶根使用者、IAM 使用者或擔任 IAM 角色身分進行身分驗證。

您可以使用身分來源的登入資料，例如 AWS IAM Identity Center (IAM Identity Center)、單一登入身分驗證或 Google/Facebook 登入資料，以聯合身分的形式登入。如需有關登入的詳細資訊，請參閱《AWS 登入 使用者指南》**中的[如何登入您的 AWS 帳戶](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html)。

對於程式設計存取， AWS 提供 SDK 和 CLI 以密碼編譯方式簽署請求。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [API 請求的AWS 第 4 版簽署程序](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)。

### AWS 帳戶根使用者
<a name="security_iam_authentication-rootuser"></a>

 當您建立 時 AWS 帳戶，您會從一個名為 AWS 帳戶 *theroot 使用者的*登入身分開始，該身分可完整存取所有 AWS 服務 和 資源。強烈建議不要使用根使用者來執行日常任務。有關需要根使用者憑證的任務，請參閱《IAM 使用者指南》**中的[需要根使用者憑證的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

### IAM 使用者和群組
<a name="security_iam_authentication-iamuser"></a>

*IAM 使用者*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html)是一種身分具備單人或應用程式的特定許可權。建議以臨時憑證取代具備長期憑證的 IAM 使用者。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[要求人類使用者使用聯合身分提供者來 AWS 使用臨時憑證存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp) 。

[IAM 群組](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html)**會指定 IAM 使用者集合，使管理大量使用者的許可權更加輕鬆。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [IAM 使用者的使用案例](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html)。

### IAM 角色
<a name="security_iam_authentication-iamrole"></a>

*IAM 角色*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)的身分具有特定許可權，其可以提供臨時憑證。您可以透過[從使用者切換到 IAM 角色 （主控台） ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html)或呼叫 AWS CLI 或 AWS API 操作來擔任角色。如需詳細資訊，請參閱《IAM 使用者指南》**中的[擔任角色的方法](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage-assume.html)。

IAM 角色適用於聯合身分使用者存取、臨時 IAM 使用者許可、跨帳戶存取權與跨服務存取，以及在 Amazon EC2 執行的應用程式。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM 中的快帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

## 使用政策管理存取權
<a name="security_iam_access-manage"></a>

您可以透過建立政策並將其連接到身分或資源 AWS 來控制 AWS 中的存取。政策定義與身分或資源相關聯的許可。當委託人提出請求時 AWS ， 會評估這些政策。大多數政策會以 JSON 文件 AWS 形式存放在 中。如需進一步了解 JSON 政策文件，請參閱《*IAM 使用者指南*》中的 [JSON 政策概觀](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json)。

管理員會使用政策，透過定義哪些**主體**可在哪些**條件**下對哪些**資源**執行**動作**，以指定可存取的範圍。

預設情況下，使用者和角色沒有許可。IAM 管理員會建立 IAM 政策並將其新增至角色，供使用者後續擔任。IAM 政策定義動作的許可，無論採用何種方式執行。

### 身分型政策
<a name="security_iam_access-manage-id-based-policies"></a>

身分型政策是附加至身分 (使用者、使用者群組或角色) 的 JSON 許可政策文件。這類政策控制身分可對哪些資源執行哪些動作，以及適用的條件。如需了解如何建立身分型政策，請參閱《*IAM 使用者指南*》中的[透過客戶管理政策定義自訂 IAM 許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html)。

身分型政策可分為*內嵌政策* (直接內嵌於單一身分) 與*受管政策* (可附加至多個身分的獨立政策)。如需了解如何在受管政策及內嵌政策之間做選擇，請參閱《IAM 使用者指南》**中的[在受管政策與內嵌政策之間選擇](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-choosing-managed-or-inline.html)。

# 開發人員工具主控台中的功能如何與 IAM 搭配使用
<a name="security_iam_service-with-iam"></a>

使用 IAM 管理開發人員工具主控台功能的存取權前，應先了解可與此主控台搭配使用的 IAM 功能有哪些。若要全面了解通知和其他 AWS 服務如何與 IAM 搭配使用，請參閱《IAM *使用者指南*》中的與 IAM [AWS 搭配使用的 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**Topics**
+ [開發人員工具主控台中的身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [AWS CodeStar Notifications 和 AWS CodeConnections 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [IAM 角色](#security_iam_service-with-iam-roles)

## 開發人員工具主控台中的身分型政策
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下允許或拒絕動作。 AWS CodeStar Notifications 和 AWS CodeConnections 支援特定動作、資源和條件索引鍵。若要了解您在 JSON 政策中使用的所有元素，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素參考](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html)。

### 動作
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

JSON 政策的 `Action` 元素描述您可以用來允許或拒絕政策中存取的動作。政策會使用動作來授予執行相關聯動作的許可。

開發人員工具主控台中通知的政策動作在動作前面使用下列字首：`codestar-notifications and codeconnections`。例如，若要授予某人檢視其帳戶中的所有通知規則，請在其政策中包含 `codestar-notifications:ListNotificationRules` 動作。政策陳述式必須包含 `Action`或 `NotAction`元素。 AWS CodeStar Notifications 和 AWS CodeConnections 會定義自己的一組動作，描述您可以使用此服務執行的任務。

若要在單一陳述式中指定多個 AWS CodeStar Notifications 動作，請以逗號分隔它們，如下所示。

```
"Action": [
      "codestar-notifications:action1",
      "codestar-notifications:action2"
```

若要在單一陳述式中指定多個 AWS CodeConnections 動作，請以逗號分隔它們，如下所示。

```
"Action": [
      "codeconnections:action1",
      "codeconnections:action2"
```

您也可以使用萬用字元 (\$1) 來指定多個動作。例如，如需指定開頭是 `List` 文字的所有動作，請包含以下動作：

```
"Action": "codestar-notifications:List*"
```



AWS CodeStar Notifications API 動作包括：
+ `CreateNotificationRule`
+ `DeleteNotificationRule`
+ `DeleteTarget`
+ `DescribeNotificationRule`
+ `ListEventTypes`
+ `ListNotificationRules`
+ `ListTagsForResource`
+ `ListTargets`
+ `Subscribe`
+ `TagResource`
+ `Unsubscribe`
+ `UntagResource`
+ `UpdateNotificationRule`

AWS CodeConnections API 動作包括下列項目：
+ `CreateConnection`
+ `DeleteConnection`
+ `GetConnection`
+ `ListConnections`
+ `ListTagsForResource`
+ `TagResource`
+ `UntagResource`

在 中需要下列僅限許可的動作 AWS CodeConnections ，才能完成身分驗證交握：
+ `GetIndividualAccessToken`
+ `GetInstallationUrl`
+ `ListInstallationTargets`
+ `StartOAuthHandshake`
+ `UpdateConnectionInstallation`

在 中需要下列僅限許可的動作 AWS CodeConnections 才能使用連線：
+ `UseConnection`

在 中需要下列僅限許可的動作， AWS CodeConnections 才能將連線傳遞至服務：
+ `PassConnection`

若要查看 AWS CodeStar Notifications 和 AWS CodeConnections 動作的清單，請參閱《*IAM 使用者指南*》中的[AWS CodeStar Notifications 定義的動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_codestarnotifications.html#codestarnotifications-actions-as-permissions)和[AWS CodeConnections 定義的動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_codestarconnections.html#codestarconnections-actions-as-permissions)。

### Resources
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 不支援在政策中指定資源 ARNs。

### 條件索引鍵
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 會定義自己的一組條件金鑰，也支援使用一些全域條件金鑰。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

 

All AWS CodeStar Notifications 動作支援 `codestar-notifications:NotificationsForResource`條件金鑰。如需詳細資訊，請參閱[身分型政策範例](security_iam_id-based-policy-examples.md)。

AWS CodeConnections 定義下列條件索引鍵，可用於 IAM 政策的 `Condition`元素。您可以使用這些索引鍵來縮小套用政策陳述式的條件。如需詳細資訊，請參閱[AWS CodeConnections 許可參考](security-iam.md#permissions-reference-connections)。


| 條件索引鍵 | Description | 
| --- | --- | 
|  `codeconnections:BranchName`  | 根據第三方儲存庫的分支名稱來篩選存取權 | 
|  `codeconnections:FullRepositoryId`  | 透過請求中傳遞的儲存庫來篩選存取。僅適用於用來存取特定儲存庫的 UseConnection 請求 | 
| codeconnections:InstallationId | 根據用來更新連線的第三方 ID (例如 Bitbucket 應用程式安裝 ID) 來篩選存取權。可讓您限制哪些第三方應用程式安裝可以用來建立連線 | 
| codeconnections:OwnerId | 根據第三方供應商的擁有者或帳戶 ID 來篩選存取權 | 
|  `codeconnections:PassedToService`  | 根據委託人允許傳遞連線的服務來篩選存取權 | 
|  `codeconnections:ProviderAction`  | 根據 UseConnection 請求中的供應商動作 (例如 ListRepositories) 來篩選存取權。 | 
| codeconnections:ProviderPermissionsRequired | 根據第三方供應商許可類型來篩選存取權 | 
|  `codeconnections:ProviderType`  | 根據請求中傳遞的第三方供應商類型來篩選存取 | 
| codeconnections:ProviderTypeFilter | 根據用來篩選結果的第三方供應商類型來篩選存取 | 
| codeconnections:RepositoryName | 根據第三方儲存庫名稱來篩選存取權 | 

### 範例
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>



若要檢視 AWS CodeStar Notifications 和 AWS CodeConnections 身分型政策的範例，請參閱 [身分型政策範例](security_iam_id-based-policy-examples.md)。

## AWS CodeStar Notifications 和 AWS CodeConnections 資源型政策
<a name="security_iam_service-with-iam-resource-based-policies"></a>

AWS CodeStar Notifications 和 AWS CodeConnections 不支援以資源為基礎的政策。

## 以標籤為基礎的授權
<a name="security_iam_service-with-iam-tags"></a>

您可以將標籤連接至 AWS CodeStar Notifications 和 AWS CodeConnections 資源，或在請求中傳遞標籤。如需根據標籤控制存取，請使用 `codestar-notifications and codeconnections:ResourceTag/key-name`、`aws:RequestTag/key-name` 或 `aws:TagKeys` 條件索引鍵，在政策的[條件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中，提供標籤資訊。如需標記策略的詳細資訊，請參閱[標記 AWS 資源](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)。如需標記 AWS CodeStar Notifications 和 AWS CodeConnections 資源的詳細資訊，請參閱 [標記連線資源](connections-tag.md)。

若要檢視身分型政策範例，用於根據該資源的標籤來限制資源的存取權，請參閱「[使用標籤控制對 AWS CodeConnections 資源的存取](connections-tag-based-access-control.md)」。

## IAM 角色
<a name="security_iam_service-with-iam-roles"></a>

[IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)是您 AWS 帳戶中具有特定許可的實體。

### 使用暫時登入資料
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

您可以搭配聯合功能使用暫時憑證來登入、擔任 IAM 角色或跨帳戶角色。您可以透過呼叫 [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) 或 [GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html) 等 AWS STS API 操作來取得臨時安全登入資料。

AWS CodeStar Notifications 和 AWS CodeConnections 支援使用臨時登入資料。

### 服務連結角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

[服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)可讓 AWS 服務存取其他服務中的資源，以代表您完成 動作。服務連結角色會顯示在您的 IAM 帳戶中，並由該服務所擁有。IAM 管理員可以檢視，但不能編輯服務連結角色的許可。

AWS CodeStar Notifications 支援服務連結角色。如需建立或管理 AWS CodeStar Notifications 和 AWS CodeConnections 服務連結角色的詳細資訊，請參閱 [使用 AWS CodeStar Notifications 的服務連結角色](using-service-linked-roles.md)。

CodeConnections 不支援服務連結角色。

## AWS CodeConnections 許可參考
<a name="permissions-reference-connections"></a>

下表列出每個 AWS CodeConnections API 操作、您可以授予許可的對應動作，以及用於授予許可的資源 ARN 格式。 AWS CodeConnections APIs 會根據該 API 允許的動作範圍分組為資料表。撰寫可連接至 IAM 身分的許可政策 (身分型政策) 時，請參考這些表格。

當您建立許可政策時，您需要在政策的 `Action` 欄位中指定動作。您需要在政策的 `Resource` 欄位中指定資源值做為 ARN，可包含或不含萬用字元 (\$1)。

若要在連線政策中表達條件，請使用此處所述和 [條件索引鍵](security_iam_service-with-iam.md#security_iam_service-with-iam-id-based-policies-conditionkeys) 中列出的條件索引鍵。您也可以使用 AWS整體條件金鑰。如需 AWS全系列金鑰的完整清單，請參閱《*IAM 使用者指南*》中的[可用金鑰](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#AvailableKeys)。

若要指定動作，請使用 `codeconnections` 字首，後面接著 API 操作名稱 (例如 `codeconnections:ListConnections` 或 `codeconnections:CreateConnection`)。

**使用萬用字元**

若要指定多個動作或資源，請在 ARN 中使用萬用字元 (\$1)。例如， `codeconnections:*` 指定 all AWS CodeConnections 動作，並`codeconnections:Get*`指定以字詞 開頭的所有 AWS CodeConnections 動作`Get`。以下範例授予對所有以 `MyConnection` 為名稱開頭之資源的存取權。

```
arn:aws:codeconnections:us-west-2:account-ID:connection/*
```

您只能針對下表列出的*連線*資源使用萬用字元。您不能對 *region* 或 *account-id* 資源使用萬用字元。如需萬用字元的詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM 識別符](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)。

**Topics**
+ [管理連線的許可](#permissions-reference-connections-managing)
+ [管理主機的許可](#permissions-reference-connections-hosts)
+ [完成連線的許可](#permissions-reference-connections-handshake)
+ [設定主機的許可](#connections-permissions-actions-host-registration)
+ [將連線傳遞至服務](#permissions-reference-connections-passconnection)
+ [使用連線](#permissions-reference-connections-use)
+ [支援的 `ProviderAction` 存取權類型](#permissions-reference-connections-access)
+ [標記連線資源的支援許可](#permissions-reference-connections-tagging)
+ [將連線傳遞到儲存庫連結](#permissions-reference-connections-passrepository)
+ [儲存庫連結的可支援條件金鑰](#permissions-reference-connections-branch)
+ [支援連線共用的許可](#permissions-reference-connections-sharing)

### 管理連線的許可
<a name="permissions-reference-connections-managing"></a>

指定使用 或 AWS CLI SDK 來檢視、建立或刪除連線的角色或使用者，應具有以下限制的許可。

**注意**  
只具有下列許可，並無法在主控台中完成或使用連線。您需要在 [完成連線的許可](#permissions-reference-connections-handshake) 中新增許可。

```
codeconnections:CreateConnection
codeconnections:DeleteConnection
codeconnections:GetConnection
codeconnections:ListConnections
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 管理連線所需的許可**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  CreateConnection  |  `codeconnections:CreateConnection` 使用 CLI 或主控台來建立連線時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  DeleteConnection  |  `codeconnections:DeleteConnection` 使用 CLI 或主控台來刪除連線時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  GetConnection  |  `codeconnections:GetConnection` 需要使用 CLI 或主控台來檢視有關連線的詳細資訊。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  ListConnections  |  `codeconnections:ListConnections` 使用 CLI 或主控台列出帳戶中的所有連線時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 

這些操作支援下列條件金鑰：


| Action | 條件索引鍵 | 
| --- | --- | 
|  `codeconnections:CreateConnection`  |  `codeconnections:ProviderType`  | 
|  codeconnections:DeleteConnection | N/A | 
| codeconnections:GetConnection | N/A | 
| codeconnections:ListConnections | codeconnections:ProviderTypeFilter | 

### 管理主機的許可
<a name="permissions-reference-connections-hosts"></a>

指定使用 或 AWS CLI SDK 來檢視、建立或刪除主機的角色或使用者應具有僅限下列的許可。

**注意**  
只具有下列許可，並無法在主機中完成或使用主機。您需要在 [設定主機的許可](#connections-permissions-actions-host-registration) 中新增許可。

```
codeconnections:CreateHost
codeconnections:DeleteHost
codeconnections:GetHost
codeconnections:ListHosts
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 管理主機所需的許可**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  CreateHost  |  `codeconnections:CreateHost` 使用 CLI 或主控台來建立主機時需要。  |  arn：aws：codeconnections：*region*：*account-id*：host/*host-id*  | 
|  DeleteHost  |  `codeconnections:DeleteHost` 使用 CLI 或主控台來刪除主機時需要。  |  codeconnections：*region*：*account-id*：host/*host-id*  | 
|  GetHost  |  `codeconnections:GetHost` 使用 CLI 或主控台來檢視有關主機的詳細資訊時需要。  |  arn：aws：codeconnections：*region*：*account-id*：host/*host-id*  | 
|  ListHosts  |  `codeconnections:ListHosts` 使用 CLI 或主控台列出帳戶中的所有主機時需要。  |  arn：aws：codeconnections：*region*：*account-id*：host/*host-id*  | 

這些操作支援下列條件金鑰：


| Action | 條件索引鍵 | 
| --- | --- | 
|  `codeconnections:CreateHost`  |  `codeconnections:ProviderType` `codeconnections:VpcId`  | 
|  codeconnections:DeleteHost | N/A | 
| codeconnections:GetHost | N/A | 
| codeconnections:ListHosts | codeconnections:ProviderTypeFilter | 

如需使用 **VpcId** 條件金鑰的範例政策，請參閱 [範例：使用 **VpcId** 內容金鑰限制主機 VPC 許可](security_iam_id-based-policy-examples-connections.md#security_iam_id-based-policy-examples-connections-vpc)。

### 完成連線的許可
<a name="permissions-reference-connections-handshake"></a>

指定要管理在主控台中連線的角色或使用者，應具備完成主控台中的連線及建立安裝所需的許可，包括授權供應商進行交握，以及建立供連線使用的安裝。除了上述許可之外，也請使用下列許可。

執行以瀏覽器為基礎的交握時，主控台會使用下列 IAM 操作。`ListInstallationTargets`、`GetInstallationUrl`、`StartOAuthHandshake`、`UpdateConnectionInstallation` 及 `GetIndividualAccessToken` 是 IAM 政策許可。不是 API 動作。

```
codeconnections:GetIndividualAccessToken
codeconnections:GetInstallationUrl
codeconnections:ListInstallationTargets
codeconnections:StartOAuthHandshake
codeconnections:UpdateConnectionInstallation
```

以此為基礎，需要下列許可才能在主控台中使用、建立、更新或刪除連線。

```
codeconnections:CreateConnection
codeconnections:DeleteConnection
codeconnections:GetConnection
codeconnections:ListConnections
codeconnections:UseConnection
codeconnections:ListInstallationTargets
codeconnections:GetInstallationUrl
codeconnections:StartOAuthHandshake
codeconnections:UpdateConnectionInstallation
codeconnections:GetIndividualAccessToken
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 完成連線所需的許可**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `GetIndividualAccessToken`  |  `codeconnections:GetIndividualAccessToken` 使用主控台完成連線時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `GetInstallationUrl`  |  `codeconnections:GetInstallationUrl` 使用主控台完成連線時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListInstallationTargets`  |  `codeconnections:ListInstallationTargets` 使用主控台完成連線時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `StartOAuthHandshake`  |  `codeconnections:StartOAuthHandshake` 使用主控台完成連線時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `UpdateConnectionInstallation`  |  `codeconnections:UpdateConnectionInstallation` 使用主控台完成連線時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 

這些作業支援下列條件索引鍵。


| Action | 條件索引鍵 | 
| --- | --- | 
| codeconnections:GetIndividualAccessToken | codeconnections:ProviderType | 
|  codeconnections:GetInstallationUrl | codeconnections:ProviderType | 
|  `codeconnections:ListInstallationTargets`  |  N/A  | 
| codeconnections:StartOAuthHandshake | codeconnections:ProviderType | 
| codeconnections:UpdateConnectionInstallation | codeconnections:InstallationId | 

### 設定主機的許可
<a name="connections-permissions-actions-host-registration"></a>

指定管理在主控台中連線的角色或使用者，應具備在主控台中設定主機所需的許可，包括授權供應商進行交握，以及安裝主機應用程式。除了上述主機許可之外，也請使用下列許可。

執行瀏覽器式主機註冊時，主控台會使用下列 IAM 作業。`RegisterAppCode` 和 `StartAppRegistrationHandshake` 是 IAM 政策許可。不是 API 動作。

```
codeconnections:RegisterAppCode
codeconnections:StartAppRegistrationHandshake
```

以此為基礎，需要下列許可才能在主控台中使用、建立、更新或刪除需要主機的連線 (例如已安裝的供應商類型)。

```
codeconnections:CreateConnection
codeconnections:DeleteConnection
codeconnections:GetConnection
codeconnections:ListConnections
codeconnections:UseConnection
codeconnections:ListInstallationTargets
codeconnections:GetInstallationUrl
codeconnections:StartOAuthHandshake
codeconnections:UpdateConnectionInstallation
codeconnections:GetIndividualAccessToken
codeconnections:RegisterAppCode
codeconnections:StartAppRegistrationHandshake
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 完成主機設定所需的許可**  

| 連線動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `RegisterAppCode`  |  `codeconnections:RegisterAppCode` 使用主控台來完成主機設定時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：host/*host-id*  | 
|  `StartAppRegistrationHandshake`  |  `codeconnections:StartAppRegistrationHandshake` 使用主控台來完成主機設定時需要。這只是 IAM 政策許可，不是 API 動作。  |  arn：aws：codeconnections：*region*：*account-id*：host/*host-id*  | 

這些作業支援下列條件索引鍵。

### 將連線傳遞至服務
<a name="permissions-reference-connections-passconnection"></a>

將連線傳遞至服務時 (例如，在管道定義中提供連線 ARN 以建立或更新管線)，使用者必須具有 `codeconnections:PassConnection` 許可。

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 傳遞連線所需的許可**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `PassConnection`  |  `codeconnections:PassConnection` 將連線傳遞到服務時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 

此操作也支援下列條件金鑰：
+ `codeconnections:PassedToService`


**支援的條件金鑰值**  

| 金錀 | 有效動作供應商 | 
| --- | --- | 
|  `codeconnections:PassedToService`  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/dtconsole/latest/userguide/security-iam.html)  | 

### 使用連線
<a name="permissions-reference-connections-use"></a>

當 CodePipeline 之類的服務使用連線時，服務角色必須具有特定連線的 `codeconnections:UseConnection` 許可。

若要在主控台中管理連線，使用者政策必須具有 `codeconnections:UseConnection` 許可。

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 使用連線所需的動作**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `UseConnection`  |  `codeconnections:UseConnection` 使用連線時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 

此操作也支援下列條件金鑰：
+ `codeconnections:BranchName`
+ `codeconnections:FullRepositoryId`
+ `codeconnections:OwnerId`
+ `codeconnections:ProviderAction`
+ `codeconnections:ProviderPermissionsRequired`
+ `codeconnections:RepositoryName`


**支援的條件金鑰值**  

| 金錀 | 有效動作供應商 | 
| --- | --- | 
|  `codeconnections:FullRepositoryId`  |  儲存庫的使用者名稱和儲存庫名稱，例如 `my-owner/my-repository`。僅當使用連線來存取特定儲存庫時才支援。  | 
|  `codeconnections:ProviderPermissionsRequired`  |  read\$1only 或 read\$1write  | 
|  `codeconnections:ProviderAction`  |  `GetBranch`, `ListRepositories`, `ListOwners`, `ListBranches`, `StartUploadArchiveToS3`, `GitPush`, `GitPull`, `GetUploadArchiveToS3Status`, `CreatePullRequestDiffComment`, `GetPullRequest`, `ListBranchCommits`, `ListCommitFiles`, `ListPullRequestComments`, `ListPullRequestCommits`. 如需相關資訊，請參閱下一節。  | 

某些功能的必要條件金鑰可能隨著時間而變更。除非您的存取控制需求需要不同的許可，否則建議您使用 `codeconnections:UseConnection` 來控制對連線的存取。

### 支援的 `ProviderAction` 存取權類型
<a name="permissions-reference-connections-access"></a>

當 AWS 服務使用連線時，會導致對原始碼提供者進行 API 呼叫。例如，服務可能呼叫 `https://api.bitbucket.org/2.0/repositories/username` API 來列出 Bitbucket 連線的儲存庫。

`ProviderAction` 條件金鑰可讓您限制供應商上可呼叫的 API。因為 API 路徑可能是動態產生，而且路徑隨不同供應商而不同，因此 `ProviderAction` 值對應至抽象動作名稱，而不是 API 的 URL。不論連線的供應商類型為何，這可讓您撰寫具有相同效果的政策。

以下是針對每個支援的 `ProviderAction` 值授予的存取類型。以下說明 IAM 政策許可。不是 API 動作。

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 支援的 存取類型 `ProviderAction`**  

| AWS CodeConnections 許可 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `GetBranch`  |  ` codeconnections:GetBranch` 存取分支的相關資訊 (例如該分支的最新遞交) 時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListRepositories`  |  ` codeconnections:ListRepositories` 存取屬於擁有者的公有和私有儲存庫清單 (包括這些儲存庫的詳細資訊) 時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListOwners`  |  `codeconnections:ListOwners` 存取連線可存取的擁有者清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListBranches`  |  ` codeconnections:ListBranches` 存取特定儲存庫上存在的分支清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `StartUploadArchiveToS3`  |  ` codeconnections:StartUploadArchiveToS3` 讀取原始碼並上傳至 Amazon S3 時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `GitPush`  |  ` codeconnections:GitPush` 使用 Git 寫入儲存庫時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `GitPull`  |  ` codeconnections:GitPull` 使用 Git 讀取儲存庫時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
| GetUploadArchiveToS3Status |  ` codeconnections:GetUploadArchiveToS3Status` 存取由 `StartUploadArchiveToS3` 起始的上傳狀態 (包括任何錯誤訊息) 時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
| CreatePullRequestDiffComment |  ` codeconnections:CreatePullRequestDiffComment` 存取提取請求上的註解時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
| GetPullRequest |  ` codeconnections:GetPullRequest` 檢視儲存庫的提取請求時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListBranchCommits`  |  ` codeconnections:ListBranchCommits` 儲存庫分支的遞交清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListCommitFiles`  |  ` codeconnections:ListCommitFiles` 檢視遞交的檔案清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListPullRequestComments`  |  ` codeconnections:ListPullRequestComments` 檢視提取請求的註解清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 
|  `ListPullRequestCommits`  |  ` codeconnections:ListPullRequestCommits` 檢視提取請求的遞交清單時需要。  |  arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*  | 

### 標記連線資源的支援許可
<a name="permissions-reference-connections-tagging"></a>

標記連線資源時，會使用下列 IAM 操作。

```
codeconnections:ListTagsForResource
codeconnections:TagResource
codeconnections:UntagResource
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 標記連線資源所需的動作**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `ListTagsForResource`  |  `codeconnections:ListTagsForResource` 檢視與連線資源關聯之標籤清單時需要。  | arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*,arn：aws：codeconnections：*region*：*account-id*：host/*host-id* | 
|  `TagResource`  |  `codeconnections:TagResource` 標記連線資源時需要。  | arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*,arn：aws：codeconnections：*region*：*account-id*：host/*host-id* | 
|  `UntagResource`  |  `codeconnections:UntagResource` 從連線資源中移除標籤時需要。  | arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id*,arn：aws：codeconnections：*region*：*account-id*：host/*host-id* | 

### 將連線傳遞到儲存庫連結
<a name="permissions-reference-connections-passrepository"></a>

在同步組態中提供儲存庫連結時，使用者必須擁有存放庫連結 ARN/資源的 `codeconnections:PassRepository` 許可。

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 傳遞連線所需的許可**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `PassRepository`  |  `codeconnections:PassRepository` 需要將儲存庫連結傳遞至同步組態。  |  arn：aws：codeconnections：*region*：*account-id*：repository-link/*repository-link-id*  | 

此操作也支援下列條件金鑰：
+ `codeconnections:PassedToService`


**支援的條件金鑰值**  

| 金錀 | 有效動作供應商 | 
| --- | --- | 
|  `codeconnections:PassedToService`  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/dtconsole/latest/userguide/security-iam.html)  | 

### 儲存庫連結的可支援條件金鑰
<a name="permissions-reference-connections-branch"></a>

下列條件金鑰支援儲存庫連結和同步組態資源的操作：
+ `codeconnections:Branch`

  透過請求中傳遞的分支名稱來篩選存取。


**條件金鑰的可支援動作**  

| 金錀 | 有效值 | 
| --- | --- | 
|  `codeconnections:Branch`  | 此條件金鑰支援下列動作：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/dtconsole/latest/userguide/security-iam.html) | 

### 支援連線共用的許可
<a name="permissions-reference-connections-sharing"></a>

共用連線時，會使用下列 IAM 操作。

```
codeconnections:GetResourcePolicy
```

使用捲軸查看資料表的其餘部分。


**AWS CodeConnections 共用連線所需的動作**  

| AWS CodeConnections 動作 | 所需的許可  | Resources | 
| --- | --- | --- | 
|  `GetResourcePolicy`  |  `codeconnections:GetResourcePolicy` 存取資源政策的相關資訊時需要。  | arn：aws：codeconnections：*region*：*account-id*：connection/*connection-id* | 

如需連線共用的詳細資訊，請參閱 [與 共用連線 AWS 帳戶](connections-share.md)。

# 身分型政策範例
<a name="security_iam_id-based-policy-examples"></a>

根據預設，具有 AWS CodeCommit、 AWS CodeBuild AWS CodeDeploy或 其中一個受管政策的 IAM 使用者和角色 AWS CodePipeline ，有權存取符合這些政策意圖的連線、通知和通知規則。例如，已套用其中一個完整存取政策 (**AWSCodeCommitFullAccess**、**AWSCodeBuildAdminAccess**、**AWSCodeDeployFullAccess** 或 **AWSCodePipeline\$1FullAccess**) 的 IAM 使用者或角色，也具有為這些服務資源建立的通知和通知規則之完整存取權。

其他 IAM 使用者和角色沒有建立或修改 AWS CodeStar Notifications 和 AWS CodeConnections 資源的許可。他們也無法使用 AWS 管理主控台 AWS CLI或 AWS API 執行任務。IAM 管理員必須建立 IAM 政策，授予使用者和角色在指定資源上執行 API 作業的所需許可。管理員接著必須將這些政策連接至需要這些許可的 IAM 使用者或群組。

# AWS CodeStar Notifications 的許可和範例
<a name="security_iam_id-based-policy-examples-notifications"></a>

下列政策陳述式和範例可協助您管理 AWS CodeStar Notifications。

## 完整存取受管政策中的通知相關許可
<a name="notifications-fullaccess"></a>

**AWSCodeCommitFullAccess**、**AWSCodeBuildAdminAccess**、**AWSCodeDeployFullAccess** 和 **AWSCodePipeline\$1FullAccess** 受管政策包括下列陳述式，允許完整存取開發人員工具主控台中的通知。已套用上述其中一個受管政策的使用者，也可以建立和管理通知的 Amazon SNS 主題、讓使用者訂閱和取消訂閱主題，以及列出可選擇作為通知規則目標的主題。

**注意**  
在受管理政策中，條件金鑰 `codestar-notifications:NotificationsForResource` 具有服務的資源類型所特有的值。例如，在 CodeCommit 的完整存取政策中，值為 `arn:aws:codecommit:*`。

```
    {
        "Sid": "CodeStarNotificationsReadWriteAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:DeleteNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:ListEventTypes"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsSNSTopicCreateAccess",
        "Effect": "Allow",
        "Action": [
            "sns:CreateTopic",
            "sns:SetTopicAttributes"
        ],
        "Resource": "arn:aws:sns:*:*:codestar-notifications*"
    },
    {
        "Sid": "SNSTopicListAccess",
        "Effect": "Allow",
        "Action": [
            "sns:ListTopics"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsChatbotAccess",
        "Effect": "Allow",
        "Action": [
            "chatbot:DescribeSlackChannelConfigurations",
            "chatbot:ListMicrosoftTeamsChannelConfigurations"
          ],
       "Resource": "*"
    }
```

## 唯讀受管政策中的通知相關許可
<a name="notifications-readonly"></a>

**AWSCodeCommitReadOnlyAccess**、**AWSCodeBuildReadOnlyAccess**、**AWSCodeDeployReadOnlyAccess** 和 **AWSCodePipeline\$1ReadOnlyAccess** 受管政策包括下列陳述式，允許唯讀存取通知。例如，他們可以在開發人員主控台中檢視資源的通知，但無法建立、管理或訂閱通知。

**注意**  
在受管理政策中，條件金鑰 `codestar-notifications:NotificationsForResource` 具有服務的資源類型所特有的值。例如，在 CodeCommit 的完整存取政策中，值為 `arn:aws:codecommit:*`。

```
   {
        "Sid": "CodeStarNotificationsPowerUserAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:DescribeNotificationRule"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListEventTypes",
            "codestar-notifications:ListTargets"
        ],
        "Resource": "*"
    }
```

## 其他受管政策中的通知相關許可
<a name="notifications-otheraccess"></a>

**AWSCodeCommitPowerUser**、**AWSCodeBuildDeveloperAccess** 和 **AWSCodeBuildDeveloperAccess** 受管政策括下列陳述式，允許已套用上述其中一個受管政策的開發人員，建立、編輯和訂閱通知。他們無法刪除通知規則或管理資源的標籤。

**注意**  
在受管理政策中，條件金鑰 `codestar-notifications:NotificationsForResource` 具有服務的資源類型所特有的值。例如，在 CodeCommit 的完整存取政策中，值為 `arn:aws:codecommit:*`。

```
    {
        "Sid": "CodeStarNotificationsReadWriteAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:ListEventTypes"
        ],
        "Resource": "*"
    },
    {
        "Sid": "SNSTopicListAccess",
        "Effect": "Allow",
        "Action": [
            "sns:ListTopics"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsChatbotAccess",
        "Effect": "Allow",
        "Action": [
            "chatbot:DescribeSlackChannelConfigurations",
            "chatbot:ListMicrosoftTeamsChannelConfigurations"
          ],
       "Resource": "*"
    }
```

## 範例：管理 AWS CodeStar Notifications 的管理員層級政策
<a name="security_iam_id-based-policy-examples-notifications-full-access"></a>

在此範例中，您想要授予 AWS 帳戶中的 IAM 使用者 AWS CodeStar Notifications 的完整存取權，讓使用者可以檢閱通知規則的詳細資訊，並列出通知規則、目標和事件類型。您也希望允許使用者新增、更新和刪除通知規則。這是完整存取政策，相當於納入 **AWSCodeBuildAdminAccess**、**AWSCodeCommitFullAccess**、**AWSCodeDeployFullAccess** 和 **AWSCodePipeline\$1FullAccess** 受管政策中的通知許可。如同這些受管政策，您應該只將這類政策陳述式連接到需要完整管理存取 AWS 您帳戶間通知和通知規則的 IAM 使用者、群組或角色。

**注意**  
此政策包含 `CreateNotificationRule`。將此政策套用至其 IAM 使用者或角色的任何使用者，將能夠為 AWS 帳戶中 AWS CodeStar Notifications 支援的任何和所有資源類型建立通知規則，即使該使用者本身無法存取這些資源。例如，具有此政策的使用者可以建立 CodeCommit 儲存庫的通知規則，而沒有存取 CodeCommit 本身的許可。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Sid": "AWSCodeStarNotificationsFullAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DeleteNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe",
            "codestar-notifications:DeleteTarget",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:TagResource",
            "codestar-notifications:UntagResource"
        ],
        "Resource": "*"
     }
   ]
}
```

------

## 範例：使用 AWS CodeStar Notifications 的貢獻者層級政策
<a name="security_iam_id-based-policy-examples-notifications-contributor"></a>

在此範例中，您想要授予 AWS CodeStar Notifications day-to-day使用存取權，例如建立和訂閱通知，但不要授予更具破壞性的動作，例如刪除通知規則或目標。這相當於 **AWSCodeBuildDeveloperAccess**、**AWSCodeDeployDeveloperAccess** 和 **AWSCodeCommitPowerUser** 受管政策中提供的存取權。

**注意**  
此政策包含 `CreateNotificationRule`。將此政策套用至其 IAM 使用者或角色的任何使用者，將能夠為 AWS 帳戶中 AWS CodeStar Notifications 支援的任何和所有資源類型建立通知規則，即使該使用者本身無法存取這些資源。例如，具有此政策的使用者可以建立 CodeCommit 儲存庫的通知規則，而沒有存取 CodeCommit 本身的許可。

```
{
    "Version": "2012-10-17",		 	 	 
    "Sid": "AWSCodeStarNotificationsPowerUserAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource"
        ],
        "Resource": "*"
        }
    ]
}
```

## 範例：使用 AWS CodeStar Notifications 的read-only-level政策
<a name="security_iam_id-based-policy-examples-notifications-read-only"></a>

在此範例中，您希望授予您帳戶中 IAM 使用者對 AWS 帳戶中的通知規則、目標和事件類型的唯讀存取權。此範例會示範如何建立允許檢視這些項目的政策。這相當於納入 **AWSCodeBuildReadOnlyAccess**、**AWSCodeCommitReadOnly** 和 **AWSCodePipeline\$1ReadOnlyAccess** 受管政策中的許可。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "CodeNotificationforReadOnly",
    "Statement": [
        {
            "Sid": "ReadsAccess",
            "Effect": "Allow",
            "Action": [
                "codestar-notifications:DescribeNotificationRule",
                "codestar-notifications:ListNotificationRules",
                "codestar-notifications:ListTargets",
                "codestar-notifications:ListEventTypes"
            ],
            "Resource": "*"
        }
    ]
}
```

------

# 的許可和範例 AWS CodeConnections
<a name="security_iam_id-based-policy-examples-connections"></a>

下列政策陳述式和範例可協助您管理 AWS CodeConnections。

若要了解如何使用這些範例 JSON 政策文件來建立 IAM 身分型政策，請參閱《*IAM 使用者指南*》中的[在 JSON 標籤上建立政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html#access_policies_create-json-editor)。

## 範例： AWS CodeConnections 使用 CLI 建立和使用主控台檢視的政策
<a name="security_iam_id-based-policy-examples-connections-clisdk"></a>

指定使用 或 AWS CLI SDK 來檢視、建立、標記或刪除連線的角色或使用者，應具有僅限於下列項目的許可。

**注意**  
只具有下列許可，並無法在主控台中完成連線。您需要新增下一節中的許可。

若要使用主控台來檢視可用連線的清單、檢視標籤和使用連線，請使用下列政策。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Sid": "ConnectionsFullAccess",
        "Effect": "Allow",
        "Action": [
            "codeconnections:CreateConnection",
            "codeconnections:DeleteConnection",
            "codeconnections:UseConnection",
            "codeconnections:GetConnection",
            "codeconnections:ListConnections",
            "codeconnections:TagResource",
            "codeconnections:ListTagsForResource",
            "codeconnections:UntagResource"
        ],
        "Resource": "*"
     }
   ]
}
```

------

## 範例： AWS CodeConnections 使用主控台建立 的政策
<a name="security_iam_id-based-policy-examples-connections-console"></a>

指定要管理在主控台中連線的角色或使用者，應具備完成主控台中的連線及建立安裝所需的許可，包括授權供應商進行交握，以及建立供連線使用的安裝。也應該新增 `UseConnection` 以使用主控台中的連線。請使用下列政策來在主控台中檢視、使用、建立、標記或刪除連線。

**注意**  
從 2024 年 7 月 1 日開始，主控台會在資源 ARN `codeconnections`中建立與 的連線。具有兩個服務字首的資源將繼續顯示在主控台中。

**注意**  
對於使用主控台建立的資源，政策陳述式動作必須包含 `codestar-connections`做為服務字首，如下列範例所示。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "codestar-connections:CreateConnection",
                "codestar-connections:DeleteConnection",
                "codestar-connections:GetConnection",
                "codestar-connections:ListConnections",
                "codestar-connections:GetInstallationUrl",
                "codestar-connections:GetIndividualAccessToken",
                "codestar-connections:ListInstallationTargets",
                "codestar-connections:StartOAuthHandshake",
                "codestar-connections:UpdateConnectionInstallation",
                "codestar-connections:UseConnection",
                "codestar-connections:TagResource",
                "codestar-connections:ListTagsForResource",
                "codestar-connections:UntagResource"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

------

## 範例：管理 的管理員層級政策 AWS CodeConnections
<a name="security_iam_id-based-policy-examples-connections-fullaccess"></a>

在此範例中，您想要授予 AWS 帳戶中的 IAM 使用者 CodeConnections 的完整存取權，讓使用者可以新增、更新和刪除連線。這是一個完整的存取政策，相當於 **AWSCodePipeline\$1FullAccess** 受管政策。如同該受管政策，您應該只將這類政策陳述式連接到需要完整管理存取 AWS 您帳戶間連線的 IAM 使用者、群組或角色。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Sid": "ConnectionsFullAccess",
        "Effect": "Allow",
        "Action": [
            "codeconnections:CreateConnection",
            "codeconnections:DeleteConnection",
            "codeconnections:UseConnection",
            "codeconnections:GetConnection",
            "codeconnections:ListConnections",
            "codeconnections:ListInstallationTargets",
            "codeconnections:GetInstallationUrl",
            "codeconnections:StartOAuthHandshake",
            "codeconnections:UpdateConnectionInstallation",
            "codeconnections:GetIndividualAccessToken",
            "codeconnections:TagResource",
            "codeconnections:ListTagsForResource",
            "codeconnections:UntagResource"
        ],
        "Resource": "*"
     }
   ]
}
```

------

## 範例：使用 的貢獻者層級政策 AWS CodeConnections
<a name="security_iam_id-based-policy-examples-connections-contributor"></a>

在此範例中，您想要授予 CodeConnections day-to-day使用存取權，例如建立和檢視連線的詳細資訊，但不要授予更具破壞性的動作，例如刪除連線。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AWSCodeConnectionsPowerUserAccess",
            "Effect": "Allow",
            "Action": [
                "codeconnections:CreateConnection",
                "codeconnections:UseConnection",
                "codeconnections:GetConnection",
                "codeconnections:ListConnections",
                "codeconnections:ListInstallationTargets",
                "codeconnections:GetInstallationUrl",
                "codeconnections:GetIndividualAccessToken",
                "codeconnections:StartOAuthHandshake",
                "codeconnections:UpdateConnectionInstallation",
                "codeconnections:ListTagsForResource"
            ],
            "Resource": "*"
        }
    ]
}
```

------

## 範例：使用 的read-only-level政策 AWS CodeConnections
<a name="security_iam_id-based-policy-examples-connections-readonly"></a>

在此範例中，您想要授予帳戶中的 IAM 使用者對 AWS 帳戶中連線的唯讀存取權。此範例會示範如何建立允許檢視這些項目的政策。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "ConnectionsforReadOnly",
    "Statement": [
        {
            "Sid": "ReadsAPIAccess",
            "Effect": "Allow",
            "Action": [
            "codeconnections:GetConnection",
            "codeconnections:ListConnections",
            "codeconnections:ListInstallationTargets",
            "codeconnections:GetInstallationUrl",
            "codeconnections:ListTagsForResource"
            ],
            "Resource": "*"
        }
    ]
}
```

------<a name="security_iam_id-based-policy-examples-connections-use"></a>

## 範例：使用 **VpcId** 內容金鑰限制主機 VPC 許可
<a name="security_iam_id-based-policy-examples-connections-vpc"></a>

在下列範例中，客戶可以使用 **VpcId** 內容金鑰，將主機的建立或管理限制為具有指定 VPC 的主機。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "codeconnections:CreateHost",
                "codeconnections:UpdateHost"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "codeconnections:VpcId": "vpc-EXAMPLE"
                }
            }
        }
    ]
}
```

------

# 使用標籤控制對 AWS CodeConnections 資源的存取
<a name="connections-tag-based-access-control"></a>

可以將標記連接到資源或在請求中將標記傳遞至支援標記的服務。在 AWS CodeConnections 中，資源可以有標籤，有些動作可以包含標籤。建立 IAM 政策時，可使用標籤條件索引鍵來控制以下項目：
+ 可在管道資源上執行動作的使用者 (根據資源已具有的標籤)。
+ 可在動作請求中傳遞的標籤。
+ 請求中是否可使用特定的標籤鍵。

下列範例示範如何在 CodeConnections AWS 使用者的政策中指定標籤條件。

**Example 1：根據請求中的標籤允許動作**  
下列政策授予使用者在 CodeConnections 中 AWS 建立連線的許可。  
若要這樣做，它會在請求指定名為 `Project` 且值為 `ProjectA` 的標籤時允許 `CreateConnection` 和 `TagResource` 動作。( `aws:RequestTag` 條件索引鍵用來控制哪些標籤可在 IAM 請求中傳遞。) `aws:TagKeys` 條件可確保標籤索引鍵區分大小寫。    
****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "codeconnections:CreateConnection",
        "codeconnections:TagResource"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/Project": "ProjectA"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": ["Project"]
        }
      }
    }
  ]
}
```

**Example 2：根據資源標籤允許動作**  
下列政策會授予使用者在 AWS CodeConnections 中對 資源執行動作和取得相關資訊的許可。  
若要這樣做，它會在管道有名為 `Project` 且值為 `ProjectA` 的標籤時允許特定動作。( `aws:RequestTag` 條件索引鍵用來控制哪些標籤可在 IAM 請求中傳遞。) `aws:TagKeys` 條件可確保標籤索引鍵區分大小寫。    
****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "codeconnections:CreateConnection",
        "codeconnections:DeleteConnection",
        "codeconnections:ListConnections"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:ResourceTag/Project": "ProjectA"
        },
        "ForAllValues:StringEquals": {
          "aws:TagKeys": ["Project"]
        }
      }
    }
  ]
}
```

## 在主控台中使用通知和連線
<a name="security_iam_id-based-policy-examples-console"></a>

通知體驗內建於 CodeBuild、CodeCommit、CodeDeploy 和 CodePipeline 主控台中，以及開發人員主控台的 **Settings (設定)** 導覽列本身。若要存取主控台中的通知，您必須套用這些服務相關的其中一個受管政策，或者您必須擁有至少一組許可。這些許可必須允許您列出和檢視 AWS 帳戶中 AWS CodeStar Notifications 和 AWS CodeConnections 資源的詳細資訊。如果您建立比最基本必要許可更嚴格的身分型政策，則對於具有該政策的實體 (IAM 使用者或角色) 而言，主控台就無法如預期運作。如需授予對這些主控台 AWS CodeBuild的存取權 AWS CodeCommit AWS CodeDeploy，以及 AWS CodePipeline包括這些主控台的存取權的詳細資訊，請參閱下列主題：
+ CodeBuild：[針對 CodeBuild 使用身分型政策](https://docs.aws.amazon.com/codebuild/latest/userguide/security_iam_id-based-policy-examples.html#managed-policies)
+ CodeCommit：[針對 CodeCommit 使用身分型政策](https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-iam-identity-based-access-control.html)
+ AWS CodeDeploy： [的身分和存取管理 AWS CodeDeploy](https://docs.aws.amazon.com/codedeploy/latest/userguide/security-iam.html)
+ CodePipeline：[使用 IAM 政策的存取控制](https://docs.aws.amazon.com/codepipeline/latest/userguide/access-control.html)

AWS CodeStar Notifications 沒有任何 AWS 受管政策。若要提供通知功能的存取權，您必須針對上述其中一項服務套用其中一項受管政策，或者，您必須建立具有您要授予使用者或實體之許可層級的政策，然後將這些政策連接到需要這些許可的使用者、群組或角色。如需更多資訊和範例，請參閱下列內容：
+ [範例：管理 AWS CodeStar Notifications 的管理員層級政策](security_iam_id-based-policy-examples-notifications.md#security_iam_id-based-policy-examples-notifications-full-access)
+ [範例：使用 AWS CodeStar Notifications 的貢獻者層級政策](security_iam_id-based-policy-examples-notifications.md#security_iam_id-based-policy-examples-notifications-contributor)
+ [範例：使用 AWS CodeStar Notifications 的read-only-level政策](security_iam_id-based-policy-examples-notifications.md#security_iam_id-based-policy-examples-notifications-read-only).



AWS CodeConnections 沒有任何 AWS 受管政策。您可以針對存取權使用許可和許可組合，如 [完成連線的許可](#permissions-reference-connections-handshake) 中詳述的許可權限。

如需詳細資訊，請參閱下列內容：
+ [範例：管理 的管理員層級政策 AWS CodeConnections](security_iam_id-based-policy-examples-connections.md#security_iam_id-based-policy-examples-connections-fullaccess)
+ [範例：使用 的貢獻者層級政策 AWS CodeConnections](security_iam_id-based-policy-examples-connections.md#security_iam_id-based-policy-examples-connections-contributor)
+ [範例：使用 的read-only-level政策 AWS CodeConnections](security_iam_id-based-policy-examples-connections.md#security_iam_id-based-policy-examples-connections-readonly)

對於僅呼叫 AWS CLI 或 AWS API 的使用者，您不需要允許主控台許可。反之，只需允許存取符合您嘗試執行之 API 操作的動作就可以了。

## 允許使用者檢視他們自己的許可
<a name="security_iam_id-based-policy-examples-view-own-permissions"></a>

此範例會示範如何建立政策，允許 IAM 使用者檢視附加到他們使用者身分的內嵌及受管政策。此政策包含在主控台或使用 或 AWS CLI AWS API 以程式設計方式完成此動作的許可。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewOwnUserInfo",
            "Effect": "Allow",
            "Action": [
                "iam:GetUserPolicy",
                "iam:ListGroupsForUser",
                "iam:ListAttachedUserPolicies",
                "iam:ListUserPolicies",
                "iam:GetUser"
            ],
            "Resource": ["arn:aws:iam::*:user/${aws:username}"]
        },
        {
            "Sid": "NavigateInConsole",
            "Effect": "Allow",
            "Action": [
                "iam:GetGroupPolicy",
                "iam:GetPolicyVersion",
                "iam:GetPolicy",
                "iam:ListAttachedGroupPolicies",
                "iam:ListGroupPolicies",
                "iam:ListPolicyVersions",
                "iam:ListPolicies",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}
```

# 疑難排解 AWS CodeStar Notifications 和 AWS CodeConnections 身分和存取權
<a name="security_iam_troubleshoot"></a>

使用下列資訊，協助您診斷和修復您使用通知和 IAM 時可能遇到的常見問題。

**Topics**
+ [我是管理員，想要允許其他人存取通知](#security_iam_troubleshoot-admin-delegate)
+ [我已建立 Amazon SNS 主題，並將其新增為通知規則目標，但我未收到有關事件的電子郵件](#security_iam_troubleshoot-sns)
+ [我想要允許 AWS 帳戶外的人員存取 my AWS CodeStar Notifications 和 AWS CodeConnections 資源](#security_iam_troubleshoot-cross-account-access)

## 我是管理員，想要允許其他人存取通知
<a name="security_iam_troubleshoot-admin-delegate"></a>

若要允許其他人存取 AWS CodeStar Notifications 和 AWS CodeConnections，您必須將許可授予需要存取的人員或應用程式。如果您使用 AWS IAM Identity Center 來管理人員和應用程式，您可以將許可集指派給使用者或群組，以定義其存取層級。許可集會自動建立 IAM 政策，並將其指派給與該人員或應用程式相關聯的 IAM 角色。如需詳細資訊，請參閱*AWS IAM Identity Center 《 使用者指南*》中的[許可集](https://docs.aws.amazon.com/singlesignon/latest/userguide/permissionsetsconcept.html)。

如果您不是使用 IAM Identity Center，則必須為需要存取的人員或應用程式建立 IAM 實體 （使用者或角色）。然後，您必須將政策連接到實體，以授予他們正確的 AWS CodeStar Notifications 和 AWS CodeConnections 許可。授予許可後，請將登入資料提供給使用者或應用程式開發人員。他們將使用這些登入資料來存取 AWS。若要進一步了解如何建立 IAM 使用者、群組、政策和許可，請參閱《IAM **[使用者指南》中的 IAM 身分](https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html)[和政策和許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)。

For AWS CodeStar Notifications 特定資訊，請參閱 [AWS CodeStar Notifications 的許可和範例](security_iam_id-based-policy-examples-notifications.md)。

## 我已建立 Amazon SNS 主題，並將其新增為通知規則目標，但我未收到有關事件的電子郵件
<a name="security_iam_troubleshoot-sns"></a>

為了接收有關事件的通知，您必須將有效的 Amazon SNS 主題訂閱為通知規則的目標，而且您的電子郵件地址必須訂閱該 Amazon SNS 主題。若要疑難排解 Amazon SNS 主題的問題，請檢查下列各項：
+ 確定 Amazon SNS 主題與通知規則位於相同的 AWS 區域。
+ 檢查並確定您的電子郵件別名已訂閱正確的主題，而且您已確認訂閱。如需詳細資訊，請參閱[讓端點訂閱 Amazon SNS 主題](https://docs.aws.amazon.com/sns/latest/dg/sns-tutorial-create-subscribe-endpoint-to-topic.html)。
+ 確認主題政策已修改，以允許 AWS CodeStar Notifications 推送通知至該主題。主題政策應該包含類似以下的陳述式：

  ```
  {
      "Sid": "AWSCodeStarNotifications_publish",
      "Effect": "Allow",
      "Principal": {
          "Service": [
              "codestar-notifications.amazonaws.com"
          ]
      },
      "Action": "SNS:Publish",
      "Resource": "arn:aws:sns:us-east-1:123456789012:MyNotificationTopicName",
      "Condition": {
          "StringEquals": {
              "aws:SourceAccount": "123456789012"
          }
      }
  }
  ```

  如需詳細資訊，請參閱[設定](setting-up.md)。

## 我想要允許 AWS 帳戶外的人員存取 my AWS CodeStar Notifications 和 AWS CodeConnections 資源
<a name="security_iam_troubleshoot-cross-account-access"></a>

您可以建立一個角色，讓其他帳戶中的使用者或您組織外部的人員存取您的資源。您可以指定要允許哪些信任物件取得該角色。針對支援基於資源的政策或存取控制清單 (ACL) 的服務，您可以使用那些政策來授予人員存取您的資源的許可。

如需進一步了解，請參閱以下內容：
+ 若要了解 AWS CodeStar Notifications 和 AWS CodeConnections 是否支援這些功能，請參閱 [開發人員工具主控台中的功能如何與 IAM 搭配使用](security_iam_service-with-iam.md)。
+ 若要了解如何在您擁有 AWS 帳戶 的 資源之間提供存取權，請參閱《[IAM 使用者指南》中的在您擁有 AWS 帳戶 的另一個 中提供存取權給](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html) *IAM* 使用者。
+ 若要了解如何將資源的存取權提供給第三方 AWS 帳戶，請參閱《*IAM 使用者指南*》中的[將存取權提供給第三方 AWS 帳戶 擁有](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)。
+ 如需了解如何透過聯合身分提供存取權，請參閱《*IAM 使用者指南*》中的[將存取權提供給在外部進行身分驗證的使用者 (聯合身分)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_federated-users.html)。
+ 如需了解使用角色和資源型政策進行跨帳戶存取之間的差異，請參閱《IAM 使用者指南》**中的 [IAM 中的跨帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

# 使用 AWS CodeStar Notifications 的服務連結角色
<a name="using-service-linked-roles"></a>

AWS CodeStar Notifications 使用 AWS Identity and Access Management (IAM)[ 服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 AWS CodeStar Notifications 的唯一 IAM 角色類型。服務連結角色由 AWS CodeStar Notifications 預先定義，且內含該服務代您呼叫其他 AWS 服務所需的所有許可。此角色是您第一次建立通知規則時為您建立的。您不必建立角色。

服務連結角色可讓您更輕鬆地設定 AWS CodeStar Notifications，因為您不需要手動新增許可。 AWS CodeStar Notifications 會定義其服務連結角色的許可，除非另有定義，否則只有 AWS CodeStar Notifications 可以擔任其角色。定義的許可包括信任政策和許可政策，且該許可政策無法附加至其他 IAM 實體。

若要刪除服務連結角色，您必須先刪除其相關資源。這可保護您的 AWS CodeStar Notifications 資源，因為您不會不小心移除存取資源的許可。

關於支援服務連結角色的其他服務，如需相關資訊，請參閱[與 IAM 搭配運作的AWS 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

## AWS CodeStar Notifications 的服務連結角色許可
<a name="slr-permissions"></a>

AWS CodeStar Notifications 使用 AWSServiceRoleForCodeStarNotifications 服務連結角色來擷取工具鏈中發生之事件的相關資訊，並將通知傳送至您指定的目標。

AWSServiceRoleForCodeStarNotifications 服務連結角色信任下列服務可擔任該角色：
+ `codestar-notifications.amazonaws.com`

角色許可政策允許 AWS CodeStar Notifications 對指定的資源完成下列動作：
+ 動作：`CloudWatch Event rules that are named awscodestar-notifications-*` 上的 `PutRule`
+ 動作：`CloudWatch Event rules that are named awscodestar-notifications-*` 上的 `DescribeRule`
+ 動作：`CloudWatch Event rules that are named awscodestar-notifications-*` 上的 `PutTargets`
+ 動作：`CreateTopic` 至 `create Amazon SNS topics for use with AWS CodeStar Notifications with the prefix CodeStarNotifications-`
+ 動作：`all comments on all pull requests in all CodeCommit repositories in the AWS account` 上的 `GetCommentsForPullRequests`
+ 動作：`all comments on all commits in all CodeCommit repositories in the AWS account` 上的 `GetCommentsForComparedCommit`
+ 動作：`all commits in all CodeCommit repositories in the AWS account` 上的 `GetDifferences`
+ 動作：`all comments on all commits in all CodeCommit repositories in the AWS account` 上的 `GetCommentsForComparedCommit`
+ 動作：`all commits in all CodeCommit repositories in the AWS account` 上的 `GetDifferences`
+ 動作：`all AWS Chatbot clients in the AWS account` 上的 `DescribeSlackChannelConfigurations`
+ 動作：`all AWS Chatbot clients in the AWS account` 上的 `UpdateSlackChannelConfiguration`
+ 動作：`all actions in all pipelines in the AWS account` 上的 `ListActionExecutions`
+ 動作：`all files in all CodeCommit repositories in the AWS account unless otherwise tagged` 上的 `GetFile`

您可以在 AWSServiceRoleForCodeStarNotifications 服務連結角色的政策陳述式中看到這些動作。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "events:PutTargets",
                "events:PutRule",
                "events:DescribeRule"
            ],
            "Resource": "arn:aws:events:*:*:rule/awscodestarnotifications-*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "sns:CreateTopic"
            ],
            "Resource": "arn:aws:sns:*:*:CodeStarNotifications-*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "codecommit:GetCommentsForPullRequest",
                "codecommit:GetCommentsForComparedCommit",
                "codecommit:GetDifferences",
                "chatbot:DescribeSlackChannelConfigurations",
                "chatbot:UpdateSlackChannelConfiguration",
                "codepipeline:ListActionExecutions"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "codecommit:GetFile"
            ],
            "Resource": "*",
            "Condition": {
                "StringNotEquals": {
                    "aws:ResourceTag/ExcludeFileContentFromNotifications": "true"
                }
            },
            "Effect": "Allow"
        }
    ]
}
```

------

您必須設定許可，IAM 實體 (如使用者、群組或角色) 才可建立、編輯或刪除服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[服務連結角色許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions)。

## 建立 AWS CodeStar Notifications 的服務連結角色
<a name="create-slr"></a>

您不需要手動建立服務連結角色，您可以從 或 SDK 使用開發人員工具主控台 AWS CLI 或 CreateNotificationRule API 來建立通知規則。 SDKs 您也可以直接呼叫 API。無論您使用哪一種方法，系統都會為您建立服務連結角色。

若您刪除此服務連結角色，之後需要再次建立，您可以在帳戶中使用相同程序重新建立角色。您可以從 或 SDK 使用開發人員工具主控台 AWS CLI 或 CreateNotificationRule API 來建立通知規則。 SDKs 您也可以直接呼叫 API。無論您使用哪一種方法，系統都會為您建立服務連結角色。

## 編輯 AWS CodeStar Notifications 的服務連結角色
<a name="edit-slr"></a>

因為有各種實體可能會參考服務連結角色，所以您無法在建立角色之後變更角色名稱。不過，您可以使用 IAM 來編輯角色描述。如需詳細資訊，請參閱*《IAM 使用者指南》*中的[編輯服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role)。

## 刪除 AWS CodeStar Notifications 的服務連結角色
<a name="delete-slr"></a>

若您不再使用需要服務連結角色的功能或服務，我們建議您刪除該角色。如此一來，您就沒有未主動監控或維護的未使用實體。刪除服務連結角色之前，您必須先清理資源。For AWS CodeStar Notifications，這表示刪除在您 AWS 帳戶中使用服務角色的所有通知規則。

**注意**  
如果您嘗試刪除資源時， AWS CodeStar Notifications 服務正在使用該角色，則刪除可能會失敗。若此情況發生，請等待數分鐘後並再次嘗試操作。

**刪除 AWSServiceRoleFor AWS CodeStar Notifications使用的CodeStar Notifications 資源 AWSServiceRoleForCodeStarNotifications**

1. 開啟位於 https：//[https://console.aws.amazon.com/codesuite/settings/notifications](https://console.aws.amazon.com/codesuite/settings/notifications/) 的 AWS 開發人員工具主控台。
**注意**  
通知規則適用於建立規則 AWS 的區域。如果您在多個區域中有通知規則 AWS ，請使用區域選擇器來變更 AWS 區域。

1. 選擇清單中出現的所有通知規則，然後選擇 **Delete (刪除)**。

1. 在您建立通知規則的所有 AWS 區域中重複這些步驟。

****使用 IAM** 來刪除服務連結角色**

使用 IAM 主控台 AWS CLI或 AWS Identity and Access Management API 來刪除 AWSServiceRoleForCodeStarNotifications 服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[刪除服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role)。

## AWS CodeStar Notifications 服務連結角色支援的區域
<a name="slr-regions"></a>

AWS CodeStar Notifications 支援在所有提供服務的 AWS 區域中使用服務連結角色。如需詳細資訊，請參閱 [AWS 區域與端點](https://docs.aws.amazon.com/general/latest/gr/rande.html)和 [AWS CodeStar Notifications](https://docs.aws.amazon.com/general/latest/gr/codestar_notifications.html)。

# 使用 的服務連結角色 AWS CodeConnections
<a name="service-linked-role-connections"></a>

AWS CodeConnections use AWS Identity and Access Management (IAM)[ 服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 的唯一 IAM 角色類型 AWS CodeConnections。服務連結角色由 預先定義， AWS CodeConnections 並包含該服務代表您呼叫其他 AWS 服務所需的所有許可。此角色是您第一次建立連線時為您建立的。您不必建立角色。

服務連結角色可讓您更 AWS CodeConnections 輕鬆地設定，因為您不必手動新增許可。 AWS CodeConnections 會定義其服務連結角色的許可，除非另有定義，否則只能 AWS CodeConnections 擔任其角色。定義的許可包括信任政策和許可政策，且該許可政策無法附加至其他 IAM 實體。

若要刪除服務連結角色，您必須先刪除其相關資源。這可保護您的 AWS CodeConnections 資源，因為您不會不小心移除存取資源的許可。

關於支援服務連結角色的其他服務，如需相關資訊，請參閱[與 IAM 搭配運作的AWS 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**注意**  
在新服務字首下建立的資源動作`codeconnections`可供使用。在新服務字首下建立資源將在資源 ARN `codeconnections`中使用 。`codestar-connections` 服務字首的動作和資源仍然可用。在 IAM 政策中指定資源時，服務字首需要符合資源的字首。

## 的服務連結角色許可 AWS CodeConnections
<a name="slr-permissions"></a>

AWS CodeConnections 使用 AWSServiceRoleForGitSync 服務連結角色，將 Git 同步與連接的 Git 型儲存庫搭配使用。

AWSServiceRoleForGitSync 服務連結角色信任下列服務擔任該角色：
+ `repository.sync.codeconnections.amazonaws.com`

名為 AWSGitSyncServiceRolePolicy 的角色許可政策允許 對指定的資源 AWS CodeConnections 完成下列動作：
+ 動作：授與許可，以允許使用者與外部 Git 型儲存庫建立連線，以及搭配這些儲存庫使用 Git 同步。

您必須設定許可，IAM 實體 (如使用者、群組或角色) 才可建立、編輯或刪除服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[服務連結角色許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions)。

## 為 建立服務連結角色 AWS CodeConnections
<a name="create-slr-connections"></a>

您不需要手動建立服務連結角色，當您使用 CreateRepositoryLink API 為 Git 同步的專案建立資源時，您就會建立該角色。

若您刪除此服務連結角色，之後需要再次建立，您可以在帳戶中使用相同程序重新建立角色。

## 編輯 的服務連結角色 AWS CodeConnections
<a name="edit-slr-connections"></a>

因為有各種實體可能會參考服務連結角色，所以您無法在建立角色之後變更角色名稱。不過，您可以使用 IAM 來編輯角色描述。如需詳細資訊，請參閱*《IAM 使用者指南》*中的[編輯服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role)。

## 刪除 的服務連結角色 AWS CodeConnections
<a name="delete-slr-connections"></a>

若您不再使用需要服務連結角色的功能或服務，我們建議您刪除該角色。如此一來，您就沒有未主動監控或維護的未使用實體。刪除服務連結角色之前，您必須先清理資源。這表示刪除在您 AWS 帳戶中使用 服務角色的所有連線。

**注意**  
如果 AWS CodeConnections 服務在您嘗試刪除資源時使用角色，則刪除可能會失敗。若此情況發生，請等待數分鐘後並再次嘗試操作。

**刪除 AWSServiceRoleForGitSync 使用 AWS CodeConnections 的資源**

1. 開啟 [開發人員工具] 主控台，然後選擇**設定**。

1. 選擇清單中出現的所有連線，然後選擇**刪除**。

1. 在您建立連線的所有 AWS 區域中重複這些步驟。

****使用 IAM** 來刪除服務連結角色**

使用 IAM 主控台 AWS CLI或 AWS Identity and Access Management API 來刪除 AWSServiceRoleForGitSync 服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[刪除服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role)。

## AWS CodeConnections 服務連結角色支援的區域
<a name="slr-regions-connections"></a>

AWS CodeConnections 支援在所有提供服務的 AWS 區域中使用服務連結角色。如需詳細資訊，請參閱 [AWS 區域與端點](https://docs.aws.amazon.com/general/latest/gr/rande.html)。

# AWS 的 受管政策 AWS CodeConnections
<a name="security-iam-awsmanpol"></a>





 AWS 受管政策是由 AWS AWS 受管政策建立和管理的獨立政策旨在為許多常用案例提供許可，以便您可以開始將許可指派給使用者、群組和角色。

請記住， AWS 受管政策可能不會授予特定使用案例的最低權限許可，因為這些許可可供所有 AWS 客戶使用。我們建議您定義特定於使用案例的[客戶管理政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies)，以便進一步減少許可。

您無法變更 AWS 受管政策中定義的許可。如果 AWS 更新受 AWS 管政策中定義的許可，則更新會影響政策連接的所有委託人身分 （使用者、群組和角色）。 AWS 服務 當新的 啟動或新的 API 操作可用於現有服務時， AWS 最有可能更新 AWS 受管政策。

如需詳細資訊，請參閱 *IAM 使用者指南*中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。

**注意**  
在新服務字首下建立的資源動作`codeconnections`可供使用。在新服務字首下建立資源將在資源 ARN `codeconnections`中使用 。`codestar-connections` 服務字首的動作和資源仍然可用。在 IAM 政策中指定資源時，服務字首需要符合資源的字首。













## AWS 受管政策：AWSGitSyncServiceRolePolicy
<a name="security-iam-awsmanpol-AWSGitSyncServiceRolePolicy"></a>



您無法將 AWSGitSyncServiceRolePolicy 附加至您的 IAM 實體。此政策會連接到服務連結角色， AWS CodeConnections 允許 代表您執行動作。如需詳細資訊，請參閱[使用 的服務連結角色 AWS CodeConnections](service-linked-role-connections.md)。



此政策可讓客戶存取 Git 型儲存庫，以便與連線搭配使用。客戶將在使用 CreateRepositoryLink API 後存取這些資源。



**許可詳細資訊**

此政策包含以下許可。




+ `codeconnections` – 授與許可以允許使用者與外部 Git 型儲存庫建立連線。



------
#### [ JSON ]

****  

```
{
	"Version":"2012-10-17",		 	 	 
	"Statement": [
		{
			"Sid": "AccessGitRepos",
			"Effect": "Allow",
			"Action": [
				"codestar-connections:UseConnection",
				"codeconnections:UseConnection"
			],
			"Resource": [
				"arn:aws:codestar-connections:*:*:connection/*",
				"arn:aws:codeconnections:*:*:connection/*"
			],
			"Condition": {
				"StringEquals": {
					"aws:ResourceAccount": "${aws:PrincipalAccount}"
				}
			}
		}
	]
}
```

------

## AWS CodeConnections AWS 受管政策的更新
<a name="security-iam-awsmanpol-updates"></a>



檢視自此服務開始追蹤這些變更 AWS CodeConnections 以來， AWS 受管政策更新的詳細資訊。如需此頁面變更的自動提醒，請訂閱 AWS CodeConnections [文件歷史記錄](doc-history.md)頁面上的 RSS 摘要。




| 變更 | 描述 | Date | 
| --- | --- | --- | 
|  [AWSGitSyncServiceRolePolicy](#security-iam-awsmanpol-AWSGitSyncServiceRolePolicy) – 已更新政策  | AWS CodeStar Connections 服務名稱已變更為 AWS CodeConnections。使用包含兩個服務字首ARNs 更新資源的政策。 | 2024 年 4 月 26 日 | 
|  [AWSGitSyncServiceRolePolicy](#security-iam-awsmanpol-AWSGitSyncServiceRolePolicy) – 新政策  |  AWS CodeStar Connections 已新增政策。 准許連線使用者將 Git 同步與連接的 Git 型儲存庫搭配使用。  | 2023 年 11 月 26 日 | 
|  AWS CodeConnections 已開始追蹤變更  |  AWS CodeConnections 已開始追蹤其 AWS 受管政策的變更。  | 2023 年 11 月 26 日 | 



# AWS CodeStar Notifications 和 AWS CodeConnections 的合規驗證
<a name="compliance"></a>

如需特定合規計劃範圍內 AWS 的服務清單，請參閱[AWS 合規計劃範圍內的服務](https://aws.amazon.com/compliance/services-in-scope/)。如需一般資訊，請參閱 [AWS 合規計劃](https://aws.amazon.com/compliance/programs/)。

您可以使用 下載第三方稽核報告 AWS Artifact。如需詳細資訊，請參閱在 [AWS Artifact 中下載報告](https://docs.aws.amazon.com/artifact/latest/ug/downloading-documents.html)。

您使用 AWS CodeStar Notifications 和 AWS CodeConnections 時的合規責任取決於資料的機密性、您公司的合規目標，以及適用的法律和法規。 AWS 提供下列資源來協助合規：
+ [安全與合規快速入門指南](https://aws.amazon.com/quickstart/?awsf.quickstart-homepage-filter=categories%23security-identity-compliance) – 這些部署指南討論架構考量，並提供在其中部署以安全與合規為重心的基準環境的步驟 AWS。
+ [AWS 合規資源](https://aws.amazon.com/compliance/resources/) – 此工作手冊和指南集合可能適用於您的產業和位置。
+ [AWS Config](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) – AWS 此服務會評估資源組態符合內部實務、產業準則和法規的程度。
+ [AWS Security Hub CSPM](https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html) – AWS 此服務提供 內安全狀態的完整檢視 AWS ，協助您檢查是否符合安全產業標準和最佳實務。

# 在 AWS CodeStar Notifications 和 AWS CodeConnections 中的彈性
<a name="disaster-recovery-resiliency"></a>

 AWS 全球基礎設施是以 AWS 區域和可用區域為基礎建置。 AWS 區域提供多個實體分隔和隔離的可用區域，這些可用區域以低延遲、高輸送量和高備援聯網連接。透過可用區域，您所設計與操作的應用程式和資料庫，就能夠在可用區域之間自動容錯移轉，而不會發生中斷。可用區域的可用性、容錯能力和擴充能力，均較單一或多個資料中心的傳統基礎設施還高。

如需 AWS 區域和可用區域的詳細資訊，請參閱 [AWS 全球基礎設施](https://aws.amazon.com/about-aws/global-infrastructure/)。
+ 通知規則專屬於建立規則 AWS 區域 的 。如果您在多個 中有通知規則 AWS 區域，請使用區域選擇器來檢閱每個規則中的通知規則 AWS 區域。
+ AWS CodeStar Notifications 依賴 Amazon Simple Notification Service (Amazon SNS) 主題作為通知規則目標。Amazon SNS 主題和通知規則目標的相關資訊，可以存放在與您設定通知規則所在 AWS 區域不同的區域。

# 基礎設施安全 in AWS CodeStar Notifications 和 AWS CodeConnections
<a name="infrastructure-security"></a>

作為受管服務中的功能， AWS CodeStar Notifications 和 AWS CodeConnections 受到 [Amazon Web Services：安全程序概觀](https://d0.awsstatic.com/whitepapers/Security/AWS_Security_Whitepaper.pdf)白皮書中所述的 AWS 全球網路安全程序的保護。

您可以使用 AWS 發佈的 API 呼叫，透過網路存取 AWS CodeStar Notifications 和 AWS CodeConnections。用戶端必須支援 Transport Layer Security (TLS) 1.0 或更新版本。用戶端也必須支援具備完美轉送私密 (PFS) 的密碼套件，例如臨時 Diffie-Hellman (DHE) 或橢圓曲線臨時 Diffie-Hellman (ECDHE)。大多數現代系統都支援這些模式。

請求必須使用存取金鑰 ID 和與 IAM 委託人相關聯的私密存取金鑰來簽署。或者，您可以使用 [AWS Security Token Service](https://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html) (AWS STS) 產生臨時安全憑證來簽署請求。

## 跨區域 AWS CodeConnections 資源之間的流量
<a name="infrastructure-security-global-resources"></a>

如果您使用連線功能來啟用 資源的連線，則表示您同意並指示我們在您使用基礎服務 AWS 區域 之 AWS 區域 以外的 中存放和處理與此類連線資源相關的資訊，這僅是為了在資源建立所在區域以外的區域中提供此類資源的連線。

如需詳細資訊，請參閱[AWS CodeConnections 中的全域資源](welcome-connections-how-it-works-global.md)。

**注意**  
如果您使用連線功能為不需要先啟用的區域中的資源啟用連線，我們將會儲存並處理上述主題所述的資訊。  
對於在必須先啟用的區域中建立的連線，例如歐洲 (米蘭) 區域，我們將會僅儲存和處理該地區中的連線資訊。