AWS Health Events を集約・可視化する AWS Health Events Intelligence Dashboard & Insights を作成してみた

2023.09.29

任意のリージョン、アカウント、組織の AWS Health Events を一つの AWS アカウントに集約し、ダッシュボードで可視化、通知が可能なソリューション AWS Health Events Intelligence Dashboard & Insights(以下、HEIDI)が提供されたため、さっそく作成してみることにしました!

サンプルダッシュボード画像を見ると、視認性が高く、良さげな感じです。


引用元:AWS Health Events Intelligence Dashboards & Insights

複数 AWS アカウントでの AWS Health Events を集約する方法としては AWS Health Dashboard 組織ビュー(Organizational View)が一般的な方法ですが、レイアウトが固定化されていることや委任先での管理出来るアカウント数などの制限があります。HEIDI では AWS Health API で、イベントデータを収集して QucikSight で可視化しているため、他 BI ツールでのダッシュボード化と同様にカスタマイズすることが可能です。

前置き

アーキテクチャ

2つの役割で、構成されているようです。

  1. 収集・可視化するアカウント: DataCollection Account
  2. 収集元アカウント: Member Account

上記1を管理アカウントに展開するなどの前提はなく Member Account で AWS Health Events が作成されると EventBridge を経由して、DataCollection 内の S3 へ集約され、Athena と QuickSight でダッシュボードとして可視化されます。


引用元:AWS Health Events Intelligence Dashboards & Insights

アーキテクチャ図からも読み取れるように、リージョン単位でデータ連携する仕組みを展開する必要がある点に注意が必要です。

作成手順

ソリューション作成手順は、下記 GitHub に記載されています。

前提条件

利用に際して、4つ条件があるようです。

  • AWS Health API が利用可能なサポートプランであること(23/09/29 時点ではビジネスサポート以上)
  • QuickSight へサインアップ済みであること
  • QuickSight から Athena をアクセスする権限があること
  • QuickSight SPICE に空き容量があること

引用元: GitHub - aws-samples/aws-health-events-insight

ソリューション作成

今回は、すぐに2つのアカウントを用意することが出来なかったため、1つのアカウントでソリューションを作成し、AWS Health Events を可視化していきます。

任意リージョンで CloudShell から GitHub からリポジトリをクローンします

$ git clone https://github.com/aws-samples/aws-health-events-insight.git
Cloning into 'aws-health-events-insight'...
remote: Enumerating objects: 827, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 827 (delta 37), reused 38 (delta 35), pack-reused 769
Receiving objects: 100% (827/827), 6.51 MiB | 17.45 MiB/s, done.
Resolving deltas: 100% (500/500), done.

作成スクリプトを実行(DataCollection 向け)

$ cd aws-health-events-insight/src
$ python3 OneClickSetup.py
Select Deployment option:
1. CentralAccount
2. MemberAccount 
Enter the number of your choice: 1
You selected: CentralAccount
Enter region name (Hit enter to use default: ap-northeast-1): ap-northeast-1
/usr/local/lib/python3.7/site-packages/boto3/compat.py:82: PythonDeprecationWarning: Boto3 will no longer support Python 3.7 starting December 13, 2023. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.8 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/
  warnings.warn(warning, PythonDeprecationWarning)
Enter S3 bucket name for Primary Region (Hit enter to use default: awseventhealth-653469730153-ap-northeast-1): awseventhealth-653469730153-ap-northeast-1══════════════════════════════════════════════
 (Optional) Overwrite input for Amazon Athena 
══════════════════════════════════════════════
Enter Amazon Athena query results bucket name (Hit enter to use default: aws-athena-query-results-* ):aws-athena-query-results-heidi
Note: If Amazon Athena query results/bucket is encrypted with KMS, you must provide KMS Arn here (Hit enter to skip): 
═════════════════════════════════════════════════════
 (Required) QuickSight User and Service Role Details 
═════════════════════════════════════════════════════
Enter QuickSight Service Role (Hit enter to use default: aws-quicksight-service-role-v0): 
Enter your QuickSight Identity region (Hit enter to use default: us-east-1): ap-northeast-1

Available QuickSight Users
1. arn:aws:quicksight:ap-northeast-1:111111111111:user/default/cm-sonobe.osamu/cm-sonobe.osamu

Enter the number corresponding to the QuickSight username from the list: 1
════════════════════════════════════════════════════════════════════════════════
 (Optional Features) Hit enter to select/skip default. e.g. (Y/N), N is default 
════════════════════════════════════════════════════════════════════════════════
Do you want to set up notification? (Y/N): N
Do you want to backfill healthevents? limited to the past 90 days (Y/N): Y
Do you want to set up eventUrl for easy access to event descriptions? (Y/N): Y
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Note: EventUrl will be accessible via APIGW with a resource policy resticting with IP range. Add additional authentication to APIGW post-setup as needed. 
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   Provide IP Range which can access these eventUrls, this could be your VPN range (Default 0.0.0.0/0): 
Do you want to enrich events with Tags? It requires access to centralized AWS Config S3 Bucket(Y/N): Y
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Note: To use this feature, you need a centralized S3 bucket receiving AWS Config snapshots from all accounts. See enrichEvent.md for more details 
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
   Enter AWS Config centralized BucketName: cm-members-111111111111

