Direct Code Deploymentとの使い分けの整理
AgentCore Runtime が提供する Direct Code Deployment とコンテナデプロイの2方式について、実務でどちらを選ぶかの判断材料として、両者の違いを整理しておきます。
| 観点 | Direct Code Deployment | コンテナデプロイ |
|---|---|---|
| パッケージング | Pythonコード+依存をzipに固める | Dockerfileでイメージをビルドする |
| デプロイの反復速度 | 速い(更新時はzipの差分アップロードのみ) | 相対的に遅い(イメージビルド・push・反映が必要) |
| パッケージサイズ上限 | 250MB(zip後)/750MB(展開後) | 最大2GB |
| システム依存の持ち込み | 難しい(Python依存中心) | 自由(apt等でOSレベルの依存を追加できる) |
| 対応言語 | Python 3.10〜3.13 | 任意(Dockerfileで組める言語であれば可) |
| アーティファクトの保管先 | AWS側が管理するS3に格納される | 自アカウントのECRに格納される |
判断の目安は Get started with Amazon Bedrock AgentCore Runtime direct code deployment(AWS公式ドキュメント) に以下のように記載されています(英語表示時の引用。日本語表示は画面右上のセレクタで切替可能)。
If the size of the deployment package exceeds 250MB, and you have existing container CI/CD pipelines, and you need highly specialized dependencies and packaging, then container based deployments is a good option to choose. If the size of the deployment package is small, the code and package is not complex to build and uses common frameworks and languages, and you need rapid prototyping and iteration, then direct code deployment would be the option.
ここの「container CI/CD pipelines」「highly specialized dependencies」「rapid prototyping and iteration」という記述から、既存のコンテナ運用に載せたい・独自依存が必要な場合はコンテナデプロイ、素早い試作・共通フレームワークで済む場合はDirect Code Deployment、と読み取れます。試作はDirect Code Deploymentで始め、本番運用に近づいたタイミングでコンテナデプロイに切り替えるハイブリッド運用も、同ドキュメントで推奨されています。