AWS Batch でコンピューティング環境を更新できる条件を教えてください
困っていた内容
AWS Batch の EC2 コンピューティング環境で、AMI ID を更新したいです。
マネジメントコンソールの編集ページで項目が表示されません。AMI を更新するにはどうしたら良いでしょうか。
どう対応すればいいの?
コンピューティング環境が次の条件を満たしているか確認してください。
- サービスロールにサービスリンクロール(
AWSServiceRoleForBatch
)が指定されている - 配分戦略が次のいずれかに設定されている(
BEST_FIT
を指定していない)BEST_FIT_PROGRESSIVE
SPOT_CAPACITY_OPTIMIZED
SPOT_PRICE_CAPACITY_OPTIMIZED
コンピューティング環境のインフラストラクチャ構成を更新するには、上記条件をすべて満たしている必要があります。
条件を満たしていないコンピューティング環境は更新できず、2025年9月時点の挙動として、更新できない項目は編集ページに表示されません。
更新できないコンピューティング環境で AMI ID などのインフラストラクチャ構成を更新したい場合は、コンピューティング環境を再作成してください。
なお、条件を満たしている場合、編集ページは次のようになります。
また、条件を満たしている場合に更新できるインフラストラクチャ構成は次のとおりです。
※括弧内は AWS マネジメントコンソールでの表記です。
allocationStrategy
(配分戦略)bidPercentage
(オンデマンド料金 (最大 %))ec2Configuration
(EC2 設定)ec2KeyPair
(EC2 キーペア)imageId
(イメージ ID)instanceRole
(インスタンスロール)instanceTypes
(許可されたインスタンスタイプ)launchTemplate
(起動テンプレート)placementGroup
(プレイスメントグループ)securityGroupIds
(セキュリティグループ)subnets
(サブネット)tags
(EC2 タグ)type
(EC2 スポットインスタンスを使用)updatePolicy
(更新時にジョブを直ちに終了する、ジョブ実行タイムアウト)updateToLatestImageVersion
(AMI を最新バージョンに更新)
参考資料
AWS Batch EC2 コンピューティング環境のインフラストラクチャ設定を更新するには、BEST_FIT 以外の割り当て方法を使用します。コンピューティング環境では、サービスリンクロールも使用する必要があります。
…(中略)…
配分戦略が BEST_FIT であるか、サービスリンクロールを使用していない場合は、コンピューティング環境を再作成してください。
- update-compute-environment — AWS CLI 2.29.0 Command Reference
- Updating compute environments - AWS Batch
Infrastructure updates
An infrastructure update is required to change some settings for a compute environment. If any of the following settings are changed, an infrastructure update is started:Important
The compute environment must use the AWSServiceRoleForBatch service-linked role to make changes that require an infrastructure update.If the compute environment uses a service-linked role, it can't be changed to use a regular IAM role. Likewise, if the compute environment has a regular IAM role, it can't be changed to use a service-linked role. Therefore, you can only perform infrastructure updates on compute environments that were created by using a service-linked role.
- Allocation strategy (allocationStrategy, must be either BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED, or SPOT_PRICE_CAPACITY_OPTIMIZED. If the original allocation strategy is BEST_FIT, infrastructure updates aren't supported.)
Note
We recommend that you use SPOT_PRICE_CAPACITY_OPTIMIZED rather than SPOT_CAPACITY_OPTIMIZED in most instances.
- Bid percentage (bidPercentage)
- EC2 configuration (ec2Configuration)
- Key pair (ec2KeyPair)
- Image ID (imageId)
- Instance role (instanceRole)
- Instance types (instanceTypes)
- Launch template (launchTemplate)
- Placement group (placementGroup)
- Security groups (securityGroupIds)
- VPC subnets (subnets)
- EC2 tags (tags)
- Compute environment type (type, can be one of EC2 or SPOT)
- Whether to update to the latest AMI that's supported by AWS Batch during an infrastructure update updateToLatestImageVersion