【This is My Architecture3ヶ月チャレンジ-1】Met Office: Building an Entirely Serverless National Severe Weather Warning System on AWS

前々から樺沢紫苑さんの「アウトプット大全」を読んでアウトプットの重要性を理解したにも関わらず、全然アウトプットできていない。英語も勉強したい。じゃあ一緒にやっちゃえばいいじゃん！ということで無謀な計画を立ててみた。

# 目的
限られた時間で一気に以下をやりたい。

- 英語のDictationとShadowing(リスニングとスピーキングUP)
- AWSサービスの勉強と実例
- インプットとアウトプット

# 計画
毎日隙間時間で[This is My Architecture](https://aws.amazon.com/jp/architecture/this-is-my-architecture/?tma.sort-by=item.additionalFields.airDate&tma.sort-order=desc&awsf.category=*all&awsf.industry=*all&awsf.language=*all&awsf.show=*all)の動画を一本見て、Dictation, Shadowing, Qiitaで投稿をする。
This is My Architectureはあらゆる業界のAWSユーザが自分たちのビジネスを実現するために使用したAWSサービスとそのアーキテクチャを５〜１０分で紹介する。
Dictation, Shadowingは慣れないうちは時間がかかるので、これくらいの尺が続ける上でもちょうどいいのではないかと(←あとで激しく後悔orz)。

ランダムよりはテーマを決めて連続して同じ内容を見た方が記憶が定着するはず。
なのでまず最初はData Managementでビデオを絞る。

記念すべき第一回は
[Met Office: Building an Entirely Serverless National Severe Weather Warning System on AWS](https://www.youtube.com/watch?v=D_4dsXVqzMs)

# まずは１回聞いてみる

~メモここから(実際に聞きながらタイピングしてるので汚い)~
Met Officeの気象情報を提供するサイト？を提供。
24/7 AZ
General 
トラブル、
全てAWS
18ヶ月
warningをクイックに伝える必要がある。
まずCloud watchイベントでStep Functionをトリガー、Lmabdaをシーケンシャルにメッセージを作成。across reson regileiency,warningをS3にJOSNで保管。
PDF
mail sns , tect contentをLmadaで作成し、それらをuser prefenrenceとしてS3に保存
3rd party APIに渡す
Step functionを使った理由は？->初めてだったけど、わかりやすいし、シーケンシャルに動かせる
レジリエンしーはどうやって確保したの
Cros AZ, lambda, S3、 Lmbdaでreagionでactiveか確認
Performance 1st-> 1min
Cost, warningがあれば発行するし、何もなければ何もしない
5% real cost?
any other change for future?->SNS topic
~メモここまで~

全然聞き取れない、早い。。。

# Dictation

0.5倍速で聞き取ってみる(Stop, Replayを足で操作できるやつが欲しい。。)
Dictationの目的は、自分の耳が聞き取れない(=脳が認識できていない)単語やフレーズを認識するための作業。
YouTubeの字幕も見て何度も再生して耳で確かめつつ書き出していったから4時間くらいかかった。。。

~ここから~
Hi Im john and welcome to another sercvies "this is my architecture"。
Jon today by  from mEt office
maybe you can tell us a little more about what met office do.
Sure UK national weather climete service
we .. focus on 234/7/365 day to day public to media enforcd like goverment, a massive variety range of industory.
I am know you the siever warning system right?  
yeah
so could tell us a bit more about that?
Sure severe weather warning system is a way of alerting a general public and the various responder communities that there is a weather situation coming that may have a significant impact on their lives and that might range from travel disruption to power outage potentially to property damage or even to loss of life 
well pretty critical infrastructure right and this is all running on AWS
right ok so maybe you could take us through how this works.
Sure well this the bit we're gonna describe today is the dissemination of this information out specifically to out first responder community so we need to get our warnings out quite quickly to them that's the fire ambulance and to local goverments so they can get ready of their responses.
So what haapens here is we start the heart of this thing is our API that we've built recently which describes the current warning situation and we start the process of with a cloud watch event and this triggers a step functions. Step functions are effectively a state machine of Lambdas that go through a series of processes to create messages around warnings and then disseminate them out to our customers.
So the first thing the step function will do is it'll check to see if it's the active region because we have cross region resiliency so am i in the active region? if im in the active region,it'll come back to our API and see if there's a warning in it. Assuming there is a warning enforced at a particular moment in time, if there's no warning, this whole thins just stops.
we store the warning we store the state, there's a JSON object in an S3 bucket.
At that point, a number of step functions are kicked off, a number of Lambda which will do creation of some PDF artifacts as part this is a part of the products that we created a PDF that we send out the email content, some SMS content, text content, go through a series of steps creating that content then we'll retrieve file in S3 bucket, the customer preferences. so this is the resonse(respondent?) communitity describing how they want to receive it whether they want to receice SMS or email, any like that. The S3 is a store of preferences that have come from our on-premise system that is polled regulary to keep up-to-date and kept in sync. this is pull back these two datasets and merge together, we create a set of messeage that we fire out or a third party API to send out SMS, send out email.
Right ok. so if I understand you collectly it looks like pretty much the wholde orchestraiton is managed via step function, is that right? 
Yeah
and any particular reason why you ??? that?
so we we..step function was new to us, Im fairly new ?? best service when we came to this but we discovered that when we were looking at the process by which we want to create warnings, it was faily straighforward linearous? workflow  that could be perfectly managed by step functions.
what step functions give us, it gives up the orchestration of each of these steps managing inputs and outputs between each Lambds to create the syste.
okay, okay.
As we've already said this is obviously super critical infrastructure, how have you ensured resiliency here?
Resiliency, yeah. the serverless nature, we've got a cross AZ resiliency just by using the Lambda and the S3 kind of things but we've also got a cross regional resiliency in this particular system.
and　the first actually the first Lambda this thing is kicked off a check to see if it's the active region if it is, it will continue, if it's not if　it's a passive one, it will just go back to sleep and there's a time job wehre they communicate cross talk to each other to say I'm the active region and if they get that message, the other one become passive, if it doesnt get it after certain amout of time, it kicks up and become the active region.
right okay very good, so cross reagion resiliency and as you say cross AZ  because as you rightly point out you've got a serverless architecture here. Services themselves of course region-wide.
Any other benefits of that or any other particular reason you've gone with serverless architecture?
Two big reasons, performance is one, we had exisiting warning system in on-prem shared service environment which was occasionally competing all those highest priority job in those, in that sort of set of services, it was competing for resources so occasionally we could see that messaging taking up to 15 minutes for those messages to get out. this version, we are generally within a minute. the other one they are the big the big thing for us is cost.
warnings by their nature are active you know fairly quick notice but ?? times nothing's happening but we have to have a scale architecture who are ready to handle that on prem you know burning money when it wasn't doing anything. and we've managed to by doing this in serverless we've reduced the costs conservatively to be maybe  5% of what the old system cost is, yes.
wow, less than 5% of the old cost and of course that's because it's all consumption based charging?? services when they're idle here you are not really been charged okay.
right ok I think you mentioned as well that as as a whole new solution means that you are able to deliver messages much faster, is that right? yes absolutely.
we are getting that time down as I think I said earlier form the number 15 minutes tomaybe to one to two to max. 
so for the nature of the warning we are talking about that's obviously super important.
time is critical.
Okay, any other changes that you would be looking to make in future?
yeah I think over time we'll mature this solution, I think the cloud watch event is the starter for it rather than being sort of triggered timed polling job, I think it makes much more sense to use something like SNS topic to say actually we've just created a warning so that would save okay it would save a small amount of compute , that's actually going on here but everything counts.
the biggeset change is once we move our on-prem customer preferences  and customer systems out onto  cloud we'll be able to make this more of a real time checking rather having cached sort of store there.
well okay, so in sum, youve got a solution here that provise cross AZ cross region resiliency, massive reductions in cost, it's really impressive thanks very mush for sharing.
thank you for joining us on another episode of "this is my architecture".
〜〜ここまで〜〜

# やっとShadowing
Shadowingの目的は、Dictationで認識した単語やフレーズ、文章をそのままの形で理解できるようになること。
日本人がやりがちなのは、聞いた英語を脳で日本語の綺麗な文章に直して理解してしまう。
そうではなくて英語を聞いたらすぐ内容を理解できるようにする。それが出来ないと、英語を聞きながら"考える"ことが出来ず、結局聞き終わった後に質問や議論ができない。

ひたすらShadowing....３回くらいやる。

# 結論
無謀な計画に激しく後悔。