AWS Security ChangesHomeSearch

AWS sagemaker documentation change

Service: sagemaker · 2026-06-28 · Documentation low

File: sagemaker/latest/dg/deploy-models-frameworks-torchserve.md

Summary

Added SageMaker Python SDK v3 examples for deploying single-model and multi-model endpoints using ModelBuilder, including endpoint invocation code samples.

Security assessment

The changes provide updated SDK implementation examples for model deployment. No security configurations, vulnerabilities, or security-specific features are mentioned in the added content.

Diff

diff --git a/sagemaker/latest/dg/deploy-models-frameworks-torchserve.md b/sagemaker/latest/dg/deploy-models-frameworks-torchserve.md
index 8cb47dbe0..d238404f1 100644
--- a//sagemaker/latest/dg/deploy-models-frameworks-torchserve.md
+++ b//sagemaker/latest/dg/deploy-models-frameworks-torchserve.md
@@ -180,0 +181,39 @@ The following example shows you how to create a [single model real-time inferenc
+SageMaker Python SDK v3
+    
+    
+    
+    from sagemaker.serve import ModelBuilder
+    from sagemaker.core.resources import Endpoint
+    
+    # Create a ModelBuilder for the single model endpoint and deploy it on SageMaker AI
+    model_builder = ModelBuilder(
+        s3_model_data_url=f'{output_path}/mnist.tar.gz',
+        image_uri=baseimage,
+        role_arn=role,
+        model_server='TORCHSERVE'
+    )
+    
+    model_builder.build()
+                  
+    endpoint_name = 'torchserve-endpoint-' + time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
+    endpoint = model_builder.deploy(
+        instance_type='ml.g4dn.xlarge',
+        initial_instance_count=1,
+        endpoint_name=endpoint_name
+    )
+                                 
+    # test the endpoint
+    import random
+    import json
+    import numpy as np
+    dummy_data = {"inputs": np.random.rand(16, 1, 28, 28).tolist()}
+    
+    response = endpoint.invoke(
+        body=json.dumps(dummy_data),
+        content_type='application/json'
+    )
+    res = json.loads(response.body.read().decode('utf-8'))  
+
+SageMaker Python SDK v2 (Legacy)
+    
+    
@@ -214,0 +254,39 @@ The following example shows you how to create a multi-model endpoint, deploy the
+SageMaker Python SDK v3
+    
+    
+    
+    from sagemaker.serve import ModelBuilder
+    
+    # Create a ModelBuilder for the multi-model endpoint and deploy it on SageMaker AI
+    model_builder = ModelBuilder(
+        s3_model_data_url=f'{output_path}/mnist.tar.gz',
+        image_uri=baseimage,
+        role_arn=role,
+        model_server='TORCHSERVE'
+    )
+                  
+    endpoint_name = 'torchserve-endpoint-' + time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
+    model_builder.build()
+    endpoint = model_builder.deploy(
+        initial_instance_count=1,
+        instance_type="ml.g4dn.xlarge",
+        endpoint_name=endpoint_name,
+        model_data_download_timeout=1200
+    )
+    
+    # test the endpoint
+    import random
+    import json
+    import numpy as np
+    dummy_data = {"inputs": np.random.rand(16, 1, 28, 28).tolist()}
+    
+    response = endpoint.invoke(
+        body=json.dumps(dummy_data),
+        content_type='application/json',
+        target_model="mnist.tar.gz"
+    )
+    res = json.loads(response.body.read().decode('utf-8'))
+
+SageMaker Python SDK v2 (Legacy)
+    
+