

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

# AWS Health 如何使用 IAM
<a name="security_iam_service-with-iam"></a>

在您使用 IAM 管理對 的存取之前 AWS Health，您應該了解哪些 IAM 功能可與 搭配使用 AWS Health。若要全面了解 AWS Health 和其他 AWS 服務如何與 IAM 搭配使用，請參閱《IAM *使用者指南*》中的與 IAM [AWS 搭配使用的 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**Topics**
+ [AWS Health 身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [AWS Health 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以 AWS Health 標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [AWS Health IAM 角色](#security_iam_service-with-iam-roles)

## AWS Health 身分型政策
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分類型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下會允許或拒絕動作。 AWS Health 支援特定動作、資源及條件索引鍵。若要了解您在 JSON 政策中使用的所有元素，請參閱《*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` 元素描述您可以用來允許或拒絕政策中存取的動作。政策會使用動作來授予執行相關聯動作的許可。

中的政策動作在動作之前 AWS Health 使用下列字首：`health:`。例如，若要授與某人許可，使其能使用 [DescribeEventDetails](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html) API 操作，檢視特定事件的詳細資訊，您可以將 `heath:DescribeEventDetails` 動作加入政策中。

政策陳述式必須包含 `Action`或 `NotAction` element。 AWS Health 定義自己的一組動作，描述您可以使用此服務執行的任務。

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

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

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

```
"Action": "health:Describe*"
```



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

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

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

`Resource` JSON 政策元素可指定要套用動作的物件。最佳實務是使用其 [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) 來指定資源。若動作不支援資源層級許可，使用萬用字元 (\$1) 表示該陳述式適用於所有資源。

```
"Resource": "*"
```



 AWS Health 事件具有下列 Amazon Resource Name (ARN) 格式。

```
arn:${Partition}:health:*::event/service/event-type-code/event-ID
```

例如，若要在陳述式中指定 `EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456` 事件，請使用以下 ARN。

```
"Resource": "arn:aws:health:*::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456"
```

若要指定屬於特定帳戶的 Amazon EC2 的所有 AWS Health 事件，請使用萬用字元 (\$1)。

```
"Resource": "arn:aws:health:*::event/EC2/*/*"
```

如需 ARNs 格式的詳細資訊，請參閱 [Amazon Resource Name (ARNs) AWS 和服務命名空間](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)。

某些 AWS Health 動作無法對特定資源執行。在這些情況下，您必須使用萬用字元 (\$1)。

```
"Resource": "*"
```

AWS Health API 操作可以涉及多個資源。例如，[DescribeEvents](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEvents.html) 操作會傳回符合特定篩選條件之事件的資訊。這表示 IAM 使用者必須具有檢視此事件的許可。

若要在單一陳述式中指定多項資源，請使用逗號分隔 ARN。

```
"Resource": [
      "resource1",
      "resource2"
```

AWS Health 僅支援運作狀態事件的資源層級許可，也僅支援 [DescribeAffectedEntities](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeAffectedEntities.html) 和 [DescribeEventDetails](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html) API 操作。如需詳細資訊，請參閱[根據資源與根據動作的條件](security_iam_id-based-policy-examples.md#resource-action-based-conditions)。

若要查看 AWS Health 資源類型及其 ARNs的清單，請參閱《*IAM 使用者指南*》中的 [定義的資源 AWS Health](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awshealthapisandnotifications.html#awshealthapisandnotifications-resources-for-iam-policies)。若要了解您可以使用哪些動作指定每個資源的 ARN，請參閱 [AWS Health定義的動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awshealthapisandnotifications.html#awshealthapisandnotifications-actions-as-permissions)。

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

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

`Condition` 元素會根據定義的條件，指定陳述式的執行時機。您可以建立使用[條件運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html)的條件運算式 (例如等於或小於)，來比對政策中的條件和請求中的值。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

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



[DescribeAffectedEntities](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeAffectedEntities.html) 和 [DescribeEventDetails](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html) API 操作支援 `health:eventTypeCode` 與 `health:service` 條件金鑰。

若要查看 AWS Health 條件金鑰清單，請參閱《*IAM 使用者指南*》中的 [的條件金鑰 AWS Health](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awshealthapisandnotifications.html#awshealthapisandnotifications-policy-keys)。若要了解您可以使用條件金鑰的動作和資源，請參閱 [定義的動作 AWS Health](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awshealthapisandnotifications.html#awshealthapisandnotifications-actions-as-permissions)。

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



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

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

以資源為基礎的政策是 JSON 政策文件，指定指定委託人可在 AWS Health 資源上執行的動作，以及在何種條件下執行的動作。 AWS Health 支援運作狀態事件的資源型許可政策。資源型政策可讓您依資源將使用許可授予至其他帳戶。您也可以使用資源型政策，允許 AWS 服務存取您的 AWS Health 事件。

若要啟用跨帳戶存取，您可以指定在其他帳戶內的所有帳戶或 IAM 實體，作為[資源型政策的委託人](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html)。新增跨帳戶主體至資源型政策，只是建立信任關係的一半。當委託人和資源位於不同的 AWS 帳戶中時，您還必須授予委託人實體存取資源的許可。透過將身分型政策連接到實體來授予許可。不過，如果資源型政策會為相同帳戶中的委託人授予存取，這時就不需要額外的身分型政策。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM 角色與以資源為基礎的原則有何差異](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_compare-resource-policies.html)。

AWS Health 僅支援 [DescribeAffectedEntities](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeAffectedEntities.html) 和 [DescribeEventDetails](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetails.html) API 操作的資源型政策。您可以在政策中指定這些動作，以定義哪些委託人實體 （帳戶、使用者、角色和聯合身分使用者） 可以對 AWS Health 事件執行動作。

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



若要檢視以 AWS Health 資源為基礎的政策範例，請參閱 [根據資源與根據動作的條件](security_iam_id-based-policy-examples.md#resource-action-based-conditions)。

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

AWS Health 不支援標記資源或根據標籤控制存取。

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

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

### 搭配 使用臨時登入資料 AWS Health
<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 Health 支援使用臨時登入資料。

### 服務連結角色
<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 Health 支援與 整合的服務連結角色 AWS Organizations。服務連結角色名為 `AWSServiceRoleForHealth_Organizations`。連接至角色是 [Health\$1OrganizationsServiceRolePolicy](https://console.aws.amazon.com//iam/home?#/policies/arn:aws:iam::aws:policy/aws-service-role/Health_OrganizationsServiceRolePolicy) AWS 受管政策。受管 AWS 政策允許 存取組織中其他 AWS 帳戶 AWS Health 的運作狀態事件。

您可以使用 [EnableHealthServiceAccessForOrganization](https://docs.aws.amazon.com//health/latest/APIReference/API_EnableHealthServiceAccessForOrganization.html) 操作，以在帳戶中建立服務連結角色。不過，如果您想停用此功能，您必須先呼叫 [DisableHealthServiceAccessForOrganization](https://docs.aws.amazon.com//health/latest/APIReference/API_DisableHealthServiceAccessForOrganization.html) 操作。然後，您可以透過 IAM 主控台、IAM API 或 AWS Command Line Interface () 刪除角色AWS CLI。如需詳細資訊，請參閱《 IAM 使用者指南》**中的[使用服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html)。

如需詳細資訊，請參閱[跨帳戶彙總 AWS Health 事件](aggregate-events.md)。

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

此功能可讓服務代表您擔任[服務角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-role)。此角色可讓服務存取其他服務中的資源，以代表您完成動作。服務角色會出現在您的 IAM 帳戶中，且由該帳戶所擁有。這表示 IAM 管理員可以變更此角色的許可。不過，這樣可能會破壞此服務的功能。

AWS Health 不支援 服務角色。