5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

EventBridgeを使ってTransitGatewayに更新があったら通知する

Posted at

目的

TransitGatewayのルートテーブルが更新されたら関係各社に通知したい。

設定の背景

TransitGatewayのルートテーブル更新にて誤ったルートが追加されたものの、更新された事実が周知されておらず原因解決までに時間をかけた。あらかじめ設定して通知することで周知漏れをなくす。

前提条件

SNSトピックが作成済みであること。
Transitgatewayが作成済みであること。

実装方法手順

1.EventBridgでルールを作成し、Eventパターンを設定する。

image.png

eventNameでTransitgatewayのルートテーブル更新に関するイベントを指定する。

2.ターゲットの指定
ターゲットを指定し、事前に用意した通知先のSNSトピックを指定する。
image.png

トピックのみ指定した場合、読みづらい文章となるため、入力トランフォーマーを使って可読性の高い文章にする。

image.png

入力パス:定義された情報がsnsトピックに渡される情報。
入力テンプレート:入力パスで定義した変数の情報と日本語を組み合わせて出力するテンプレートを定義する。

以下、入力トランスフォーマーの組み合わせ

{
  "TransitGatewayAttachmentId": "$.detail.requestParameters.CreateTransitGatewayRouteRequest.TransitGatewayAttachmentId",
  "UserID": "$.detail.userIdentity.arn",
  "account": "$.detail.userIdentity.accountId",
  "cidrblock": "$.detail.requestParameters.CreateTransitGatewayRouteRequest.DestinationCidrBlock",
  "eventID": "$.detail.eventID",
  "eventname": "$.detail.eventName",
  "region": "$.detail.awsRegion",
  "tgw-routetable-id": "$.detail.requestParameters.CreateTransitGatewayRouteRequest.TransitGatewayRouteTableId",
  "time": "$.detail.eventTime"
}
"TransitGatewayのルートテーブルが更新されました。"

"イベント名 : <eventname>"
"イベントID : <eventID>"
"アカウントID : <account>"
"発生時刻 : <time>"
"変更作業実施者 : <UserID>"
"発生リージョン : <region>"
"TransitGatewayルートテーブルのID <tgw-routetable-id>"
"宛先CIDR : <cidrblock>"
"NexthopのTransitGatewayアタッチメントID : <TransitGatewayAttachmentId>"

メール出力例
image.png

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?