

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

# 啟用組織檢視
<a name="enable-organizational-view"></a>

您可以使用 AWS Health 主控台來取得 AWS 組織中運作狀態事件的集中式檢視。

所有 AWS 支援 計劃都可以在 AWS Health 主控台中使用組織檢視，無需額外費用。

**注意**  
如果您想要允許使用者存取 管理帳戶中的此功能，他們必須擁有 [https://console.aws.amazon.com//iam/home?#/policies/arn:aws:iam::aws:policy/AWSHealthFullAccess](https://console.aws.amazon.com//iam/home?#/policies/arn:aws:iam::aws:policy/AWSHealthFullAccess)政策等許可。如需詳細資訊，請參閱[AWS Health 身分型政策範例](security_iam_id-based-policy-examples.md)。

------
#### [ Enabling organizational view (Console) ]

您可以從 AWS Health 主控台啟用組織檢視。您必須登入 AWS 組織的管理帳戶。

**檢視組織的 AWS Health 儀表板**

1. 在 https：//[https://health.aws.amazon.com/health/home](https://health.aws.amazon.com/health/) 開啟您的 AWS Health 儀表板。

1. 在導覽窗格中，**在您的組織運作**狀態下，選擇**組態**。

1. 在**啟用組織檢視**頁面上，選擇**啟用組織檢視**。

1. （選用） 如果您想要變更 AWS 組織，例如建立組織單位 (OUs)，請選擇**管理 AWS Organizations**。

   如需詳細資訊，請參閱「 AWS Organizations使用者指南」**中的 [AWS Organizations 入門](https://docs.aws.amazon.com//organizations/latest/userguide/orgs_tutorials_basic.html)。

**備註**  
當您啟用 AWS Health 組織檢視時，初始帳戶載入程序會在背景執行，可能需要幾分鐘的時間才能完成。您可以關閉 AWS Health 主控台，稍後再返回，因為您不需要等待程序完成。歷史運作狀態事件 （在您啟用此功能之前建立的事件） 最多可能需要 24 小時才會出現在您的組織檢視中。
 如果您有 AWS Business Support\$1、 AWS Enterprise Support 或 AWS Unified Operations 計劃，您可以呼叫 [DescribeHealthServiceStatusForOrganization](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeHealthServiceStatusForOrganization.html) API 操作來檢查程序的狀態。
當您啟用此功能時，具有 `Health_OrganizationsServiceRolePolicy` AWS 受管政策`AWSServiceRoleForHealth_Organizations`的服務連結角色會套用至組織中的管理帳戶。如需詳細資訊，請參閱[使用 的服務連結角色 AWS Health](using-service-linked-roles.md)。

------
#### [ Enabling organizational view (CLI) ]

您可以使用 [EnableHealthServiceAccessForOrganization](https://docs.aws.amazon.com/health/latest/APIReference/API_EnableHealthServiceAccessForOrganization.html) API 操作來啟用組織檢視。

您可以使用 AWS Command Line Interface (AWS CLI) 或您自己的程式碼來呼叫此操作。

**注意**  
您必須擁有 [Business](https://aws.amazon.com/premiumsupport/plans/business/)、[Enterprise On-Ramp](https://aws.amazon.com/premiumsupport/plans/enterprise-onramp) 或 [Enterprise](https://aws.amazon.com/premiumsupport/plans/enterprise) Support 計劃才能呼叫 AWS Health API。
您必須使用美國東部 （維吉尼亞北部） 區域端點。

**Example**  
下列 AWS CLI 命令會從您的帳戶啟用此功能 AWS 。您可以從管理帳戶或從可擔任具有必要許可之角色的帳戶使用此命令。  

```
aws health enable-health-service-access-for-organization --region us-east-1
```

下列程式碼範例會呼叫 [EnableHealthServiceAccessForOrganization](https://docs.aws.amazon.com/health/latest/APIReference/API_EnableHealthServiceAccessForOrganization.html) API 操作。

**Python**

```
import boto3

client = boto3.client('health', region_name='us-east-1')

response = client.enable_health_service_access_for_organization()

print(response)
```

**Java**

您可以針對下列範例使用適用於 Java 2.0 版的 AWS 開發套件。

```
import software.amazon.awssdk.services.health.HealthClient;
import software.amazon.awssdk.services.health.HealthClientBuilder;
 
import software.amazon.awssdk.services.health.model.ConcurrentModificationException;
import software.amazon.awssdk.services.health.model.EnableHealthServiceAccessForOrganizationRequest;
import software.amazon.awssdk.services.health.model.EnableHealthServiceAccessForOrganizationResponse;
import software.amazon.awssdk.services.health.model.DescribeHealthServiceStatusForOrganizationRequest;
import software.amazon.awssdk.services.health.model.DescribeHealthServiceStatusForOrganizationResponse;
 
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
 
import software.amazon.awssdk.regions.Region;
 
public class EnableHealthServiceAccessDemo {
    public static void main(String[] args) {
        HealthClient client = HealthClient.builder()
            .region(Region.US_EAST_1)
            .credentialsProvider(
                DefaultCredentialsProvider.builder().build()
            )
            .build();
 
        try {
            DescribeHealthServiceStatusForOrganizationResponse statusResponse = client.describeHealthServiceStatusForOrganization(
                DescribeHealthServiceStatusForOrganizationRequest.builder().build()
            );
 
            String status = statusResponse.healthServiceAccessStatusForOrganization();
            if ("ENABLED".equals(status)) {
                System.out.println("EnableHealthServiceAccessForOrganization already enabled!");
                return;
            }
 
            client.enableHealthServiceAccessForOrganization(
                EnableHealthServiceAccessForOrganizationRequest.builder().build()
            );
 
            System.out.println("EnableHealthServiceAccessForOrganization is in progress");
        } catch (ConcurrentModificationException cme) {
            System.out.println("EnableHealthServiceAccessForOrganization is already in progress. Wait for the action to complete before trying again.");
        } catch (Exception e) {
            System.out.println("EnableHealthServiceAccessForOrganization FAILED: " + e);
        }
    }
}
```

如需詳細資訊，請參閱 [適用於 Java 的AWS 開發套件 2.0 開發人員指南](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/)。

當您啟用此功能時，具有 `Health_OrganizationsServiceRolePolicy` AWS 受管政策`AWSServiceRoleForHealth_Organizations`[的服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html)會套用至組織中的管理帳戶。

**注意**  
啟用此功能是非同步程序，因此需要一些時間才能完成。您可以呼叫 [DescribeHealthServiceStatusForOrganization](https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeHealthServiceStatusForOrganization.html) 操作來檢查程序的狀態。

------