Skip to content
v2.277.0

ProductionVariantProperty Struct ​

Specifies a model that you want to host and the resources to deploy for hosting it.

If you are deploying multiple models, tell Amazon SageMaker how to distribute traffic among the models by specifying the InitialVariantWeight objects.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_sagemaker as sagemaker } from 'aws-cdk-lib';
const productionVariantProperty: sagemaker.CfnEndpointConfig.ProductionVariantProperty = {
  variantName: 'variantName',

  // the properties below are optional
  acceleratorType: 'acceleratorType',
  capacityReservationConfig: {
    capacityReservationPreference: 'capacityReservationPreference',
    mlReservationArn: 'mlReservationArn',
  },
  containerStartupHealthCheckTimeoutInSeconds: 123,
  coreDumpConfig: {
    destinationS3Uri: 'destinationS3Uri',

    // the properties below are optional
    kmsKeyId: 'kmsKeyId',
  },
  enableSsmAccess: false,
  inferenceAmiVersion: 'inferenceAmiVersion',
  initialInstanceCount: 123,
  initialVariantWeight: 123,
  instancePools: [{
    instanceType: 'instanceType',
    priority: 123,

    // the properties below are optional
    modelNameOverride: 'modelNameOverride',
  }],
  instanceType: 'instanceType',
  managedInstanceScaling: {
    maxInstanceCount: 123,
    minInstanceCount: 123,
    scaleInPolicy: {
      strategy: 'strategy',

      // the properties below are optional
      cooldownInMinutes: 123,
      maximumStepSize: 123,
    },
    status: 'status',
  },
  modelDataDownloadTimeoutInSeconds: 123,
  modelName: 'modelName',
  routingConfig: {
    prefixAwareRoutingConfig: {
      concurrencyThreshold: 123,
      prefixLength: 123,
    },
    routingStrategy: 'routingStrategy',
  },
  serverlessConfig: {
    maxConcurrency: 123,
    memorySizeInMb: 123,

    // the properties below are optional
    provisionedConcurrency: 123,
  },
  variantInstanceProvisionTimeoutInSeconds: 123,
  volumeSizeInGb: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_sagemaker as sagemaker

production_variant_property = sagemaker.CfnEndpointConfig.ProductionVariantProperty(
    variant_name="variantName",

    # the properties below are optional
    accelerator_type="acceleratorType",
    capacity_reservation_config=sagemaker.CfnEndpointConfig.CapacityReservationConfigProperty(
        capacity_reservation_preference="capacityReservationPreference",
        ml_reservation_arn="mlReservationArn"
    ),
    container_startup_health_check_timeout_in_seconds=123,
    core_dump_config=sagemaker.CfnEndpointConfig.CoreDumpConfigProperty(
        destination_s3_uri="destinationS3Uri",

        # the properties below are optional
        kms_key_id="kmsKeyId"
    ),
    enable_ssm_access=False,
    inference_ami_version="inferenceAmiVersion",
    initial_instance_count=123,
    initial_variant_weight=123,
    instance_pools=[sagemaker.CfnEndpointConfig.InstancePoolProperty(
        instance_type="instanceType",
        priority=123,

        # the properties below are optional
        model_name_override="modelNameOverride"
    )],
    instance_type="instanceType",
    managed_instance_scaling=sagemaker.CfnEndpointConfig.ManagedInstanceScalingProperty(
        max_instance_count=123,
        min_instance_count=123,
        scale_in_policy=sagemaker.CfnEndpointConfig.ScaleInPolicyProperty(
            strategy="strategy",

            # the properties below are optional
            cooldown_in_minutes=123,
            maximum_step_size=123
        ),
        status="status"
    ),
    model_data_download_timeout_in_seconds=123,
    model_name="modelName",
    routing_config=sagemaker.CfnEndpointConfig.RoutingConfigProperty(
        prefix_aware_routing_config=sagemaker.CfnEndpointConfig.PrefixAwareRoutingConfigProperty(
            concurrency_threshold=123,
            prefix_length=123
        ),
        routing_strategy="routingStrategy"
    ),
    serverless_config=sagemaker.CfnEndpointConfig.ServerlessConfigProperty(
        max_concurrency=123,
        memory_size_in_mb=123,

        # the properties below are optional
        provisioned_concurrency=123
    ),
    variant_instance_provision_timeout_in_seconds=123,
    volume_size_in_gb=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.sagemaker.*;

ProductionVariantProperty productionVariantProperty = ProductionVariantProperty.builder()
        .variantName("variantName")

        // the properties below are optional
        .acceleratorType("acceleratorType")
        .capacityReservationConfig(CapacityReservationConfigProperty.builder()
                .capacityReservationPreference("capacityReservationPreference")
                .mlReservationArn("mlReservationArn")
                .build())
        .containerStartupHealthCheckTimeoutInSeconds(123)
        .coreDumpConfig(CoreDumpConfigProperty.builder()
                .destinationS3Uri("destinationS3Uri")

                // the properties below are optional
                .kmsKeyId("kmsKeyId")
                .build())
        .enableSsmAccess(false)
        .inferenceAmiVersion("inferenceAmiVersion")
        .initialInstanceCount(123)
        .initialVariantWeight(123)
        .instancePools(List.of(InstancePoolProperty.builder()
                .instanceType("instanceType")
                .priority(123)

                // the properties below are optional
                .modelNameOverride("modelNameOverride")
                .build()))
        .instanceType("instanceType")
        .managedInstanceScaling(ManagedInstanceScalingProperty.builder()
                .maxInstanceCount(123)
                .minInstanceCount(123)
                .scaleInPolicy(ScaleInPolicyProperty.builder()
                        .strategy("strategy")

                        // the properties below are optional
                        .cooldownInMinutes(123)
                        .maximumStepSize(123)
                        .build())
                .status("status")
                .build())
        .modelDataDownloadTimeoutInSeconds(123)
        .modelName("modelName")
        .routingConfig(RoutingConfigProperty.builder()
                .prefixAwareRoutingConfig(PrefixAwareRoutingConfigProperty.builder()
                        .concurrencyThreshold(123)
                        .prefixLength(123)
                        .build())
                .routingStrategy("routingStrategy")
                .build())
        .serverlessConfig(ServerlessConfigProperty.builder()
                .maxConcurrency(123)
                .memorySizeInMb(123)

                // the properties below are optional
                .provisionedConcurrency(123)
                .build())
        .variantInstanceProvisionTimeoutInSeconds(123)
        .volumeSizeInGb(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Sagemaker;

var productionVariantProperty = new ProductionVariantProperty {
    VariantName = "variantName",

    // the properties below are optional
    AcceleratorType = "acceleratorType",
    CapacityReservationConfig = new CapacityReservationConfigProperty {
        CapacityReservationPreference = "capacityReservationPreference",
        MlReservationArn = "mlReservationArn"
    },
    ContainerStartupHealthCheckTimeoutInSeconds = 123,
    CoreDumpConfig = new CoreDumpConfigProperty {
        DestinationS3Uri = "destinationS3Uri",

        // the properties below are optional
        KmsKeyId = "kmsKeyId"
    },
    EnableSsmAccess = false,
    InferenceAmiVersion = "inferenceAmiVersion",
    InitialInstanceCount = 123,
    InitialVariantWeight = 123,
    InstancePools = new [] { new InstancePoolProperty {
        InstanceType = "instanceType",
        Priority = 123,

        // the properties below are optional
        ModelNameOverride = "modelNameOverride"
    } },
    InstanceType = "instanceType",
    ManagedInstanceScaling = new ManagedInstanceScalingProperty {
        MaxInstanceCount = 123,
        MinInstanceCount = 123,
        ScaleInPolicy = new ScaleInPolicyProperty {
            Strategy = "strategy",

            // the properties below are optional
            CooldownInMinutes = 123,
            MaximumStepSize = 123
        },
        Status = "status"
    },
    ModelDataDownloadTimeoutInSeconds = 123,
    ModelName = "modelName",
    RoutingConfig = new RoutingConfigProperty {
        PrefixAwareRoutingConfig = new PrefixAwareRoutingConfigProperty {
            ConcurrencyThreshold = 123,
            PrefixLength = 123
        },
        RoutingStrategy = "routingStrategy"
    },
    ServerlessConfig = new ServerlessConfigProperty {
        MaxConcurrency = 123,
        MemorySizeInMb = 123,

        // the properties below are optional
        ProvisionedConcurrency = 123
    },
    VariantInstanceProvisionTimeoutInSeconds = 123,
    VolumeSizeInGb = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

productionVariantProperty := &ProductionVariantProperty{
	VariantName: jsii.String("variantName"),

	// the properties below are optional
	AcceleratorType: jsii.String("acceleratorType"),
	CapacityReservationConfig: &CapacityReservationConfigProperty{
		CapacityReservationPreference: jsii.String("capacityReservationPreference"),
		MlReservationArn: jsii.String("mlReservationArn"),
	},
	ContainerStartupHealthCheckTimeoutInSeconds: jsii.Number(123),
	CoreDumpConfig: &CoreDumpConfigProperty{
		DestinationS3Uri: jsii.String("destinationS3Uri"),

		// the properties below are optional
		KmsKeyId: jsii.String("kmsKeyId"),
	},
	EnableSsmAccess: jsii.Boolean(false),
	InferenceAmiVersion: jsii.String("inferenceAmiVersion"),
	InitialInstanceCount: jsii.Number(123),
	InitialVariantWeight: jsii.Number(123),
	InstancePools: []interface{}{
		&InstancePoolProperty{
			InstanceType: jsii.String("instanceType"),
			Priority: jsii.Number(123),

			// the properties below are optional
			ModelNameOverride: jsii.String("modelNameOverride"),
		},
	},
	InstanceType: jsii.String("instanceType"),
	ManagedInstanceScaling: &ManagedInstanceScalingProperty{
		MaxInstanceCount: jsii.Number(123),
		MinInstanceCount: jsii.Number(123),
		ScaleInPolicy: &ScaleInPolicyProperty{
			Strategy: jsii.String("strategy"),

			// the properties below are optional
			CooldownInMinutes: jsii.Number(123),
			MaximumStepSize: jsii.Number(123),
		},
		Status: jsii.String("status"),
	},
	ModelDataDownloadTimeoutInSeconds: jsii.Number(123),
	ModelName: jsii.String("modelName"),
	RoutingConfig: &RoutingConfigProperty{
		PrefixAwareRoutingConfig: &PrefixAwareRoutingConfigProperty{
			ConcurrencyThreshold: jsii.Number(123),
			PrefixLength: jsii.Number(123),
		},
		RoutingStrategy: jsii.String("routingStrategy"),
	},
	ServerlessConfig: &ServerlessConfigProperty{
		MaxConcurrency: jsii.Number(123),
		MemorySizeInMb: jsii.Number(123),

		// the properties below are optional
		ProvisionedConcurrency: jsii.Number(123),
	},
	VariantInstanceProvisionTimeoutInSeconds: jsii.Number(123),
	VolumeSizeInGb: jsii.Number(123),
}

Properties ​

acceleratorTypeoptionalstringaccelerator_typeoptionalstracceleratorTypeoptionalStringAcceleratorTypeoptionalstringAcceleratorTypeoptional*string#
The size of the Elastic Inference (EI) instance to use for the production variant.
notes

EI instances provide on-demand GPU computing for inference. For more information, see Using Elastic Inference in Amazon SageMaker . For more information, see Using Elastic Inference in Amazon SageMaker .

capacityReservationConfigoptionalIResolvable | CfnEndpointConfig.CapacityReservationConfigPropertycapacity_reservation_configoptionaltyping.Union[IResolvable, CapacityReservationConfigProperty]capacityReservationConfigoptionalIResolvableCapacityReservationConfigoptionalIResolvableCapacityReservationConfigoptionalinterface{}#
Settings for the capacity reservation for the compute instances that SageMaker AI reserves for an endpoint.
containerStartupHealthCheckTimeoutInSecondsoptionalnumbercontainer_startup_health_check_timeout_in_secondsoptionalint | floatcontainerStartupHealthCheckTimeoutInSecondsoptionalNumberContainerStartupHealthCheckTimeoutInSecondsoptionaldoubleContainerStartupHealthCheckTimeoutInSecondsoptional*float64#
The timeout value, in seconds, for your inference container to pass health check by SageMaker Hosting.
notes

For more information about health check, see How Your Container Should Respond to Health Check (Ping) Requests .

coreDumpConfigoptionalIResolvable | CfnEndpointConfig.CoreDumpConfigPropertycore_dump_configoptionaltyping.Union[IResolvable, CoreDumpConfigProperty]coreDumpConfigoptionalIResolvableCoreDumpConfigoptionalIResolvableCoreDumpConfigoptionalinterface{}#
Specifies where SageMaker writes core dumps from the model container when the process crashes, and how it encrypts them.
enableSsmAccessoptionalboolean | IResolvableenable_ssm_accessoptionaltyping.Union[bool, IResolvable]enableSsmAccessoptionalBooleanEnableSsmAccessoptionalboolEnableSsmAccessoptionalinterface{}#
You can use this parameter to turn on native AWS Systems Manager (SSM) access for a production variant behind an endpoint.
notes

By default, SSM access is disabled for all production variants behind an endpoint. You can turn on or turn off SSM access for a production variant behind an existing endpoint by creating a new endpoint configuration and calling UpdateEndpoint .

inferenceAmiVersionoptionalstringinference_ami_versionoptionalstrinferenceAmiVersionoptionalStringInferenceAmiVersionoptionalstringInferenceAmiVersionoptional*string#
Specifies an option from a collection of preconfigured Amazon Machine Image (AMI) images.
notes

Each image is configured by AWS with a set of software and driver versions. AWS optimizes these configurations for different machine learning workloads. By selecting an AMI version, you can ensure that your inference environment is compatible with specific software requirements, such as CUDA driver versions, Linux kernel versions, or AWS Neuron driver versions

initialInstanceCountoptionalnumberinitial_instance_countoptionalint | floatinitialInstanceCountoptionalNumberInitialInstanceCountoptionaldoubleInitialInstanceCountoptional*float64#
Number of instances to launch initially.
initialVariantWeightoptionalnumberinitial_variant_weightoptionalint | floatinitialVariantWeightoptionalNumberInitialVariantWeightoptionaldoubleInitialVariantWeightoptional*float64#
Determines initial traffic distribution among all of the models that you specify in the endpoint configuration.

The traffic to a production variant is determined by the ratio of the VariantWeight to the sum of all VariantWeight values across all ProductionVariants. If unspecified, it defaults to 1.0.

instancePoolsoptionalIResolvable | IResolvable | CfnEndpointConfig.InstancePoolProperty[]instance_poolsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InstancePoolProperty]]]instancePoolsoptionalIResolvableInstancePoolsoptionalIResolvableInstancePoolsoptionalinterface{}#
A list of instance pools for the production variant.

Each instance pool specifies an instance type and its priority for provisioning. Use instance pools to configure heterogeneous endpoints that deploy models across multiple instance types.

instanceTypeoptionalstringinstance_typeoptionalstrinstanceTypeoptionalStringInstanceTypeoptionalstringInstanceTypeoptional*string#
The ML compute instance type.
managedInstanceScalingoptionalIResolvable | CfnEndpointConfig.ManagedInstanceScalingPropertymanaged_instance_scalingoptionaltyping.Union[IResolvable, ManagedInstanceScalingProperty]managedInstanceScalingoptionalIResolvableManagedInstanceScalingoptionalIResolvableManagedInstanceScalingoptionalinterface{}#
Settings that control the range in the number of instances that the endpoint provisions as it scales up or down to accommodate traffic.
modelDataDownloadTimeoutInSecondsoptionalnumbermodel_data_download_timeout_in_secondsoptionalint | floatmodelDataDownloadTimeoutInSecondsoptionalNumberModelDataDownloadTimeoutInSecondsoptionaldoubleModelDataDownloadTimeoutInSecondsoptional*float64#
The timeout value, in seconds, to download and extract the model that you want to host from Amazon S3 to the individual inference instance associated with this production variant.
modelNameoptionalstringmodel_nameoptionalstrmodelNameoptionalStringModelNameoptionalstringModelNameoptional*string#
The name of the model that you want to host.

This is the name that you specified when creating the model.

routingConfigoptionalIResolvable | CfnEndpointConfig.RoutingConfigPropertyrouting_configoptionaltyping.Union[IResolvable, RoutingConfigProperty]routingConfigoptionalIResolvableRoutingConfigoptionalIResolvableRoutingConfigoptionalinterface{}#
Settings that control how the endpoint routes incoming traffic to the instances that the endpoint hosts.
serverlessConfigoptionalIResolvable | CfnEndpointConfig.ServerlessConfigPropertyserverless_configoptionaltyping.Union[IResolvable, ServerlessConfigProperty]serverlessConfigoptionalIResolvableServerlessConfigoptionalIResolvableServerlessConfigoptionalinterface{}#
The serverless configuration for an endpoint.

Specifies a serverless endpoint configuration instead of an instance-based endpoint configuration.

variantInstanceProvisionTimeoutInSecondsoptionalnumbervariant_instance_provision_timeout_in_secondsoptionalint | floatvariantInstanceProvisionTimeoutInSecondsoptionalNumberVariantInstanceProvisionTimeoutInSecondsoptionaldoubleVariantInstanceProvisionTimeoutInSecondsoptional*float64#
The timeout value, in seconds, for provisioning instances for the production variant.
notes

When SageMaker encounters an insufficient capacity error while provisioning instances, it retries with the next instance pool (if configured) or waits until the timeout expires. This timeout applies only to capacity provisioning and does not include the time for model download or container startup.

variantNamestringvariant_namestrvariantNameStringVariantNamestringVariantName*stringrequired#
The name of the production variant.
volumeSizeInGboptionalnumbervolume_size_in_gboptionalint | floatvolumeSizeInGboptionalNumberVolumeSizeInGboptionaldoubleVolumeSizeInGboptional*float64#
The size, in GB, of the ML storage volume attached to individual inference instance associated with the production variant.

Currently only Amazon EBS gp2 storage volumes are supported.