@@ -26,7 +26,14 @@ class PipelineModel(object):
26
26
"""
27
27
28
28
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 ,
30
37
):
31
38
"""Initialize a SageMaker `Model` instance.
32
39
@@ -57,13 +64,18 @@ def __init__(
57
64
object, used for SageMaker interactions (default: None). If not
58
65
specified, one is created using the default AWS configuration
59
66
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
60
71
"""
61
72
self .models = models
62
73
self .role = role
63
74
self .predictor_cls = predictor_cls
64
75
self .name = name
65
76
self .vpc_config = vpc_config
66
77
self .sagemaker_session = sagemaker_session
78
+ self .enable_network_isolation = enable_network_isolation
67
79
self .endpoint_name = None
68
80
69
81
def pipeline_container_def (self , instance_type ):
@@ -157,7 +169,11 @@ def deploy(
157
169
158
170
self .name = self .name or name_from_image (containers [0 ]["Image" ])
159
171
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 ,
161
177
)
162
178
163
179
production_variant = sagemaker .production_variant (
@@ -214,7 +230,11 @@ def _create_sagemaker_pipeline_model(self, instance_type):
214
230
215
231
self .name = self .name or name_from_image (containers [0 ]["Image" ])
216
232
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 ,
218
238
)
219
239
220
240
def transformer (
0 commit comments