Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Yak shaving を避けながら AWS Fargateを使った話 / AWS Farg...
Search
OPTiM
October 24, 2019
Programming
1.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Yak shaving を避けながら AWS Fargateを使った話 / AWS Fargate without Yak shaving
OPTiM
October 24, 2019
More Decks by OPTiM
See All by OPTiM
IHV like なユースケースへのOpenID Connect 関連仕様の適用事例
optim
0
570
製品の問い合わせ負荷をLLMで解消したい 〜RAGで作る「自社を知っている」チャットボット〜
optim
0
40
AI エージェントシステムの開発を AI で加速させたい!
optim
0
43
既存プロダクトのRSpec カバレッジを 40% から100% にした話
optim
1
110
最近やってよかったデザインシステム運用改善3選
optim
1
370
<install>要素は何ができて、何を変えるのか
optim
1
320
CIでリグレッションテストを実行し継続的に品質を担保する
optim
1
360
Tanstack Startを触ってみての感動
optim
1
350
移行のつらさは誰が引き受けるのか── Vue.js と Next.js を比べて見えたこと
optim
2
350
Other Decks in Programming
See All in Programming
wkhtmltopdfの次どうするか問題2026
willnet
2
1.5k
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
200
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
730
スマート反転とウェブアクセシビリティ
camiha
0
210
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
210
cdk deploy JawsSonic #MARATHONしながらAWSリソースをデプロイしてみよう
akihisaikeda
2
140
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
150
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
220
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
610
Heart of Swift Concurrency
koher
0
910
Are APIs Still Relevant in the AI Era?
soyuka
0
270
Featured
See All Featured
Designing for Performance
lara
611
70k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Typedesign – Prime Four
hannesfritz
42
3.2k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
520
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
830
Scaling GitHub
holman
464
140k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
The Cult of Friendly URLs
andyhume
79
7k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
870
New Earth Scene 8
popppiees
4
2.6k
Transcript
Copyright © OPTiM Corp. All Right Reserved. Yak shaving を避けながら
AWS Fargateを使った話 Oct 24, 2019 株式会社 オプティム Takahashi
Copyright © OPTiM Corp. All Right Reserved. 2 高橋(Takahashi)
プラットフォーム事業部 DXユニット マネージャー SNS • Twitter:@yukey1031(ukitiyan) • Github:@ukitiyan • SlideShare: @ukitiyan(https://www.slideshare.net/ukitiyan) • Qiita: @ukitiyan(https://qiita.com/ukitiyan) 備考 • 2018/09 OPTiM入社(無事に1年経過!) • 好きなCIOSサービス:Messaging • Javaとサーバーレスを好む • 過去にマギーと呼ばれていた
Copyright © OPTiM Corp. All Right Reserved. 3
Copyright © OPTiM Corp. All Right Reserved. 4
Copyright © OPTiM Corp. All Right Reserved. 5 本題
Copyright © OPTiM Corp. All Right Reserved. 6 お話すること AWS
Fargate AWS CloudFormation
Copyright © OPTiM Corp. All Right Reserved. 7 キーワード ある問題を解決しようとするとそのためにまた別の問題が
発生する、ということが繰り返し起こる現象
Copyright © OPTiM Corp. All Right Reserved. 8 シナリオ(仮定) CIOSを活用しながらも
アプリのみ AWSにデプロイするDX案件 (期間限定だけど今すぐに) というシナリオ
Copyright © OPTiM Corp. All Right Reserved. 9 構成 Cloud
IoT OS ( CIOS ) App App App IdM App Cluster App App Messaging (Pub/Sub) FileStorage Streaming ここだけ AWSに Appは 若いメンバーが実装
Copyright © OPTiM Corp. All Right Reserved. 10 構成 Cloud
IoT OS ( CIOS ) App App App IdM App App Messaging (Pub/Sub) FileStorage Streaming AWSに Appをデプロイ
Copyright © OPTiM Corp. All Right Reserved. 11 Java,
Vue.js, PHP... で実装されたマイクロサービス前提のAppのデプロイに対 応する。 CIOSとの親和性は残したまま、本件に伴うApp カスタマイズは極力行わない。 一時的な公開となるため、極力サーバー運用に手を掛けない。 基本的にこの周辺は自分が行う。 • 若いメンバーはApp実装しながら、私の行動を見つめている。という妄想。。 考える事
Copyright © OPTiM Corp. All Right Reserved. 12 Fargate一択 なのは確か
AWS Fargate
Copyright © OPTiM Corp. All Right Reserved. 13 AWS構成 VPC
Availability Zone Availability Zone Public subnet Bastion Public subnet Private subnet Private subnet DT Web Sub App WebAPI Video Server DT App DB subnet DB subnet Ras Front
Copyright © OPTiM Corp. All Right Reserved. 14 先程の妄想。。
Copyright © OPTiM Corp. All Right Reserved. 15 何食わぬ顔で `シュっ`
とやりたい
Copyright © OPTiM Corp. All Right Reserved. 16 シュっとやる
Copyright © OPTiM Corp. All Right Reserved. 17 CloudFormationで `シュっ`
とやる Not Terraform
Copyright © OPTiM Corp. All Right Reserved. 18 AWS SamplesのCFテンプレートを活用
Amazon ECSおよびAWS CloudFormation(YAML)で コンテナー化されたマイクロサービスをデプロイするための リファレンスアーキテクチャ(Not Fargate)
Copyright © OPTiM Corp. All Right Reserved. 19 Fargateに対応する。
今回App用のServiceとAWSWaf, Bastion, RDS, S3等各種InfrastructureのCFテンプ レートをネストで実装する。 (AutoScalingも必要に応じて設定 BastionのCloud-InitでDDL, DMLの実行をする。 マイクロサービスに対応するために、ECS ServiceDiscovery、TaskRoleへの AWSXRayDaemonWriteAccessと各TaskへのxrayデーモンのサイドカーをCFテンプ レートに実装する。 既存のパイプラインを使いAppのDockerImageは所定のECRにプッシュされる前提。 対応事項 参照:
Copyright © OPTiM Corp. All Right Reserved. 20 aws
cloudformation create-stackコマンドでデプロイ実行。 環境構築 stack起動 20分 シュっと完成!!
Copyright © OPTiM Corp. All Right Reserved. 21 他にやっておくべきこと
Copyright © OPTiM Corp. All Right Reserved. 22 マイクロサービス前提なAppを 連携するための
サービスディスカバリー
Copyright © OPTiM Corp. All Right Reserved. 23 Amazon ECS
Service Discovery https://aws.amazon.com/jp/blogs/news/amazon-ecs-service-discovery/ App Mesh とは 統合しない
Copyright © OPTiM Corp. All Right Reserved. 24 ECS Service
Discovery Amazon Route 53 Hosted zone ECS(ServiceDiscovery) ECSServiceDiscoveryNamespace: Type: AWS::ServiceDiscovery::PrivateDnsNamespace Properties: Vpc: !Ref VPC Name: "showroom.local" Resources: ServiceDiscoveryRecord: Type: "AWS::ServiceDiscovery::Service" Properties: Name: ”dt-app” DnsConfig: NamespaceId: !Ref ECSServiceDiscoveryNamespace Route table showroom.local dt-app.showroom.local PrivateDNSにAレコードが追加され対象サービス に自動紐づけ
Copyright © OPTiM Corp. All Right Reserved. 25 サービス間の連携をトレースする 分散トレーシング
Copyright © OPTiM Corp. All Right Reserved. 26 AWS X-Ray
https://docs.aws.amazon.com/ja_jp/xray/latest/devguide/aws-xray.html App Meshは使わない
Copyright © OPTiM Corp. All Right Reserved. 27 X-Ray AWS
X-Ray Task App x-ray-demon <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-xray-recorder-sdk-spring</artifactId> <version>2.3.0</version> </dependency> @Aspect @Component public class XRayInspector extends AbstractXRayInterceptor { ... } e.g. Spring Appの場合 抜 粋
Copyright © OPTiM Corp. All Right Reserved. 28 マイクロサービス間のメトリクスを 収集、集計、要約
Copyright © OPTiM Corp. All Right Reserved. 29 Amazon ECS
Container Insights 因みに、CF未対応
Copyright © OPTiM Corp. All Right Reserved. 30 Amazon ECS
Container Insights 現在、AWS CloudFormation を使用して新しいクラスターを作成する場合、Container Insights を有効にすることはできません。 深追いせずに、AWS CLI のバージョン 1.16.200 以降で以下2コマンドで有効にする。 $ aws ecs put-account-setting --name "containerInsights" --value "enabled" $ aws ecs update-cluster-settings --cluster showroom ¥ --settings name=containerInsights,value=enabled
Copyright © OPTiM Corp. All Right Reserved. 31 サービス単位での部分リリース
Copyright © OPTiM Corp. All Right Reserved. 32 kayac/ecspresso
Copyright © OPTiM Corp. All Right Reserved. 33 kayac/ecspresso
面白法人カヤックさん から提供されているGo製のECSデプロイツール。 CloudFormationでのサービスのデプロイも可能だが、副次的に他サービス が更新されるリスクがあるため、サービス単体でデプロイ可能は幸せ。 AWS CLIのラッパーのため、CFでサポートされていないAPI(例えば FireLens)等の対応が先行する。 $ ecspresso init --region ap-northeast-1 --cluster rasshowroom ¥ --service webapi-service --config webapi.yaml $ ls ecs-service-def.json ecs-task-def.json webapi.yaml $ ecspresso deploy --config webapi.yaml ・init して deploy するだけでサービスの更新
Copyright © OPTiM Corp. All Right Reserved. 34 まとめ
Copyright © OPTiM Corp. All Right Reserved. 35 本質的に、どうすれば Yak
Shavingを避けられるか?
Copyright © OPTiM Corp. All Right Reserved. 36 ご清聴ありがとうございました!!
Copyright © OPTiM Corp. All Right Reserved. ‹#› © 2019
OPTiM Corp.