Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions aws/sagemaker-inference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This module builds and configures SageMaker inference models and endpoints

```terraform
module "basic_usage" {
source = "github.com/FriendsOfTerraform/aws-sagemaker-inference.git?ref=v1.0.0"
source = "github.com/FriendsOfTerraform/aws-sagemaker-inference.git?ref=v1.2.0"

# manages multiple models
models = {
Expand All @@ -45,9 +45,12 @@ module "basic_usage" {
realtime-endpoint = {
provisioned = {
production_variants = {
# must refer to models created by this module
demo-model = {
instance_type = "ml.m5.large"
# the keys of the map are variant names
demo-variant = {
instance_type = "ml.m5.large"

# must refer to models created by this module
model_name = "demo-model"

auto_scaling = {
policies = {
Expand Down Expand Up @@ -759,7 +762,7 @@ Specify the number of seconds to wait between scale-out actions.

#### production_variants

Configure multiple production variants, one for each model that you want to host at this endpoint.
Configure multiple production variants, one for each model that you want to host at this endpoint. The keys of the map are the variant names.

**Since:** 1.0.0

Expand All @@ -775,6 +778,18 @@ The EC2 instance type

**Since:** 1.0.0

</td></tr>
<tr>
<td><code>string</code></td>
<td width="100%">model_name</td>
<td></td>
</tr>
<tr><td colspan="3">

The name of the model to be hosted on this variant. The model specified must be managed by the same module

**Since:** 1.2.0

</td></tr>
<tr>
<td><code>string</code></td>
Expand Down Expand Up @@ -895,7 +910,7 @@ Creates a provisioned endpoint, mutually exclusive to `serverless`. Must specify
</tr>
<tr><td colspan="3">

Configure multiple production variants, one for each model that you want to host at this endpoint.
Configure multiple production variants, one for each model that you want to host at this endpoint. The keys of the map are the variant names.

**Since:** 1.0.0

Expand Down Expand Up @@ -931,7 +946,7 @@ Enables data capture, where SageMaker can save prediction request and prediction
</tr>
<tr><td colspan="3">

Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.
Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. The keys of the map are the variant names. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.

**Since:** 1.0.0

Expand Down Expand Up @@ -961,7 +976,7 @@ Configures variant for this endpoint

#### shadow_variants

Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.
Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. The keys of the map are the variant names. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.

**Since:** 1.0.0

Expand All @@ -977,6 +992,18 @@ The EC2 instance type

**Since:** 1.0.0

</td></tr>
<tr>
<td><code>string</code></td>
<td width="100%">model_name</td>
<td></td>
</tr>
<tr><td colspan="3">

The name of the model to be hosted on this variant. The model specified must be managed by the same module

**Since:** 1.2.0

</td></tr>
<tr>
<td><code>number</code></td>
Expand Down
8 changes: 4 additions & 4 deletions aws/sagemaker-inference/sagemaker-endpoint-configuration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ resource "aws_sagemaker_endpoint_configuration" "provisioned_endpoint_configurat
instance_type = production_variants.value.instance_type
initial_variant_weight = production_variants.value.initial_weight
model_data_download_timeout_in_seconds = production_variants.value.model_data_download_timeout != null ? split(" ", production_variants.value.model_data_download_timeout)[0] * local.time_table[trimsuffix(split(" ", production_variants.value.model_data_download_timeout)[1], "s")] : null
model_name = aws_sagemaker_model.models[production_variants.key].name
variant_name = aws_sagemaker_model.models[production_variants.key].name
model_name = aws_sagemaker_model.models[production_variants.value.model_name].name
variant_name = production_variants.key
volume_size_in_gb = production_variants.value.volume_size
}
}
Expand Down Expand Up @@ -91,8 +91,8 @@ resource "aws_sagemaker_endpoint_configuration" "provisioned_endpoint_configurat
instance_type = shadow_production_variants.value.instance_type
initial_variant_weight = shadow_production_variants.value.initial_weight
model_data_download_timeout_in_seconds = shadow_production_variants.value.model_data_download_timeout != null ? split(" ", shadow_production_variants.value.model_data_download_timeout)[0] * local.time_table[trimsuffix(split(" ", shadow_production_variants.value.model_data_download_timeout)[1], "s")] : null
model_name = aws_sagemaker_model.models[shadow_production_variants.key].name
variant_name = aws_sagemaker_model.models[shadow_production_variants.key].name
model_name = aws_sagemaker_model.models[shadow_production_variants.value.model_name].name
variant_name = shadow_production_variants.key
volume_size_in_gb = shadow_production_variants.value.volume_size
}
}
Expand Down
12 changes: 10 additions & 2 deletions aws/sagemaker-inference/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,18 @@ variable "endpoints" {
///
/// @since 1.0.0
provisioned = optional(object({
/// Configure multiple production variants, one for each model that you want to host at this endpoint.
/// Configure multiple production variants, one for each model that you want to host at this endpoint. The keys of the map are the variant names.
///
/// @since 1.0.0
production_variants = map(object({
/// The EC2 instance type
///
/// @since 1.0.0
instance_type = string
/// The name of the model to be hosted on this variant. The model specified must be managed by the same module
///
/// @since 1.2.0
model_name = string
/// The timeout value for the inference container to pass health check by SageMaker AI Hosting.
///
/// @enum 1 minute|1 hour
Expand Down Expand Up @@ -281,14 +285,18 @@ variable "endpoints" {
}), {})
}), null)

/// Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.
/// Specify shadow variants to receive production traffic replicated from the model specified on `production_variants`. The keys of the map are the variant names. If you use this field, you can only specify one variant for `production_variants` and one variant for `shadow_variants`.
///
/// @since 1.0.0
shadow_variants = optional(map(object({
/// The EC2 instance type
///
/// @since 1.0.0
instance_type = string
/// The name of the model to be hosted on this variant. The model specified must be managed by the same module
///
/// @since 1.2.0
model_name = string
/// The timeout value for the inference container to pass health check by SageMaker AI Hosting. Valid values: `"1 minute"` - `"1 hour"`
///
/// @since 1.0.0
Expand Down
Loading