Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kensuke Shimokawa / _kensh Snr. Serverless Specialist Amazon Web Services Japan G.K. スタートアップでよく作る この機能、サーバーレスなら こうやります AWS Startup Tech Meetup 福岡 Slides https://speakerdeck.com/_kensh/ Qiita https://qiita.com/_kensh
Slide 2
Slide 2 text
Kensuke Shimokawa / _kensh Snr. Serverless Specialist Amazon Web Service Japan --- work: - サーバーレス技術 - 地域創⽣ Slides https://speakerdeck.com/_kensh/ Qiita https://qiita.com/_kensh 趣味︓図書館のヘビーユーザー
Slide 3
Slide 3 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. ローカル x スタートアップ が サーバーレスを使うべき理由
Slide 4
Slide 4 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. ローカル x スタートアップ がサーバーレスを使うべき理由 サーバーを管理している時間も労力もかけたくない ビジネスに集中したい 実験的な環境を手に入れたい
Slide 5
Slide 5 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. サーバーレスどうやって始めていくの? https://aws.amazon.com/jp/events/aws-event-resource/hands-on/
Slide 6
Slide 6 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. スタートアップでよく作る この機能、サーバーレスなら こうやります
Slide 7
Slide 7 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. UX を改善したい場合
Slide 8
Slide 8 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. API まわりで UX を悪くするケース Endpoint Endpoint 時間のか かる処理 アクセスが集中する バックエンド処理に時間がかかる
Slide 9
Slide 9 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. アクセスが集中する Endpoint 処理 202 Accepted キュー リクエストは⼀旦 202 Accepted でレスポンスされ、キューに⼊った メッセージは⾮同期に処理される
Slide 10
Slide 10 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. バックエンド処理に時間がかかる Endpoint 時間のか かる処理 キュー 202 Accepted 時間のかかる処理は、⼀旦キューイングされてキューからメッセージ を取得する別のサービスによって処理される
Slide 11
Slide 11 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. 結果をどのように受け取るか • ユーザーアクション • 画⾯遷移時に取得 • ボタンクリックなどのアクション • ポーリング • WebSocket
Slide 12
Slide 12 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. バックエンド処理に時間がかかる Endpoint 時間のか かる処理 キュー WebSocket 処理が終われば、処理プロセスがWebSocketを介してクライアントに 結果通知を push する
Slide 13
Slide 13 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. バックエンド処理に時間がかかる Endpoint 時間のか かる処理 キュー WebSocket Amazon API Gateway
Slide 14
Slide 14 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. バックエンド処理に時間がかかる Endpoint 時間のか かる処理 キュー WebSocket Amazon API Gateway Amazon SQS
Slide 15
Slide 15 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. バックエンド処理に時間がかかる Endpoint 時間のか かる処理 キュー WebSocket Amazon API Gateway AWS Lambda Amazon SQS AWS のサーバーレスサービスに当てはめると、Endpoint実装には API Gateway キューイングには SQS、そして処理には Lambdaが使える
Slide 16
Slide 16 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. 同期 API との共存 Endpoint 時間のか かる処理 キュー WebSocket Amazon API Gateway AWS Lambda Endpoint 処理 非同期 同期 Amazon SQS 同期処理と⾮同期処理は、どちらかだけ利⽤するという感じではなく 両⽅をアーキテクチャに組み込むことができる
Slide 17
Slide 17 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. サクッとWebhookしたい場合
Slide 18
Slide 18 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Webhook を投げる側 AWS Step Functions Express Workflow Amazon API Gateway HTTP Endpoint Lambda function Amazon SNS Amazon EventBridge Lambda function HTTP Endpoint ⾮同期 ⾮同期 ⾮同期 Subscription API Destination HTTP Integration import requests url = 'https://example.com/' response = requests.get(url) 同期 retry rate retry rate auth auth DLQ retry DLQ 外部 API 呼び出しを⾮同期的に扱えないか waiting… Round-trip latency
Slide 19
Slide 19 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon EventBridge 異なるチーム間の Push型での情報連携(イベント通知)を可能にするイベントバス AWS Cloud AWS Cloud AWS Cloud Amazon EventBridge
Slide 20
Slide 20 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Webhook を投げる側 function Amazon EventBridge ⾮同期 API Destination SaaS や 別システムで公開して いる Webhook にメッセージを 送信する際に EventBridge API Destination が利⽤できる
Slide 21
Slide 21 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Webhook を受ける側 functionURL SaaS や 別システムに設定する Webhook ⽤のAPI endpointが 必要な場合 AWS Lambda functionURL が利⽤できる
Slide 22
Slide 22 text
Web アプリケーションを AWS 上でサクッと動かしたい場合
Slide 23
Slide 23 text
AWS サービスを組み合わせてインフラを構築 柔軟性が⾼い VPC (ネットワーク) Fargate (コンピュート) ECS (オーケストレーション) ALB (ロードバランサ) AWS Auto Scaling (オートスケール) CodeBuild (CI/CD) ⼿間がかかる
Slide 24
Slide 24 text
構築済みのインフラにすぐにデプロイ AWS App Runner
Slide 25
Slide 25 text
App Runner とは インフラや AWS についての経験がなくても、 コンテナ化されたウェブアプリケーションや API を 簡単かつ迅速に AWS 上で動かせるサービス
Slide 26
Slide 26 text
App Runner 上にウェブアプリケーションをデプロイ App Runner GitHub 動かしたいウェブアプリケーションを指定する GitHub Repo
Slide 27
Slide 27 text
App Runner 上にウェブアプリケーションをデプロイ App Runner GitHub ソースコードを取得 コンテナイメージをビルドしてデプロイ コンテナインスタンス ロードバランサー ネットワーク (VPC) App Runner GitHub Repo
Slide 28
Slide 28 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Slide 29
Slide 29 text
App Runner 上にウェブアプリケーションをデプロイ コンテナインスタンス ロードバランサー ネットワーク (VPC) App Runner エンドユーザー デフォルトドメイン https://xxxxxxxx..awsapprunner.com
Slide 30
Slide 30 text
もっと AWS App Runner を知りたい⽅へ 公式ドキュメント https://docs.aws.amazon.com/apprunner/latest/dg/what-is-apprunner.html ブログ https://aws.amazon.com/jp/blogs/news/introducing-aws-app-runner/ ワークショップ https://www.apprunnerworkshop.com/ ロードマップ https://github.com/aws/apprunner-roadmap/projects/1
Slide 31
Slide 31 text
• 福岡のスタートアップが”できていること”を全国に展開したい 福岡が例外的に特殊、から、他の地域でも当たり前に • AWS からの発信よりもスタートアップやコミュニティの発信 の⽅が価値が⾼い “会場にこの後もいるので、話をさせてください。” • アイデアを素早く答え合わせする そのためにサーバーレスの実験的環境は便利 さいごに – お伝えしたかったこと -
Slide 32
Slide 32 text
Thank you © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kensuke Shimokawa _kensh Slides https://speakerdeck.com/_kensh/ Qiita https://qiita.com/_kensh
Slide 33
Slide 33 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. Appendix
Slide 34
Slide 34 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. #AWSBuilders FunctionURL blog https://itnext.io/using-aws-lambda-function-url-to-build-a-serverless-backend-for-slack-a292ef355a5d
Slide 35
Slide 35 text
AWS は幅広い選択肢を提供
Slide 36
Slide 36 text
AWS は幅広い選択肢を提供 200 以上のサービス
Slide 37
Slide 37 text
AWS App Runner の主な特徴 シンプルな オートスケーリング 統合された メトリクス・ロギング機能 シンプルな セットアップ
Slide 38
Slide 38 text
AWS App Runner の主な特徴 シンプルな オートスケーリング 統合された メトリクス・ロギング機能 シンプルな セットアップ
Slide 39
Slide 39 text
App Runner 上にウェブアプリケーションをデプロイ App Runner Amazon ECR Image Repo 動かしたいウェブアプリケーションを指定する
Slide 40
Slide 40 text
App Runner 上にウェブアプリケーションをデプロイ App Runner コンテナインスタンス ロードバランサー ネットワーク (VPC) App Runner コンテナイメージを取得 コンテナイメージをデプロイ Amazon ECR Image Repo
Slide 41
Slide 41 text
AWS App Runner の主な特徴 シンプルな オートスケーリング 統合された メトリクス・ロギング機能 シンプルな セットアップ
Slide 42
Slide 42 text
App Runner - シンプルなオートスケーリングの設定 オートスケールのしきい値 となるリクエスト数 コンテナインスタンスの 最⼩数 コンテナインスタンスの 最⼤数 デフォルト の設定値
Slide 43
Slide 43 text
オートスケール コンテナインスタンス ロードバランサー ネットワーク (VPC) App Runner エンドユーザー デフォルトドメイン エンドユーザー エンドユーザー
Slide 44
Slide 44 text
オートスケール コンテナインスタンス ロードバランサー ネットワーク (VPC) App Runner エンドユーザー デフォルトドメイン エンドユーザー エンドユーザー
Slide 45
Slide 45 text
AWS App Runner の主な特徴 シンプルな オートスケーリング 統合された メトリクス・ロギング機能 シンプルな セットアップ
Slide 46
Slide 46 text
ログ・メトリクス ロードバランサー App Runner 開発者 App Runner コンソール コンテナインスタンス ログとメトリクスを⾃動で収集 App Runner コンソールから確認
Slide 47
Slide 47 text
App Runner - Console でのログの閲覧 ⾃分でログエージェントを実装する必要なし
Slide 48
Slide 48 text
App Runner - Console でのメトリクスの閲覧 リクエスト数、応答のレイテンシ、HTTP 2XX 4XX 5XX それぞれの数 を App Runnerのコンソール画⾯で閲覧可能