■Amazon SNSでメール通知を試してみる。
画面遷移は異なるが、今回やりたいことは以下と変わらない。
Amazon SNSでメールとSMS通知を飛ばす
https://www.blog.danishi.net/2019/06/02/post-1360/
■IAMでAmazonSNSFullAccessのポリシーを操作するユーザに追加。
AmazonSNSReadOnlyAccess
AmazonSNSRole
AWSElasticBeanstalkRoleSNS
AWSIoTDeviceDefenderPublishFindingsToSNSMitigationAction
■Amazon Simple Notification Serviceなので、シンプルに
名前、プロトコル、宛先アドレス以外はすべてデフォルトにすれば、
Publisher=発行者(今回は自分)がAmazon SNS経由でメール通知を行える。
SNS Topic名 :Email-Nortification
サブスクリプション
プロトコル :Email
エンドポイント:xxx@xxx.xxx
⇒エンドポイントとなるEMailの受信箱の確認リンクで認証して、
「メッセージの発行」ボタンから、件名、本文を入れたら送信出来る。
■graph-easy/dotの図について
Google Cloud Shellにgraph-easyとgraphvizをインストール
※セッションが切れるまでとはいえ、ローカルと変わらない感覚で操作できる、
Google Cloud Shellの方が使いやすいのだけど、どうしようw。。。
$ lsb_release -d
Description: Debian GNU/Linux 10 (buster)
$ apt-cache search graph-easy
libgraph-easy-as-svg-perl - Perl module to output a Graph::Easy as Scalable Vector Graphics
libgraph-easy-perl - Perl module to convert or render graphs (as ASCII, HTML, SVG or via Graphviz)
$ sudo apt-get install -y libgraph-easy-perl graphviz
$ dot -V
dot - graphviz version 2.40.1 (20161225.0304)
$ graph-easy --version
Graph::Easy v0.76 (c) by Tels 2004-2008. Released under the GPL 2.0 or later.
Running under Perl v5.028001 and using Graph::Easy::As_svg v0.27.
$ echo '[Publisher] --> [SNS Topic] --> [Subscription] --> [E-Mail] (Amazon SNS:[SNS Topic],[Subscription])' | graph-easy --dot | dot -T png -o SNS.png
■テキスト版はおそらく表示が崩れる。
$ echo '[Publisher] --> [SNS Topic] --> [Subscription] --> [E-Mail] (Amazon SNS:[SNS Topic],[Subscription])' | graph-easy
+ - - - - - - - - - - - - - - - - - -+
' Amazon SNS: '
' '
+-----------+ ' +-----------+ +--------------+ ' +--------+
| Publisher | --> ' | SNS Topic | --> | Subscription | ' --> | E-Mail |
+-----------+ ' +-----------+ +--------------+ ' +--------+
' '
+ - - - - - - - - - - - - - - - - - -+
■更に余談になるけど、Google Cloud Shellにもawscliが入る。
$ sudo apt-get install -y awscli
$ aws --version
aws-cli/1.16.113 Python/3.7.3 Linux/5.4.49+ botocore/1.12.103