Upgrade to Pro — share decks privately, control downloads, hide ads and more …

サーバーレスで楽しよう!お気軽に始められる3つのポイント / Have fun with Se...

kensh
February 01, 2025

サーバーレスで楽しよう!お気軽に始められる3つのポイント / Have fun with Serverless!

地方企業特有の課題である「IT人材不足」と「コスト制約」。これらの課題に対して、サーバーレスアーキテクチャは心強い味方となります。本セッションでは、従来型のサーバー運用と比較しながら、サーバーレスサービスを活用する際にブロッカーとなりうる3つの要素をお気軽に始めれる方法をご紹介します。サーバーレス初心者でもすぐに実践できる、シンプルで効果的な活用方法をお伝えします。

kensh

February 01, 2025
Tweet

More Decks by kensh

Other Decks in Technology

Transcript

  1. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 1 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. お気軽に始められる3つのポイント Kensuke Shimokawa J A W S - U G 栃 木 # 0 立 ち 上 げ 回 ! Snr. Serverless Specialist Amazon Web Services Japan サーバーレスで楽しよう!
  2. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 2 Kensuke Shimokawa Amazon Web Services Japan Snr. Serverless Specialist Slides https://speakerdeck.com/_kensh Qiita https://qiita.com/_kensh
  3. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 3 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 楽ができるコンセプトの理解
  4. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 4 ビジネスロジックに集中したい ビジネス ロジック サービス キャッシュ Layer7防御 アクセスログ スロット リング メトリックス 認証認可 CICD パイプライン カナリア リリース Amazon Cognito Amazon API Gateway AWS WAF AWS CodePipeline Amazon API Gateway Amazon CloudWatch Amazon API Gateway Amazon CloudWatch
  5. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 5 サーバーレスによる代表的な効果 サーバー管理が不要 (準備、OS保守) 柔軟なスケーリング (拡張/縮退) ⼗分に考慮された ⾼可⽤性 アイドル時の リソース確保が不要 $ マネージド ⾃動リソース管理 コスト最適化 スケーラビリティ (機会損失防⽌) リアルタイム (付加価値/機能差別化) ⾼⽣産性 変更容易性 マネージド 業務注⼒ エンジニア 意識改⾰ 実際の処理負荷に応じて ⾃動で拡張/縮退 ユーザーの責任領域を ⼩さくしそこだけに注⼒
  6. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 6 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. サーバーレスにおけるブロッカー
  7. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 7 サーバーレスのよくあるブロッカー 開発手法に関する戸惑い 既存のWEB フレームワーク の利⽤が難しい 推測が難しいコスト⾒積もり
  8. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 8 この3つのポイント お気軽に始めたい!
  9. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 9 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 開発⼿法や運⽤に関する⼾惑い
  10. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 10 • 既存のファイルシステムが使いたい • コンテナでパッケージングしたい • 既存のWEB フレームワークを使いたい • インフラチームとアプリチームの関係性が変わる? • スケール規模がわからなくて予算獲得が難しい 開発手法や運用に関する戸惑い
  11. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 11 • 既存のアプリケーションやフレームワークが、ファイルシステム前 提につくられている • 対向システムがファイル送信やコピーを前提として動作する • 開発者がファイルシステム以外のストレージタイプに慣れていない なぜファイルシステムが使いたいのか?
  12. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 12 AWS Lambda で利用できる代表的な ストレージ Amazon Elastic File System (Amazon EFS) Amazon Simple Storage Service (Amazon S3) /tmp 容量:512 MB AWS Lambda 容量:無制限 容量:無制限 〜 10240 MB ※ 512MB 超はGB-秒あたり0.000000037USD 従来のファイルシステム オブジェクトストレージ ※ AWS SDK でのアクセス /mnt
  13. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 13 • フレームワークのサイズが大きく、パッケージサイズを 250MB 以上 にしたい • AWS のコンテナサービスとパッケージ管理手法を統一したい • 開発者がコンテナでのアプリケーション開発に慣れている なぜコンテナでパッケージングしたいのか?
  14. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 14 AWS Lambda で利用できるパッケージ手法 ZIP パッケージ AWS Lambda AWS Lambda コンテナ パッケージ 最大パッケージサイズ:250 MB 最大パッケージサイズ:10 GB
  15. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 15 パッケージタイプによるデプロイの流れ 開発者 開発者からみた テスト・ビルドパイプラインの様式を コンテナの開発スタイルに統一できる コーディング AWS Lambda 最⼤ 250MB 最⼤ 10GB ビルドパイプライン コンテナビルド ZIP ビルド ZIPパッケージ コンテナイメージ Registry ※ Amazon Elastic Container Registry (Amazon ECR) のみが利用可能 Bucket コード リポジトリ
  16. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 16 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 既存のWEB フレームワークの利⽤
  17. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 17 • 慣れ親しんだ開発体験を継続したい • 開発経験者の確保が容易 (e.g. Ruby on Rails / Laravel ) • ポータビリティのため • Amazon ECS などのコンテナサービスや、Amazon EC2 上のコンテナ環境と の Artifact ポータビリティの確保 • 同じコンテナイメージを各種サービスで動かしたい 既存の WEB フレームワークをなぜ利用したいか?
  18. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 18 既存のフレームワークを Lambda に持ち込みたい API Gateway Function URL Application Load Balancer Web App Event out request response Lambda 固有のイベントを標準の HTTP リクエストに変換 aws-lambda-web-adapter Lambda Event HTTP Event in https://github.com/awslabs/aws-lambda-web-adapter invoke invoke invoke
  19. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 19 なぜ全てのリソースをインフラと考えたいのか? [前提] • 組織の体制上、アプリケーションチームとインフラチームに分かれている ※ 開発チーム、保守チーム、基盤チームと分かれている場合もある [よくある課題] • API Gateway, Lambda といったサーバーレスリソースも、インフラチームや基盤 チームのリソース管理下にある • リソース払い出しの申請や、設定変更の申請が必要など、既存のインフラ管理の 手法を継続している • 既存のリソース管理手法に引きずられてアジリティが出ない
  20. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 20 リソースは誰の持ち物? App runtime Middleware OS VM Serverless • ネットワーク • ストレージ • ネットワーク • ストレージ 抽象度 抽象度 App runtime Middleware OS 基盤チーム 払い出し アプリチーム 権限範囲
  21. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 21 サービス機能はすべてアプリチーム管理 App runtime Middleware OS VM Serverless • ネットワーク • ストレージ 抽象度 抽象度 App 基盤チーム 払い出し アプリチーム 権限範囲 関心事の外 アプリチーム 権限範囲 可観測基盤 アカウント統制 基盤チーム ガードレール セキュリティ統制 認証統制
  22. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 22 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. 推測が難しいコスト⾒積もり
  23. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 23 アンケートによると、、 0.0% 5.0% 10.0% 15.0% 20.0% 25.0% 30.0% 35.0% 40.0% 信頼性や障害対応に不安がある RDBを利⽤したいのでサーバーレスに躊躇している、… 開発パートナーが周りにいない 決定者層の理解が不⾜している コスト⾒積もりが難しい 社内にエンジニアがいない 開発体制や進め⽅に不安がある ※ AWS サーバーレスセミナー出典
  24. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 24 サーバーレスの利⽤費の構造 サーバー確保型 サーバーレス • 処理量を予測して 環境を確保 • 確保分の課⾦ • 使わないときは (意識して)解放 • ⾃分で冗⻑化 • 処理要求に応じて ⾃動で環境を確保 • 負荷なし = ゼロ課⾦ • ms 単位の実⾏時間 課⾦(AWS Lambda) • ⾃動で冗⻑化 負荷 課⾦
  25. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 25 • 利点 • クラウド利用費の適正化 • 初期投資が小さい(または ゼロ) • 万が一利用者がつかない自体になってもサーバー維持費がないため、ランニングの費用 が発生しにくい • 企画承認を加速化 • 上記理由により、サービス維持のための費用上の懸念が小さく、チャレンジしやすい • 懸念 • 見積もり/費用予測が難しい? サーバーレスの課金体系がもたらすこと
  26. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 26 • 概算見積もり • プロジェクト企画、検証フェーズに進むための予算感の把握 • 欲しいのはこんなレベル? • 正式見積もり: 本番稼働および今後の費用予測のための計算 欲しい見積もりは? 会員制 ECサイト • アクティブ会員 100,000 • Weekly でクーポンを発⾏ → ⽉額で $1,000? $10,000? IoT バックエンド • デバイス 50,000 機器が接続 • 利⽤者はアプリからコマンド操作 → ⽉額で $1,000? $10,000? 初年度 : $xx,000 次年度 : 初年度の 30% 成⻑で $yy,000
  27. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 27 サーバーレスの費用見積もりは難しいのか? 過去の経験で知っていること ⼀定レベルの負荷を 処理可能な台数 今回の負荷の規模 単純な計算 設計もこれからの時期に、こんなこと聞かれても… AWS サービスごとの 費⽤計算パラメータ 利⽤する AWS サービスの数 AWS サービスごとの 費⽤計算ロジック ルールが複雑 従来型アプリケーションの⾒積もり サーバーレスアプリケーションの⾒積もり
  28. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 28 では、どうすれば見積もれるのか? https://aws.amazon.com/jp/cdp/ec-serverless/ 要件 EC サイト アクティブ会員 50,000 「会員制 Web サイト」の例より - 本ページ下⽅にある計算詳細はひとまず 無視して、結果だけ利⽤する - アクティブ会員 10,000 → 約 $200/⽉ $200 ✕ ( 50,000 ÷ 10,000 ) = $1,000 ※ あくまで概算⾒積もりです クーポン配信やセールスキャンペーン などの施策をうつケースでは追加の 考慮が必要となります
  29. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 29 概算と精緻な見積もりに対する戦略 • 類似ケースの費⽤感をもとに算出 • AWS 営業に相談 概算 ⾒積もり • パイロットでの実利⽤費を もとに算出 正式 ⾒積もり パイロット実施 • 典型的な構成パターンで実施 • ⽬的 - 実現可能性の確認 - 基礎データの取得
  30. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 30 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. まとめ
  31. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 31 • 開発手法に関する戸惑い • コンテナによるパッケージングや、普及している WEB フレームワークを持 ち込む方法が充実してきている。 • 推測が難しいコスト見積もり • 概算見積もりをしておき、早めにパイロットでの実績費用を確認する。その 後正式見積もりを。 まとめ