@@ -26,7 +26,14 @@ class PipelineModel(object):
2626 """
2727
2828 def __init__ (
29- self , models , role , predictor_cls = None , name = None , vpc_config = None , sagemaker_session = None
29+ self ,
30+ models ,
31+ role ,
32+ predictor_cls = None ,
33+ name = None ,
34+ vpc_config = None ,
35+ sagemaker_session = None ,
36+ enable_network_isolation = False ,
3037 ):
3138 """Initialize a SageMaker `Model` instance.
3239
@@ -57,13 +64,18 @@ def __init__(
5764 object, used for SageMaker interactions (default: None). If not
5865 specified, one is created using the default AWS configuration
5966 chain.
67+ enable_network_isolation (bool): Default False. if True, enables
68+ network isolation in the endpoint, isolating the model
69+ container. No inbound or outbound network calls can be made to
70+ or from the model container.Boolean
6071 """
6172 self .models = models
6273 self .role = role
6374 self .predictor_cls = predictor_cls
6475 self .name = name
6576 self .vpc_config = vpc_config
6677 self .sagemaker_session = sagemaker_session
78+ self .enable_network_isolation = enable_network_isolation
6779 self .endpoint_name = None
6880
6981 def pipeline_container_def (self , instance_type ):
@@ -157,7 +169,11 @@ def deploy(
157169
158170 self .name = self .name or name_from_image (containers [0 ]["Image" ])
159171 self .sagemaker_session .create_model (
160- self .name , self .role , containers , vpc_config = self .vpc_config
172+ self .name ,
173+ self .role ,
174+ containers ,
175+ vpc_config = self .vpc_config ,
176+ enable_network_isolation = self .enable_network_isolation ,
161177 )
162178
163179 production_variant = sagemaker .production_variant (
@@ -214,7 +230,11 @@ def _create_sagemaker_pipeline_model(self, instance_type):
214230
215231 self .name = self .name or name_from_image (containers [0 ]["Image" ])
216232 self .sagemaker_session .create_model (
217- self .name , self .role , containers , vpc_config = self .vpc_config
233+ self .name ,
234+ self .role ,
235+ containers ,
236+ vpc_config = self .vpc_config ,
237+ enable_network_isolation = self .enable_network_isolation ,
218238 )
219239
220240 def transformer (
0 commit comments