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

クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用

クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用

クラウドを「サーバーが生えてくる場所」として使うだけでは、その真価は発揮できません。本セッションでは、クラウドネイティブな開発における「認知負荷の削減」をテーマに、コンテナがどのように開発をラクにするかを解説します。

具体的には、以下のトピックを扱います。

- クラウドネイティブな開発とは何か — 疎結合による認知負荷の低減
- テスト容易性 — Testcontainers 等を活用した信頼性の高いテスト(決定性・堅牢性)の構築
- デプロイ容易性 — コンテナの可搬性を活かした「一度ビルド、全環境デプロイ」の実現
- 機能フラグ(AWS AppConfig)によるデプロイとリリースの分離
- CI/CD による自動化されたデリバリープロセス

Avatar for Masatoshi Hayashi

Masatoshi Hayashi

April 20, 2026

More Decks by Masatoshi Hayashi

Other Decks in Technology

Transcript

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

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. クラウドネイティブな開発 認知負荷に⽴ち向かうためのコンテナ活⽤ 林 政利 こ れ か ら 始 め る A W S の コ ン テ ナ サ ー ビ ス 活 ⽤ コンテナ スペシャリストソリューションアーキテクト アマゾン ウェブ サービス ジャパン合同会社
  2. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. ⾃⼰紹介 SIer フリーランス Java/Ruby 開発者 Kubernetesインフラ設計 (Web 企業) Containers SA, Support Engineer (クラウド製品ベンダー) AWS Japan Containers SA 林 政利, @literalice Specialist Solutions Architect, Containers / AWS Japan 2
  3. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. セッションのゴール • クラウドをうまく使う開発 – クラウドネイティブについて知る • 「サーバーが⽣えてくる場所」ではないクラウド開発 • コンテナが開発をどうラクにするかを理解する • テストとデプロイのつらさをコンテナがどう減らすのかを掴む • 明⽇から始められる具体的なプラクティスを持ち帰る • Testcontainers、CI/CD、機能フラグなど、すぐ試せるものを知る 3
  4. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. アジェンダ クラウドネイティブな開発とは クラウドネイティブと認知負荷 クラウドネイティブな開発のプラクティスとコンテナ活⽤ テスト容易性 – 信頼性の⾼いテスト デプロイ容易性 – 信頼性の⾼いデプロイ 4
  5. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. クラウドネイティブな開発とは 5
  6. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブな開発とは 6 クラウドを単なるサーバーが⽣えてくるプラットフォームとして使うのではなく、 クラウドが提供する機能をネイティブに利⽤する開発
  7. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドの特性を活かすことで⽣産性が向上 7 • ソフトウェアのデリバリーと運⽤のパフォーマンス • クラウドを単に使うだけでは効果が薄い • フレキシブルなインフラ – コンテナやサーバーレスを活⽤することで、⽣産性が向上する Flexible infrastructure is key to success – State of DevOps 2023
  8. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブな開発の効果 8 • ⾼パフォーマンス組織 (上位 18%) • 変更 / 1⽇に数回 (On Demand) • 変更が失敗する割合 / 5% • 復旧に要する時間 / 1時間以内 • 低パフォーマンス組織 (下位 17%) • 変更 / 1週間から1ヵ⽉に1回 • 変更が失敗する割合 / 64% • 復旧に要する時間 / 1ヵ⽉-6ヵ⽉ アジリティと安定性は両⽴する Software Delivery Performance – State of DevOps 2023
  9. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. クラウドネイティブと認知負荷 9
  10. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブと疎結合 10 仮想マシン OS ⾔語ランタイム プロセス アプリケーションコード パッチ ハードコード IP、ファイルパス、etc. NIC & IP 設定ファイル 開発 インフラ マシンの IP、ファイルパス、OS、⾔語ランタイム、etc の伝達 構築
  11. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブと疎結合 11 App App Java App Server Ruby Rails インフラ 開発 Python Flask Maven Capistrano SSH デプロイ、 更新⽅法の連絡 ホスト ホスト ホスト App アプリケーションごとに環境と デプロイ⼿順を⽤意
  12. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブと疎結合 アプリケーションの前提条件を減らす = ローコンテキスト 12 仮想マシン OS ⾔語ランタイム プロセス アプリケーションコード パッチ 設定 IP、ファイルパス、etc. 開発 インフラ 構築 インフラの前提条件を減らす CIDR/IP 固定 (サブネット固定、L2 延伸、etc.) アプリケーションごとの設定ファイルを配置
  13. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブと疎結合 アプリケーションの依存関係を全てパッケージ = 前提条件を減らす = ローコンテキスト 13 仮想マシン OS ⾔語ランタイム アプリケーション ⾔語ランタイム アプリケーション 仮想マシン上のサービス コンテナでのサービス Hypervisor コンテナアプリケーション OSライブラリ 仮想マシン Hypervisor 開発チームの コントロールが 必要な範囲 開発チームの コントロールが 必要な範囲 Linux カーネル インフラチームの コントロールが 必要な範囲 インフラチームの コントロールが 必要な範囲 認知負荷が⾼い 認知負荷が低い
  14. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 認知が必要な領域を⼩さくする 14 コンテナ ⾔語ランタイム アプリケーション スケーリング アプリケーションコード デプロイフロー 監視 Fargate 基盤 Linux カーネル パッチ コンテナ ⾔語ランタイム アプリケーション ... クラウド利⽤者の 責任範囲 クラウド提供者の 責任範囲 OSライブラリ OSライブラリ
  15. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. クラウドネイティブ開発の プラクティスとコンテナ活⽤ 15
  16. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. クラウドネイティブな開発におけるキーファクター 開発⽣産性が⾼い組織とそうでない組織を分ける要因 16 テスト容易性 デプロイ容易性 Lean と DevOps の科学 p75
  17. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. テスト容易性 - 信頼性の⾼いテスト 17
  18. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. テストを⾃動化しただけではテスト容易性につながらない 効果的な⾃動テストの特徴 18 • 信頼性の⾼いテスト • 開発者主体で作成されたテスト Lean と DevOps の科学 パフォーマンスの⾼い組織の効果的なテストの特徴
  19. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 信頼性が⾼いテスト テストに通ればリリースできるし、通らなければリリースできない 19 • テストの決定性 • 同じテストを実⾏すれば毎回結果が同じになる • テストの堅牢性 • 内部実装を変更しても外部仕様が同じなら結果は同じになる 信頼性が⾼くないテスト テストが通ってもリリースできるとは限らない テストに通ってなくてもリリースできることもある
  20. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 信頼性が低いテスト 決定性と堅牢性が低い例 20 • 決定性が低いテスト • テスト実⾏で副作⽤が残るテスト (前回実⾏したテストのデータなど) • 外部の API に依存したテスト • 堅牢性が低いテスト • 環境に依存したテスト • テスト環境と本番環境で異なるデータベースを利⽤ • 内部実装に依存したテスト • UIの詳細 (DOMやCSS構造など) • プライベートな関数の詳細
  21. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 良いテストピラミッドを構築するために 21 信頼性の⾼いテストスイートの構築 決定性、堅牢性を⾼くしやすい 決定性、堅牢性を⾼くしにくい 信頼性が⾼いテスト
  22. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 信頼性の低い、開発が主体でないテストは認知負荷が⾼い 22 テストと認知負荷 アプリケーション 信頼性の低いテスト 三ヶ⽉前のコードが原因のエラー リファクタリングしたら壊れる CI 「何回かリトライしたら通るかも」 「このテストはいつも失敗するので対処しなくてもリリースできる」 テストに対する認知負荷の増⼤、リリースの品質低下
  23. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. アプリケーションを疎結合に保つ必要がある 23 信頼性の⾼いテストのための技術 • 依存関係の逆転 • コンテナによる依存関係の注⼊ • コマンドとクエリの分離 (Command Query Separation, CQS) • コマンドとクエリの責任分離 (Command Query Responsibility Segregation, CQRS) サービス 通知仕様 メール送信実装 通知モック アプリケーションコード メールサーバー 依存関係の逆転
  24. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. コンテナによるテスト信頼性 – テスト実⾏環境 コンテナ内でテスト実⾏することで、決定性を向上させる • コンテナは起動が早く、かつエフェメラル • 前回のテストの残骸に影響されない • 「さっきは通ったのに今は落ちる」を減らす AWS CodeBuild ビルドごとに新しいコンテナが起動し、完了後に破棄。 CI 環境の再現性をコンテナで実現。 コンテナ 起動 テスト 実⾏ コンテナ 破棄 毎回クリーンな状態からテスト を実⾏
  25. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. コンテナによるテスト信頼性 – 本番 モックやインメモリ DB ではなく、本番と同じソフトウェアをコンテナで起動してテストする 従来のアプローチ モック / スタブ 本物の挙動を再現できない インメモリ DB 機能⾯で本番 DB と 異なる部分がある コンテナによるアプローチ アプリケーション テスト対象 PostgreSQL 本番同等の DB Redis 本番同等のキャッシュ Testcontainers などのライブラリで、テストコードからコンテナを起動・管理 The Twelve-Factor App ̶ X. 開発 / 本番⼀致 「バックエンドサービスの違いは、わずかな⾮互換性が顕在化し、 開発環境やステージング環境では正常に動作してテストも通過するコードが 本番環境でエラーを起こす事態を招く」
  26. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. デプロイ容易性 - 信頼性の⾼い デプロイ 26
  27. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 認知負荷が⾼く、容易ではないデプロイ 27 App App Java App Server Ruby Rails インフラ 開発 Python Flask Maven Capistrano SSH デプロイ、 更新⽅法の連絡 ホスト ホスト ホスト App アプリケーションごとに環境と デプロイ⼿順を⽤意
  28. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. コンテナによるデプロイで認知負荷を低減 「コンテナをデプロイする」という認知で済む 28 コンテナ ホスト コンテナ ホスト コンテナ ホスト インフラ App Java App Server 開発 コンテナ App Ruby Rails コンテナ App Python Flask コンテナ 責任分界点 App App Java App Server Ruby Rails インフラ 開発 Python Flask Maven Capistrano SSH デプロイ、 更新⽅法の連絡 ホスト ホスト ホスト App
  29. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. ⾃動化されたデプロイ – CI/CD のイメージ 信頼できる⾃動化されたデリバリープロセスにより、開発に集中できる状況を作る 開発者がコードを随時リポジトリの メインラインにチェックイン チェックインしたら信頼できる ⾃動化プロセスが本番環境へデリバリー 開発者はすぐに開発に戻り、 コードをチェックインしつづける 29 コードリポジトリ メインライン デリバリープロセス コードのチェックイン 開発者
  30. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 環境ごとのビルドが⽣むリスク ソースコード 同⼀のコード ビルド #1 開発環境 ビルド #2 ステージング ビルド #3 本番環境 ビルドのたびに成果物が異なりうる 依存ライブラリのバージョン差異 OS ・ビルドツールのバージョン差異 「ステージングでは動いたのに本番で動かない」 Twelve-Factor App ̶ V. ビルド、リリース、実⾏ ビルドステージで作られた成果物を変更してはならない 環境ごとにビルドし直す = 成果物の同⼀性が保証されない
  31. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. コンテナによる可搬性 コンテナランタイムさえ動いていればどこでも動く 31 コンテナランタイム OS ライブラリ アプリケーション コンテナ 開発者ラップトップ OS ライブラリ コンテナイメージ アプリケーション コンテナランタイム OS ライブラリ アプリケーション コンテナ 検証環境 コンテナランタイム OS ライブラリ アプリケーション コンテナ 本番環境
  32. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. ⼀度ビルドしたコンテナイメージを全環境にデプロイする ビルド イメージを 1 回だけ作成 レジストリ イメージを保管 開発環境 同⼀イメージ ステージング環境 同⼀イメージ 本番環境 同⼀イメージ テストしたものと 本番で動くものが同⼀ jar/war はアプリのみだが コンテナは OS ・ランタイム・ ライブラリまで含めて固定 環境差異が⼊り込む余地を 最⼩化
  33. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. コンテナ開発を阻害するデプロイとリリースの結合 デプロイと同時に機能がリリースされてしまう場合、環境ごとにビルドを⽤意しなければならない コードリポジトリ 本番環境⽤のコードベース 開発環境⽤のコードベース デプロイ = リリース デプロイとともに、開発中の 機能がリリースされてしまう そのため、リリースできない機能を コードベースごと分ける 開発環境 本番環境 レジストリ 開発環境⽤コンテナ レジストリ 開発環境⽤コンテナ
  34. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. Continuous Configuration (CC) 34 Continuous Configuration (CC) ソフトウェアをデプロイしたり再起動したりすることなく、 振る舞いを継続的に更新する
  35. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. Continous Configuration でデプロイとリリースを分離 機能フラグによりアプリケーションのデプロイなしに機能をリリース 35 コンテナ開発 機能開発をどんどん⾏う アプリケーション リリース 機能フラグ ON 未リリース 機能フラグ OFF // 環境変数などで true/false を切り替える if (FeatureFlag.featureABC()) { // Feature ABC の機能を実装 } リリース 機能フラグ ON レジストリ 同⼀コンテナ 開発環境 本番環境 デプロイ
  36. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. AWS サービスによるコンテナと機能フラグの統合 AWS AppConfig と AppConfig エージェントによる動的な機能切り替え 36 仮想マシン (Amazon EC2) AppConfig エージェントコンテナ アプリケーションコンテナ HTTP localhost:2772 AWS AppConfig 機能フラグの 管理サービス 機能フラグの取得
  37. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. まとめ 37
  38. © 2026, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. • クラウドを単に使うだけでなく、クラウドネイティブな開発が重要 • クラウドネイティブで最も重要な考え⽅は「疎結合による認知負荷の 削減」 • クラウドネイティブ開発におけるコンテナ活⽤の例 • テスト容易性 - 信頼性の⾼いテストの構築でテストの認知負荷を下げる • デプロイ容易性 - コンテナによるデプロイにおける認知負荷を下げる 38 クラウドネイティブな開発と認知負荷