INFO: You must add following policy to cm-members-111111111111 bucket for QuickSight and Lambda Function(To create Glue partitions) to include Tagging info after this setup
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 {                                                                                                               
         "Sid": "S3 Access policy to read Config snapshots",                                                     
         "Effect": "Allow",                                                                                      
         "Principal": {                                                                                          
            "AWS": ["<Important::: Replace this with QS serviceRole ARN>",                                       
                    "arn:aws:iam::111111111111:role/GluePartitionUpdateLambda-111111111111-ap-northeast-1-Role"] 
         },                                                                                                      
         "Action": [                                                                                             
             "s3:GetBucketLocation",                                                                             
             "s3:GetObject",                                                                                     
             "s3:ListBucket",                                                                                    
             "s3:ListBucketMultipartUploads",                                                                    
             "s3:ListMultipartUploadParts",                                                                      
             "s3:AbortMultipartUpload"                                                                           
         ],                                                                                                      
         "Resource": [                                                                                           
             "arn:aws:s3:::cm-members-111111111111",                                                             
             "arn:aws:s3:::cm-members-111111111111/*"                                                            
         ]                                                                                                       
     }                                                                                                           
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════
continuing with Setup....
(Recommended)Open Support case and request AWS Support to dispatch mock event to test the setup?(N/Y): N

- 中略 -

Successfully created/updated stack - HeidiDataCollection-111111111111-ap-northeast-1 in ap-northeast-1

各項目を入力すると CloudFormation スタックが実行されます。 成功したメッセージが出力されるまでしばらく待ちます。

QuickSight ダッシュボード作成

QuickSight へログインし、ダッシュボード一覧へアクセスしますが、作成されていませんでした。(タイムラグがあるのか、設定不備なのか、、仕様なのか、、)

手動で作成して、データセットを更新します。

分析 >>> ファイル >>> 公開 >>> 新しいダッシュボードとして公開 >>> ダッシュボードの公開

作成されたダッシュボードへアクセスします。

ダッシュボード確認

サンプルで紹介されていたダッシュボードに近い、良さそうなダッシュボードが作成されました!

上段にある 「コントロール」 を利用すると表示内容にフィルターがかけられるようです。AWS アカウントやサービス、期間など便利そうです。

セットアップ中にあった EventUrl は、この部分になるようです。

URL へアクセスすると、マネジメントコンソールで見かける概要が表示されます。ログインせずに確認出来るのは良いですね。

検証出来なかったパターン

今回は、シングルアカウントで検証しました。 HEIDI は単体でも有用ですが、やはり複数アカウントや組織で利用するユースケースで、より効果が発揮されるかと思います。なので予習として、それぞれの設定方法を確認しておきます。

複数アカウントでの設定(Member Account)

Member Account への展開方法は、GitHub に記載があります。基本的には DataCollection で実行した内容と重複しますが、途中で DataCollection で作成された EventBridge イベントバスの ARN 入力が必要になるので、事前に控えておきましょう。

Select Deployment option:
1. CentralAccount
2. MemberAccount
Enter the number of your choice: 2

- 中略 - 

Enter the value for DataCollection Bus Arn: arn:aws:events:ap-northeast-1:111111111111:event-bus/DataCollectionBus-111111111111
Do you want to backfill healthevents. The data can only be retrieved for the last 90 days.(Y/N):Y

- 以下、略 -

異なる組織からのデータ収集

こちらも同様に、GitHub に記載があります。DataCollection Account に作成された. イベントバスのポリシーを修正する必要があります。

4. (Optional). To receive AWS Events from various AWS Organizations and Payers, you must update the permission policy for DataCollectionBus-{accountID} Event Bus.

Go to EventBridge Console and select Event Buses on your left. Select DataCollectionBus-{accountID} Event Bus. Select manage permission and add Organizational ID from other AWS Org. e.g. "aws:PrincipalOrgID": ["o-abcdef","o-jklmoprq"]

↓↓↓ 機械翻訳 ↓↓↓

4. (オプション)。様々な AWS Organizations や Payers から AWS Events を受信するには、DataCollectionBus-{accountID} の権限ポリシーを更新する必要があります。イベントバス

EventBridge Consoleに移動し、左側のEvent Busesを選択します。 DataCollectionBus-{accountID} を選択します。イベントバスを選択します。 権限の管理を選択し、他のAWS組織から組織IDを追加します:["o-abcdef","o-jklmoprq"]

本記事では、複数リージョン、アカウント、組織での AWS Health Events を集約・可視化する提供するソリューションである HEIDI を紹介しました。今までの Organizational View でも十分に状況把握が可能ですし、本ソリューションは QuickSight などの利用料が発生するため、HEIDI が唯一の選択肢とはならず、対象となるアカウントやイベント数の規模感やユースケースを考慮しながら、適材適所で採用することが良いかなと個人的には思います。