

# Extend a training plan using the SageMaker API or AWS CLI
<a name="training-plan-extension-using-api-cli-sdk"></a>

SageMaker training plans support extending training plans programmatically through its API. You can interact with the training plans API using the AWS CLI or SageMaker SDKs.

The training plan extension involves the following API actions:
+ **`SearchTrainingPlanOfferings`:** Search for available extension offerings by specifying your training plan ARN and desired extension duration. The API returns extension offerings in the `TrainingPlanExtensionOfferings` field.
+ **`ExtendTrainingPlan`:** Purchase a specific extension offering to extend your training plan by providing the `TrainingPlanExtensionOfferingId`. This reserves the additional compute capacity and updates your training plan's end date.
+ **`DescribeTrainingPlanExtensionHistory`:** View the complete extension history for a training plan, including all past extensions with their status, dates, and payment information.

**Topics**
+ [Search for extension offerings](search-extension-offerings-api-cli-sdk.md)
+ [Purchase an extension](extend-training-plan-api-cli-sdk.md)
+ [View extension history](describe-extension-history-api-cli-sdk.md)

# Search for extension offerings
<a name="search-extension-offerings-api-cli-sdk"></a>

Use the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html) API with the `TrainingPlanArn` parameter to find available extension offerings for your training plan.

The following example uses an AWS CLI command to search for extension offerings for an existing training plan.

```
aws sagemaker search-training-plan-offerings \
--training-plan-arn "arn:aws:sagemaker:us-east-2:123456789012:training-plan/my-training-plan" \
--duration-hours 48
```

This JSON document is a sample response from the SageMaker training plans API. The response includes `TrainingPlanExtensionOfferings` containing available extension offerings for the specified training plan.

```
{
    "TrainingPlanOfferings": [],
    "TrainingPlanExtensionOfferings": [
        {
            "TrainingPlanExtensionOfferingId": "tpeo-SHA-256-hash-value",
            "AvailabilityZone": "us-east-2a",
            "StartDate": "2025-09-23T12:00:00Z",
            "EndDate": "2025-09-25T12:00:00Z",
            "DurationHours": 48,
            "UpfrontFee": "xxxx.xx",
            "CurrencyCode": "USD"
        }
    ]
}
```

The following sections define the mandatory and optional input request parameters for the `SearchTrainingPlanOfferings` API operation when searching for extension offerings.

## Required parameters
<a name="search-extension-offerings-required-params"></a>

When calling the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_SearchTrainingPlanOfferings.html) API to search for extension offerings, you must provide the following value:
+ `TrainingPlanArn`: The of the training plan you want to extend. The `TrainingPlanArn` must reference an existing training plan with a status of `Active` or `Scheduled`.

## Optional parameters
<a name="search-extension-offerings-optional-params"></a>

The following sections provide details on some optional parameters that you can pass to your `SearchTrainingPlanOfferings` API request when searching for extension offerings.
+ `DurationHours`: The desired duration in hours for the extension. The `DurationHours` is rounded up to the nearest multiple of 24.

# Purchase an extension
<a name="extend-training-plan-api-cli-sdk"></a>

After selecting an extension offering, use the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ExtendTrainingPlan.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ExtendTrainingPlan.html) API to purchase the extension.

The following example uses an AWS CLI command to extend a training plan.

```
aws sagemaker extend-training-plan \
--training-plan-extension-offering-id "tpeo-SHA-256-hash-value"
```

This JSON document is a sample response from the SageMaker training plans API. The response includes the list of extensions for the training plan.

```
{
    "TrainingPlanExtensions": [
        {
            "TrainingPlanExtensionOfferingId": "tpeo-SHA-256-hash-value",
            "ExtendedAt": "2025-09-17T10:00:00Z",
            "StartDate": "2025-09-23T12:00:00Z",
            "EndDate": "2025-09-25T12:00:00Z",
            "Status": "Pending",
            "PaymentStatus": "Pending",
            "AvailabilityZone": "us-east-2a",
            "DurationHours": 48,
            "UpfrontFee": "xxxx.xx",
            "CurrencyCode": "USD"
        }
    ]
}
```

The following section defines the mandatory input request parameter for the `ExtendTrainingPlan` API operation.

## Required parameters
<a name="extend-training-plan-required-params"></a>

When calling the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ExtendTrainingPlan.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ExtendTrainingPlan.html) API to extend a training plan, you must provide the following value:
+ `TrainingPlanExtensionOfferingId`: The ID of the extension offering you are purchasing. You can retrieve this ID from the `TrainingPlanExtensionOfferings` in the response of your `SearchTrainingPlanOfferings` API call. Its format should start with `tpeo-*`.

# View extension history
<a name="describe-extension-history-api-cli-sdk"></a>

Use the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingPlanExtensionHistory.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingPlanExtensionHistory.html) API to view the complete extension history for a training plan.

The following example uses an AWS CLI command to retrieve the extension history.

```
aws sagemaker describe-training-plan-extension-history \
--training-plan-arn "arn:aws:sagemaker:us-east-2:123456789012:training-plan/my-training-plan"
```

This JSON document is a sample response from the SageMaker training plans API. The response includes a paginated list of all extensions for the training plan.

```
{
    "TrainingPlanExtensions": [
        {
            "TrainingPlanExtensionOfferingId": "tpeo-SHA-256-hash-value",
            "ExtendedAt": "2025-09-17T10:00:00Z",
            "StartDate": "2025-09-23T12:00:00Z",
            "EndDate": "2025-09-25T12:00:00Z",
            "Status": "Active",
            "PaymentStatus": "Completed",
            "AvailabilityZone": "us-east-2a",
            "DurationHours": 48,
            "UpfrontFee": "xxxx.xx",
            "CurrencyCode": "USD"
        }
    ],
    "NextToken": null
}
```

The following sections define the mandatory and optional input request parameters for the `DescribeTrainingPlanExtensionHistory` API operation.

## Required parameters
<a name="describe-extension-history-required-params"></a>

When calling the [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingPlanExtensionHistory.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingPlanExtensionHistory.html) API, you must provide the following value:
+ `TrainingPlanArn`: The of the training plan to retrieve extension history for.

## Optional parameters
<a name="describe-extension-history-optional-params"></a>

The following sections provide details on some optional parameters that you can pass to your `DescribeTrainingPlanExtensionHistory` API request.
+ `NextToken`: If the previous response was truncated, you receive this token. Use it in your next request to receive the next set of results.
+ `MaxResults`: The maximum number of extensions to return in the response.

## Extension status values
<a name="extension-status-values-api"></a>

Extensions can have the following status values:
+ `Pending`: The extension has been requested and is awaiting payment processing.
+ `Active`: The extension has been successfully purchased and is active.
+ `Scheduled`: The extension is scheduled to start at a future time.
+ `Failed`: The extension purchase failed (for example, due to payment issues).
+ `Expired`: The extension period has ended.