スタートアップでは少ない人数で最大限の価値を生み出す工夫をどの企業でも考えていらっしゃると思います。 アイデアが浮かんだらそれが成功するか失敗するかは、頭の中で考えていても分かりません。 まずは作って市場で試してみることから始めるということをスタートアップの皆様は実行されているはずです。 そのアイデアを実現するために AWS のサーバーレスがどのようにお役に立てるかお話ししたいと思います。
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Kensuke Shimokawa / _kenshSnr. Serverless SpecialistAmazon Web Services Japan G.K.スタートアップでよく作るこの機能、サーバーレスならこうやりますAWS Startup Tech Meetup 福岡Slides https://speakerdeck.com/_kensh/Qiita https://qiita.com/_kensh
View Slide
Kensuke Shimokawa / _kenshSnr. Serverless SpecialistAmazon Web Service Japan---work:- サーバーレス技術- 地域創⽣Slides https://speakerdeck.com/_kensh/Qiita https://qiita.com/_kensh趣味︓図書館のヘビーユーザー
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.ローカル x スタートアップ がサーバーレスを使うべき理由
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.ローカル x スタートアップ がサーバーレスを使うべき理由サーバーを管理している時間も労力もかけたくないビジネスに集中したい実験的な環境を手に入れたい
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.サーバーレスどうやって始めていくの?https://aws.amazon.com/jp/events/aws-event-resource/hands-on/
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.スタートアップでよく作るこの機能、サーバーレスならこうやります
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.UX を改善したい場合
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.API まわりで UX を悪くするケースEndpoint Endpoint時間のかかる処理アクセスが集中する バックエンド処理に時間がかかる
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.アクセスが集中するEndpoint処理202 Acceptedキューリクエストは⼀旦 202 Accepted でレスポンスされ、キューに⼊ったメッセージは⾮同期に処理される
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.バックエンド処理に時間がかかるEndpoint時間のかかる処理キュー202 Accepted時間のかかる処理は、⼀旦キューイングされてキューからメッセージを取得する別のサービスによって処理される
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.結果をどのように受け取るか• ユーザーアクション• 画⾯遷移時に取得• ボタンクリックなどのアクション• ポーリング• WebSocket
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.バックエンド処理に時間がかかるEndpoint時間のかかる処理キューWebSocket処理が終われば、処理プロセスがWebSocketを介してクライアントに結果通知を push する
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.バックエンド処理に時間がかかるEndpoint時間のかかる処理キューWebSocketAmazon API Gateway
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.バックエンド処理に時間がかかるEndpoint時間のかかる処理キューWebSocketAmazon API Gateway Amazon SQS
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.バックエンド処理に時間がかかるEndpoint時間のかかる処理キューWebSocketAmazon API Gateway AWS LambdaAmazon SQSAWS のサーバーレスサービスに当てはめると、Endpoint実装には API Gatewayキューイングには SQS、そして処理には Lambdaが使える
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.同期 API との共存Endpoint時間のかかる処理キューWebSocketAmazon API Gateway AWS LambdaEndpoint処理非同期同期Amazon SQS同期処理と⾮同期処理は、どちらかだけ利⽤するという感じではなく両⽅をアーキテクチャに組み込むことができる
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.サクッとWebhookしたい場合
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Webhook を投げる側AWS Step FunctionsExpress WorkflowAmazon API GatewayHTTPEndpointLambdafunction Amazon SNSAmazon EventBridgeLambdafunctionHTTPEndpoint⾮同期⾮同期⾮同期SubscriptionAPI DestinationHTTP Integrationimport requestsurl = 'https://example.com/'response = requests.get(url)同期retry rateretryrateauthauthDLQretryDLQ外部 API 呼び出しを⾮同期的に扱えないかwaiting…Round-triplatency
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Amazon EventBridge異なるチーム間の Push型での情報連携(イベント通知)を可能にするイベントバスAWS CloudAWS CloudAWS CloudAmazonEventBridge
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Webhook を投げる側function Amazon EventBridge⾮同期API DestinationSaaS や 別システムで公開している Webhook にメッセージを送信する際にEventBridge API Destinationが利⽤できる
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Webhook を受ける側functionURLSaaS や 別システムに設定するWebhook ⽤のAPI endpointが必要な場合AWS Lambda functionURLが利⽤できる
Web アプリケーションをAWS 上でサクッと動かしたい場合
AWS サービスを組み合わせてインフラを構築柔軟性が⾼いVPC (ネットワーク)Fargate (コンピュート)ECS (オーケストレーション)ALB (ロードバランサ)AWS Auto Scaling (オートスケール)CodeBuild (CI/CD)⼿間がかかる
構築済みのインフラにすぐにデプロイAWS App Runner
App Runner とはインフラや AWS についての経験がなくても、コンテナ化されたウェブアプリケーションや API を簡単かつ迅速に AWS 上で動かせるサービス
App Runner 上にウェブアプリケーションをデプロイApp RunnerGitHub動かしたいウェブアプリケーションを指定するGitHub Repo
App Runner 上にウェブアプリケーションをデプロイApp RunnerGitHubソースコードを取得コンテナイメージをビルドしてデプロイコンテナインスタンスロードバランサーネットワーク (VPC)App RunnerGitHub Repo
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
App Runner 上にウェブアプリケーションをデプロイコンテナインスタンスロードバランサーネットワーク (VPC)App Runnerエンドユーザー デフォルトドメインhttps://xxxxxxxx..awsapprunner.com
もっと 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
• 福岡のスタートアップが”できていること”を全国に展開したい福岡が例外的に特殊、から、他の地域でも当たり前に• AWS からの発信よりもスタートアップやコミュニティの発信の⽅が価値が⾼い“会場にこの後もいるので、話をさせてください。”• アイデアを素早く答え合わせするそのためにサーバーレスの実験的環境は便利さいごに – お伝えしたかったこと -
Thank you© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.Kensuke Shimokawa_kenshSlides https://speakerdeck.com/_kensh/Qiita https://qiita.com/_kensh
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.Appendix
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.#AWSBuildersFunctionURL bloghttps://itnext.io/using-aws-lambda-function-url-to-build-a-serverless-backend-for-slack-a292ef355a5d
AWS は幅広い選択肢を提供
AWS は幅広い選択肢を提供200 以上のサービス
AWS App Runner の主な特徴シンプルなオートスケーリング統合されたメトリクス・ロギング機能シンプルなセットアップ
App Runner 上にウェブアプリケーションをデプロイApp RunnerAmazon ECRImage Repo動かしたいウェブアプリケーションを指定する
App Runner 上にウェブアプリケーションをデプロイApp Runnerコンテナインスタンスロードバランサーネットワーク (VPC)App Runnerコンテナイメージを取得コンテナイメージをデプロイAmazon ECRImage Repo
App Runner - シンプルなオートスケーリングの設定オートスケールのしきい値となるリクエスト数コンテナインスタンスの最⼩数コンテナインスタンスの最⼤数デフォルトの設定値
オートスケールコンテナインスタンスロードバランサーネットワーク (VPC)App Runnerエンドユーザー デフォルトドメインエンドユーザーエンドユーザー
ログ・メトリクスロードバランサーApp Runner 開発者App Runner コンソールコンテナインスタンスログとメトリクスを⾃動で収集App Runner コンソールから確認
App Runner - Console でのログの閲覧⾃分でログエージェントを実装する必要なし
App Runner - Console でのメトリクスの閲覧リクエスト数、応答のレイテンシ、HTTP 2XX 4XX 5XX それぞれの数を App Runnerのコンソール画⾯で閲覧可能