shd-notifierをセットアップしようとしたメモ。
- リージョン規模の障害が発生した時に Service Health Dashboard から障害情報の通知を受け取る方法
- AWS サービスヘルスダッシュボードの通知機能を実装する方法を教えてください。
- https://github.com/aws/aws-health-tools/tree/master/shd-notifier
- AWS Health APIを AWS SDK For Pythonから使ってみる
手順
クローンする。2行目のコマンドはサブディレクトリを新たなルートにしている。
git clone https://github.com/aws/aws-health-tools.git && cd aws-health-tools git filter-branch --subdirectory-filter shd-notifier/ HEAD
マネコンから東京リージョンにSNSトピックを作成し、Eメールでサブスクライブしておく。
東京リージョンにCloudFormationでデプロイする。
ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) aws cloudformation deploy \ --stack-name ShdNotifier \ --template-file shd-notifier.yml \ --parameter-overrides ChatClient="sns" \ EndpointArray="[arn:aws:sns:ap-northeast-1:${ACCOUNT_ID}:shd-notifier-topic]]" \ Bail=0 \ DEBUG=1 \ --capabilities CAPABILITY_NAMED_IAM
この時点で各Lambda関数は中身がない。
deploy.sh
を実行する
deploy.sh Health-Event ap-northeast-1
Lambda関数がデプロイされる。
Bail=0
としたので15分でメールが来るはず。
しかしメールが来ない。
関数のログを見ると、以下のエラーが発生しており、どうやらHealth APIを実行しているため、ビジネス以上のサポートがないとダメな模様。
[ERROR] ClientError: An error occurred (SubscriptionRequiredException) when calling the DescribeEvents operation: Traceback (most recent call last): File "/var/task/index.py", line 77, in lambda_handler maxResults=maxEvents File "/var/runtime/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name)