トレーニングプランを使用して設定済みGPU容量でSageMaker AI推論エンドポイントをデプロイ
AWSはSageMaker AIのトレーニングプラン機能を活用し、推論エンドポイント向けにGPU容量を事前に予約できる新機能を公開した。
キーポイント
推論ワークロード向け容量予約のサポート
従来トレーニング用だったSageMaker AIのトレーニングプランが、推論エンドポイントにも対応し、時間限定の推論ワークロードに対して予測可能なGPU可用性を提供する。
柔軟な予約設定とARN参照によるデプロイ
インスタンスタイプ、数量、期間を指定して予約を作成し、生成されたARNをエンドポイント設定に参照させることで、予約済みのGPUインスタンス上で推論エンドポイントをデプロイできる。
LLM評価・バーストワークロードへの適用
複数モデルの比較ベンチマークや限定的な本番環境テストにおいて、オンデマンドの容量制約や価格変動を避け、コスト制御と安定したアクセスを実現する。
影響分析・編集コメントを表示
影響分析
LLM推論におけるGPU供給の不安定さが長年の課題だったが、本機能によりMLチームは評価期間やテスト期間に合わせた容量を事前に確保できる。これにより、開発サイクルの遅延リスクが軽減され、コスト予測とリソース管理の精度が向上する。特に大規模モデルの評価や一時的な需要急増に対応する企業にとって、インフラ運用の最適化に寄与する。
編集コメント
既存のトレーニング予約機能を推論領域に拡張した実用的なアップデートです。AWS公式ブログ特有のPR色はありますが、MLチームのリソース計画における具体的な課題解決に直結するため、現場での採用価値は高いと言えます。
推論のために大規模言語モデル(LLM)を展開するには、特に重要な評価期間中や限定された期間の生産環境テスト、バーストワークロード時に信頼性の高い GPU 容量が必要です。容量制約は展開を遅らせ、アプリケーションのパフォーマンスに影響を与える可能性があります。顧客は Amazon SageMaker AI のトレーニングプランを使用して、特定の期間に対してコンピューティング容量を予約できます。もともとトレーニングワークロード向けに設計されたトレーニングプランですが、現在は推論エンドポイントにも対応しており、時間制限のある推論ワークロードに対して予測可能な GPU 利用可能性を提供します。
一般的なシナリオを考えてみましょう:あるデータサイエンスチームが、生産環境で採用するモデルを選択する前に、2 週間にわたって複数のファインチューニングされた言語モデルを評価しなければならないとします。彼らは比較ベンチマークを実行するために ml.p5.48xlarge インスタンスへの中断のないアクセスを必要としていますが、ピーク時間帯には AWS リージョン内のオンデマンド容量は予測不可能です。トレーニングプランを通じて容量を予約することで、制御されたコストと予測可能な可用性を保ちながら、評価を中断なく実行できます。
Amazon SageMaker AI のトレーニングプランは、利用可能なオファリングを検索し、ニーズに一致するインスタンスタイプ、数量、期間を選択するための柔軟な方法を提供します。顧客は、将来の固定された日数または月数を指定するか、連続した特定の日の数を指定して予約を作成できます。作成後、このトレーニングプランはセット容量を提供し、SageMaker AI 推論エンドポイントをデプロイする際にこれを参照することができます。
本記事では、利用可能な p ファミリー GPU 容量の検索方法、推論用のトレーニングプラン予約の作成方法、およびその予約された容量上で SageMaker AI 推論エンドポイントをデプロイする方法を順を追って説明します。ここでは、モデル評価のために容量を予約し、予約ライフサイクルを通じてエンドポイントの管理を行うデータサイエンティストの旅を追跡します。
ソリューション概要
SageMaker AI トレーニングプラン は、特定の時間ウィンドウに対してコンピューティング容量を予約するためのメカニズムを提供します。トレーニングプランを作成する際、顧客は対象のリソースタイプを指定します。対象リソースの値を「エンドポイント」に設定することで、推論ワークロード専用の p ファミリー GPU インスタンスを確保できます。予約された容量は、エンドポイント構成内の Amazon Resource Name (ARN) を介して参照され、これによりエンドポイントは予約済みインスタンスでデプロイされます。
トレーニングプランの作成と利用のワークフローは、以下の 4 つの主要フェーズから構成されています:
- インフラ要件を特定する – 推論ワークロードに必要なインスタンスタイプ、インスタンス数、および期間を決定します。
- 利用可能なトレーニングプランの提供を確認する – 要件と希望する時間枠に一致する利用可能な容量を検索します。
- トレーニングプランのリザーブを作成する – 適切な提供内容を選択しリザーブを作成すると、ARN が生成されます。
- エンドポイントのデプロイと管理 – リザーブされた容量を使用するように SageMaker AI エンドポイントを構成し、リザーブ期間中のライフサイクルを管理します。
各フェーズの詳細な例とともに順を追って説明していきます。
前提条件
開始前に、以下の準備が整っていることを確認してください:
- SageMaker AI アクセス権限を持つ IAM 実行ロール
- Amazon Simple Storage Service (Amazon S3) にアップロードされた学習済みモデル
- AWS Command Line Interface (AWS CLI) のインストールと設定完了、または SageMaker AI コンソールへのアクセス権限
- SageMaker AI 用のトレーニングプランの作成
ステップ 1: 利用可能な容量オファリングを検索し、予約プランを作成する
データサイエンティストはまず、評価要件に一致する p ファミリーの GPU 容量の利用可能状況を確認します。彼らは、1 月下旬から始まる 1 週間の評価用に、ml.p5.48xlarge インスタンスを 1 台必要としています。search-training-plan-offerings API を使用して、インスタンスタイプ、インスタンス数、期間、および時間ウィンドウを指定します。ターゲットリソースを「endpoint」に設定することで、容量がトレーニングジョブではなく推論用に特別にプロビジョニングされるように構成されます。
# インスタンスタイプ、インスタンス数、時間単位の期間、開始時刻以降、終了時刻以前を含むトレーニングプランオファリングの一覧表示
aws sagemaker search-training-plan-offerings \
--target-resources "endpoint" \
--instance-type "ml.p5.48xlarge" \
--instance-count 1 \
--duration-hours 168 \
--start-time-after "2025-01-27T15:48:14-04:00" \
--end-time-before "2025-01-31T14:48:14-05:00"
例出力
{
"TrainingPlanOfferings": [
{
"TrainingPlanOfferingId": "tpo-SHA-256-hash-value",
"TargetResources": ["endpoint"],
"RequestedStartTimeAfter": "2025-01-21T12:48:14.704000-08:00",
"DurationHours": 168,
"DurationMinutes": 10080,
"UpfrontFee": "xxxx.xx",
"CurrencyCode": "USD",
"ReservedCapacityOfferings": [
{
"InstanceType": "ml.p5.48xlarge",
"InstanceCount": 1,
"AvailabilityZone": "us-west-2a",
"DurationHours": 168,
"DurationMinutes": 10080,
"StartTime": "2025-01-27T15:48:14-04:00",
"EndTime": "2025-01-31T14:48:14-05:00"
}
]
}
]
}
レスポンスには、利用可能な各容量ブロックに関する詳細情報が含まれており、インスタンスタイプ、数量、期間、アベイラビリティゾーン、および価格が含まれます。各オファリングには特定の開始時刻と終了時刻が設定されているため、デプロイスケジュールに一致する予約を選択できます。このケースでは、チームは us-west-2a において、彼らのタイムラインに適合する 168 時間(7 日間)の予約を見つけました。
適切なオファリングを特定した後、チームは容量を確保するためにトレーニングプラン予約を作成します:
aws sagemaker create-training-plan \
--training-plan-offering-id "tpo-SHA-256-hash-value" \
--training-plan-name "p4-for-inference-endpoint"
出力例:
{
"TrainingPlanArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint"
}
トレーニングプラン ARN は、予約された容量を一意に識別します。この ARN を保存してください。これがエンドポイントとセットされた p ファミリー GPU 容量(GPU capacity)をリンクする鍵となります。予約が確認され支払いが完了したことで、彼らは推論エンドポイントの構成準備が整いました。
SageMaker AI コンソールの利用
SageMaker AI コンソールを通じてトレーニングプランを作成することもできます。これにより、容量の検索と予約完了のための視覚的なインターフェースが提供されます。コンソールのワークフローは 3 つのステップに従います:オファリングの検索、プラン詳細の追加、および確認と購入です。
トレーニングプランへのナビゲーション:
- SageMaker AI コンソールで、左側のナビゲーションペインにある「モデルのトレーニングとカスタマイズ」に移動します。
- 「トレーニングプラン」を選択します。
- 右上隅のオレンジ色のボタンである「トレーニングプランの作成」を選択します。
次のスクリーンショットは、作成ワークフローを開始する「トレーニングプラン」ランディングページを示しています。
*図 1: 作成トレーニングプランボタン付きのトレーニングプランランディングページ*
ステップ A – トレーニングプランオファリングの検索:
- 「ターゲット」の下で、「推論エンドポイント」を選択します。
- 「コンピューティングタイプ」の下で「インスタンス」を選択します。
- インスタンスタイプ(例:ml.p5.48xlarge)とインスタンス数を選択します。
- 「日付と期間」の下で、開始日と期間を指定します。
- 「トレーニングプランの検索」を選択します。
次のスクリーンショットは、「推論エンドポイント」が選択され、条件が入力された検索インターフェースを示しています:
*図 2: ステップ A – 推論エンドポイントをターゲットとしたトレーニングプランオファリングの検索*
「トレーニングプランの検索」を選択した後、「利用可能なプラン」セクションに一致するオファリングが表示されます:
*図 3: 価格と可用性の詳細を含む利用可能なトレーニングプランオファリング*
予約を完了する:
- お好みのオファリングの隣にあるラジオボタンを選択してプランを選びます。
- 「次へ」を選択して、ステップ B:プランの詳細入力に進みます。
- 詳細を確認し、「次へ」を選択してステップ 3:確認と購入に進みます。
- 最終サマリーを確認し、利用規約に同意した上で「購入」を選択して予約を完了します。
予約が作成されると、トレーニングプランの ARN が発行されます。予約が確定し支払いも完了したため、この ARN を使用して推論エンドポイントを構成する準備が整いました。エンドポイントは、トレーニングプランで指定された予約期間中のみ機能します。
ステップ 2: トレーニングプラン予約を使用したエンドポイント構成の作成
予約を確保した後、チームは推論エンドポイントを予約済み容量にバインドするエンドポイント構成を作成します。ここで重要なステップは、ProductionVariants セクションに CapacityReservationConfig オブジェクトを含め、MlReservationArn に先ほど受け取ったトレーニングプランの ARN を設定することです:
--endpoint-config-name "ftp-ep-config" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge",
"InitialVariantWeight": 1.0,
"CapacityReservationConfig": {
"CapacityReservationPreference": "capacity-reservations-only",
"MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint"
}
}]'
SageMaker AI がこのリクエストを受け取ると、ARN が「endpoint」をターゲットリソースタイプとするアクティブなトレーニングプラン予約を指しているか検証します。検証が成功すると、エンドポイント構成が作成され、デプロイ対象として有効になります。CapacityReservationPreference 設定は特に重要です。これを capacity-reservations-only に設定することで、チームはエンドポイントを予約済み容量に制限し、予約期間終了時にトラフィックの提供を停止させるため、予期せぬ課金を防止できます。
ステップ 3: 予約済み容量上でエンドポイントをデプロイする
エンドポイント構成が準備できたら、チームは評価用エンドポイントをデプロイします:
aws sagemaker create-endpoint \
--endpoint-name "my-endpoint" \
--endpoint-config-name "ftp-ep-config"
このエンドポイントは、予約済みトレーニングプランの容量内で完全に稼働します。SageMaker AI は us-west-2a リージョンで ml.p5.48xlarge インスタンスをプロビジョニングし、モデルを読み込みます。このプロセスには数分かかる場合があります。エンドポイントが InService ステータスに達したら、チームは評価ワークロードの実行を開始できます。
ステップ 4: トレーニングプランがアクティブな状態でエンドポイントを呼び出す
エンドポイントが稼働中になったら、評価ワークロードの実行を開始できます。リアルタイム推論のためにエンドポイントを呼び出し、テストプロンプトを送信して、応答の品質、レイテンシ、スループットを測定します:
aws sagemaker-runtime invoke-endpoint \
--endpoint-name "my-endpoint" \
--body fileb://input.json \
--content-type "application/json"
Output.json
アクティブな予約期間中、エンドポイントは設定された容量で通常通り動作します。すべての呼び出しは予約されたリソースを使用して処理されるため、予測可能なパフォーマンスと可用性の確保に役立ちます。チームは、共有インフラからの容量制約やパフォーマンスの変動を気にすることなくベンチマークを実行できます。
ステップ 5: トレーニングプランの有効期限切れ時にエンドポイントを呼び出す
エンドポイントがまだデプロイされた状態でトレーニングプランの予約有効期限が切れた場合に何が起こるかを理解しておく価値があります。
予約有効期限が切れると、エンドポイントの動作は CapacityReservationPreference の設定に依存します。チームはこの値を capacity-reservations-only に設定していたため、エンドポイントはトラフィックの提供を停止し、呼び出しは容量エラーで失敗します:
aws sagemaker-runtime invoke-endpoint \
--endpoint-name "my-endpoint" \
--body fileb://input.json \
--content-type "application/json" \
output.json
想定されるエラー応答:
{
"Error": {
"Code": "ModelError",
"Message": "Endpoint capacity reservation has expired. Please update endpoint configuration."
}
}
サービス再開には、新しいトレーニングプランの予約を作成してエンドポイント構成を更新するか、エンドポイントをオンデマンドまたは ODCR (On-Demand Capacity Reservation) 容量を使用するように更新する必要があります。チームの場合は評価が完了したため、予約を延長するのではなくエンドポイントを削除しました。
ステップ 6:エンドポイントの更新
評価期間中、さまざまな理由によりエンドポイントを更新する必要がある場合があります。SageMaker AI は、予約済み容量への接続を維持しながら、いくつかの更新シナリオをサポートしています。
新しいモデルバージョンへの更新
評価の途中、チームは追加のファインチューニングを組み込んだ新しいモデルバージョンをテストしたいと考えています。同じ予約済み容量を保持したまま、新しいモデルバージョンに更新することができます:
# まず、更新されたモデルを含む新しいエンドポイント構成を作成します
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-v2" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model-v2",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]'
次に、エンドポイントを更新します
aws sagemaker update-endpoint \
--endpoint-name "my-endpoint" \
--endpoint-config-name "ftp-ep-config-v2"
予約済み容量からオンデマンド容量への移行
チームの評価が予想より長引いた場合や、予約期間を超えてエンドポイントを本番環境で使用したい場合は、オンデマンド容量へ移行することができます:
トレーニングプランによる予約なしのエンドポイント設定の作成
aws sagemaker create-endpoint-config \
--endpoint-config-name "ondemand-ep-config" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0 }]'
エンドポイントを更新してオンデマンド容量を使用させる
aws sagemaker update-endpoint \
--endpoint-name "my-endpoint" \
--endpoint-config-name "ondemand-ep-config"
ステップ 7: エンドポイントのスケーリング
いくつかのシナリオでは、チームは当初デプロイした容量よりも多くの容量を予約し、必要に応じてスケールアップする柔軟性を確保できます。例えば、チームが 2 つのインスタンスを予約したが、当初は 1 つのみをデプロイした場合、評価期間中にスケーリングアップして、より高いスループットをテストすることが可能です。
予約制限内でのスケーリング
チームが当初 2 つの ml.p5.48xlarge インスタンスを予約したが、エンドポイントは 1 つのインスタンスのみでデプロイしたと仮定します。その後、より高い同時負荷下でのモデルのパフォーマンスをテストしたい場合:
リザーブ内でのインスタンス数を増やした新しい構成を作成する
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-scaled" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 2,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]'
aws sagemaker update-endpoint \
--endpoint-name "my-endpoint" \
--endpoint-config-name "ftp-ep-config-scaled"
リザーブを超えてスケールしようとする
顧客がリザーブ容量を超えてスケールしようとすると、更新は失敗します:
このコマンドは、リザーブにインスタンスが 2 つしかない場合に失敗します
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-over-limit" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 3,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]'
予想されるエラー:
{
"Error": {
"Code": "ValidationException",
"Message": "Requested instance count (3) e
原文を表示
Deploying large language models (LLMs) for inference requires reliable GPU capacity, especially during critical evaluation periods, limited-duration production testing, or burst workloads. Capacity constraints can delay deployments and impact application performance. Customers can use Amazon SageMaker AI training plans to reserve compute capacity for specified time periods. Originally designed for training workloads, training plans now support inference endpoints, providing predictable GPU availability for time-bound inference workloads.
Consider a common scenario: you’re on a data science team that must evaluate several fine-tuned language models over a two-week period before selecting one for production. They require uninterrupted access to ml.p5.48xlarge instances to run comparative benchmarks, but on-demand capacity in their AWS Region is unpredictable during peak hours. By reserving capacity through training plans, they can run evaluations uninterrupted with controlled costs and predictable availability.
Amazon SageMaker AI training plans offer a flexible way to secure capacity so you can search for available offerings, select the instance type, quantity, and duration that match your needs. Customers can select a fixed number of days or months into the future, or a specified number of days at a stretch, to create a reservation. After created, the training plan provides a set capacity that can be referenced when deploying SageMaker AI inference endpoints.
In this post, we walk through how to search for available p-family GPU capacity, create a training plan reservation for inference, and deploy a SageMaker AI inference endpoint on that reserved capacity. We follow a data scientist’s journey as they reserve capacity for model evaluation and manage the endpoint throughout the reservation lifecycle.
Solution overview
SageMaker AI training plans provide a mechanism to reserve compute capacity for specific time windows. When creating a training plan, customers specify their target resource type. By setting the value of the target resource to “endpoint”, you can secure p-family GPU instances specifically for inference workloads. The reserved capacity is referenced through an Amazon Resource Name (ARN) in the endpoint configuration so that the endpoint deploys the reserved instances.
The training plan creation and utilization workflow consists of four key phases:
- Identify your capacity requirements – Determine the instance type, instance count, and duration needed for your inference workload.
- Search for available training plan offerings – Query available capacity that matches your requirements and desired time window.
- Create a training plan reservation – Select a suitable offering and create the reservation, which generates an ARN.
- Deploy and manage your endpoint – Configure your SageMaker AI endpoint to use the reserved capacity and manage its lifecycle during the reservation period.
Let’s walk through each phase with detailed examples.
Prerequisites
Before starting, ensure that you have the following:
- An IAM execution role with SageMaker AI access
- A trained model uploaded to Amazon Simple Storage Service (Amazon S3)
- AWS Command Line Interface (AWS CLI) installed and configured, or access to the SageMaker AI console
- A created training plan for SageMaker AI
Step 1: Search for available capacity offerings and create a reservation plan
Our data scientist begins by identifying available p-family GPU capacity that matches their evaluation requirements. They need one ml.p5.48xlarge instance for a week-long evaluation starting in late January. Using the search-training-plan-offerings API, they specify the instance type, instance count, duration, and time window. Setting target resources to “endpoint” configures the capacity to be provisioned specifically for inference rather than training jobs.
# List training plan offerings with instance type, instance count,
# duration in hours, start time after, and end time before.
aws sagemaker search-training-plan-offerings \
--target-resources "endpoint" \
--instance-type "ml.p5.48xlarge" \
--instance-count 1 \
--duration-hours 168 \
--start-time-after "2025-01-27T15:48:14-04:00" \
--end-time-before "2025-01-31T14:48:14-05:00"
Example output
{
"TrainingPlanOfferings": [
{
"TrainingPlanOfferingId": "tpo-SHA-256-hash-value",
"TargetResources": ["endpoint"],
"RequestedStartTimeAfter": "2025-01-21T12:48:14.704000-08:00",
"DurationHours": 168,
"DurationMinutes": 10080,
"UpfrontFee": "xxxx.xx",
"CurrencyCode": "USD",
"ReservedCapacityOfferings": [
{
"InstanceType": "ml.p5.48xlarge",
"InstanceCount": 1,
"AvailabilityZone": "us-west-2a",
"DurationHours": 168,
"DurationMinutes": 10080,
"StartTime": "2025-01-27T15:48:14-04:00",
"EndTime": "2025-01-31T14:48:14-05:00"
}
]
}
]
}
The response provides detailed information about each available capacity block, including the instance type, quantity, duration, Availability Zone, and pricing. Each offering includes specific start and end times, so you can select a reservation that aligns with your deployment schedule. In this case, the team finds a 168-hour (7-day) reservation in us-west-2a that fits their timeline.
After identifying a suitable offering, the team creates the training plan reservation to secure the capacity:
aws sagemaker create-training-plan \
--training-plan-offering-id "tpo-SHA-256-hash-value" \
--training-plan-name "p4-for-inference-endpoint"Example output:
{
"TrainingPlanArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint"
}The TrainingPlanArn uniquely identifies the reserved capacity. You save this ARN, it’s the key that will link their endpoint to the set p-family GPU capacity. With the reservation confirmed and paid for, they’re now ready to configure their inference endpoint.
Using the SageMaker AI console
You can also create training plans through the SageMaker AI console. This provides a visual interface for searching capacity and completing the reservation. The console workflow follows three steps: search for offerings, add plan details, and review and purchase.
Navigating to Training Plans:
- In the SageMaker AI console, navigate to Model training & customization in the left navigation pane.
- Select Training plans.
- Choose Create training plan (orange button in the upper right).
The following screenshot shows the Training Plans landing page where you initiate the creation workflow.
*Figure 1: Training Plans landing page with Create training plan button*
Step A – Search for training plan offerings:
- Under Target, select Inference Endpoint.
- Under Compute type, select Instance.
- Select your Instance type (for example, ml.p5.48xlarge) and Instance count.
- Under Date and duration, specify the start date and duration.
- Choose Find training plan.
The following screenshot shows the search interface with Inference Endpoint selected and the criteria filled in:
*Figure 2: Step A – Search training plan offerings with Inference Endpoint target*
After selecting Find training plan, the Available plans section displays matching offerings:
*Figure 3: Available training plan offerings with pricing and availability details*
Complete the reservation:
- Choose a plan by selecting the radio button next to your preferred offering.
- Choose Next to proceed to Step B: Add plan details.
- Review the details and choose Next to proceed to Step 3: Review and purchase.
- Review the final summary, accept the terms, and choose Purchase to complete the reservation.
After the reservation is created, you receive a training plan ARN. With the reservation confirmed and paid for, you’re now ready to configure their inference endpoint using this ARN. The endpoint will only function during the reservation window specified in the training plan.
Step 2: Create the endpoint configuration with training plan reservation
With the reservation secured, the team creates an endpoint configuration that binds their inference endpoint to the reserved capacity. The critical step here is including the CapacityReservationConfig object in the ProductionVariants section where they set the MlReservationArn to the training plan ARN received earlier:
--endpoint-config-name "ftp-ep-config" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge",
"InitialVariantWeight": 1.0,
"CapacityReservationConfig": {
"CapacityReservationPreference": "capacity-reservations-only",
"MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint"
}
}]‘When SageMaker AI receives this request, it validates that the ARN points to an active training plan reservation with a target resource type of “endpoint”. If validation succeeds, the endpoint configuration is created and becomes eligible for deployment. The CapacityReservationPreference setting is particularly important. By setting it to capacity-reservations-only, the team restricts the endpoint to their reserved capacity, so it stops serving traffic when the reservation ends, preventing unexpected charges.
Step 3: Deploy the endpoint on reserved capacity
With the endpoint configuration ready, the team deploys their evaluation endpoint:
aws sagemaker create-endpoint \
--endpoint-name "my-endpoint" \
--endpoint-config-name "ftp-ep-config"The endpoint now runs entirely within the reserved training plan capacity. SageMaker AI provisions the ml.p5.48xlarge`` instance in us-west-2a and loads the model, this process can take several minutes. After the endpoint reaches InService status, the team can begin their evaluation workload.
Step 4: Invoke an endpoint when the training plan is active
With the endpoint in service, you can begin running their evaluation workload. They invoke the endpoint for real-time inference, sending test prompts and measuring response quality, latency, and throughput:
aws sagemaker-runtime invoke-endpoint \
--endpoint-name "my-endpoint" \
--body fileb://input.json \
--content-type "application/json" \
Output.jsonDuring the active reservation window, the endpoint operates normally with a set capacity. All invocations are processed using the reserved resources, helping to facilitate predictable performance and availability. The team can run their benchmarks without worrying about capacity constraints or performance variability from shared infrastructure.
Step 5: Invoke endpoint when training plan is expired
It’s worth understanding what happens if the training plan reservation expires while the endpoint is still deployed.
When the reservation expires, endpoint behavior depends on the CapacityReservationPreference setting. Because the team set it to capacity-reservations-only, the endpoint stops serving traffic and invocations fail with a capacity error:
aws sagemaker-runtime invoke-endpoint \
--endpoint-name "my-endpoint" \
--body fileb://input.json \
--content-type "application/json" \
output.jsonExpected error response:
Expected error response:
{
"Error": {
"Code": "ModelError",
"Message": "Endpoint capacity reservation has expired. Please update endpoint configuration."
}
}To resume service, you must either create a new training plan reservation and update the endpoint configuration or update the endpoint to use on-demand or ODCR capacity. In the team’s case, because they completed their evaluation, they delete the endpoint rather than extending the reservation.
Step 6: Update endpoint
During the evaluation period, you might need to update the endpoint for various reasons. SageMaker AI supports several update scenarios while maintaining the connection to reserved capacity.
Update to a new model version
Midway through the evaluation, the team wants to test a new model version that incorporates additional fine-tuning. They can update to the new model version while keeping the same reserved capacity:
# First, create a new endpoint configuration with updated model
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-v2" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model-v2",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]‘ # Then update the endpoint aws sagemaker update-endpoint \ --endpoint-name "my-endpoint" \ --endpoint-config-name "ftp-ep-config-v2"Migrate from training plan to on-demand capacity
If the team’s evaluation runs longer than expected or if they want to transition the endpoint to production use beyond the reservation period, they can migrate to on-demand capacity:
# Create endpoint configuration without training plan reservation
aws sagemaker create-endpoint-config \
--endpoint-config-name "ondemand-ep-config" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 1,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0 }]‘ # Update endpoint to use on-demand capacity aws sagemaker update-endpoint \ --endpoint-name "my-endpoint" \ --endpoint-config-name "ondemand-ep-config"Step 7: Scale endpoint
In some scenarios, teams can reserve more capacity than they initially deploy, giving them flexibility to scale up if needed. For example, if the team reserved two instances but initially deployed only one, they cam scale up during the evaluation period to test higher throughput scenarios.
Scale within reservation limits
Suppose the team initially reserved two ml.p5.48xlarge`` instances but deployed their endpoint with only one instance. Later, they want to test how the model performs under higher concurrent load:
# Create new config with increased instance count (within reservation)
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-scaled" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 2,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]‘ aws sagemaker update-endpoint \ --endpoint-name "my-endpoint" \ --endpoint-config-name "ftp-ep-config-scaled"Attempt to scale beyond reservation
If customers attempt to scale beyond the reserved capacity, the update will fail:
# This will fail if reservation only has 2 instances
aws sagemaker create-endpoint-config \
--endpoint-config-name "ftp-ep-config-over-limit" \
--production-variants '[{
"VariantName": "AllTraffic",
"ModelName": "my-model",
"InitialInstanceCount": 3,
"InstanceType": "ml.p5.48xlarge", "InitialVariantWeight": 1.0, "CapacityReservationConfig": { "CapacityReservationPreference": "capacity-reservations-only", "MlReservationArn": "arn:aws:sagemaker:us-east-1:123456789123:training-plan/p4-for-inference-endpoint" } }]‘Expected error:
{
"Error": {
"Code": "ValidationException",
"Message": "Requested instance count (3) e
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み