Skip to content
v2.277.0

Experimental

@aws-cdk/aws-sagemaker-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ModelProps Struct ​

Construction properties for a SageMaker Model.

Example ​

ts
import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha';

declare const image: sagemaker.ContainerImage;
declare const modelData: sagemaker.ModelData;

const model = new sagemaker.Model(this, 'ContainerModel', {
  containers: [
    {
      image,
      modelData,
    }
  ],
  networkIsolation: true,
});
python
import aws_cdk.aws_sagemaker_alpha as sagemaker

# image: sagemaker.ContainerImage
# model_data: sagemaker.ModelData


model = sagemaker.Model(self, "ContainerModel",
    containers=[sagemaker.ContainerDefinition(
        image=image,
        model_data=model_data
    )
    ],
    network_isolation=True
)
java
import software.amazon.awscdk.services.sagemaker.alpha.*;

ContainerImage image;
ModelData modelData;


Model model = Model.Builder.create(this, "ContainerModel")
        .containers(List.of(ContainerDefinition.builder()
                .image(image)
                .modelData(modelData)
                .build()))
        .networkIsolation(true)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Sagemaker.Alpha
using Amazon.CDK.AWS.Sagemaker.Alpha;

ContainerImage image;
ModelData modelData;


var model = new Model(this, "ContainerModel", new ModelProps {
    Containers = new [] { new ContainerDefinition {
        Image = image,
        ModelData = modelData
    } },
    NetworkIsolation = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdksagemakeralpha/v2
import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"

var image ContainerImage
var modelData ModelData


model := sagemaker.NewModel(this, jsii.String("ContainerModel"), &ModelProps{
	Containers: []ContainerDefinition{
		&ContainerDefinition{
			Image: *Image,
			ModelData: *ModelData,
		},
	},
	NetworkIsolation: jsii.Boolean(true),
})

Properties ​

allowAllOutboundoptionalbooleanallow_all_outboundoptionalboolallowAllOutboundoptionalBooleanAllowAllOutboundoptionalboolAllowAllOutboundoptional*bool = true #
Whether to allow the SageMaker Model to send all network traffic.

If set to false, you must individually add traffic rules to allow the SageMaker Model to connect to network targets.

Only used if 'vpc' is supplied.

containersoptionalContainerDefinition[]containersoptionaltyping.List[ContainerDefinition]containersoptionalList<ContainerDefinition>ContainersoptionalContainerDefinition[]Containersoptional*[]ContainerDefinition = none #
Specifies the container definitions for this model, consisting of either a single primary container or an inference pipeline of multiple containers.
modelNameoptionalstringmodel_nameoptionalstrmodelNameoptionalStringModelNameoptionalstringModelNameoptional*string #
Name of the SageMaker Model.

Default: AWS CloudFormation generates a unique physical ID and uses that ID for the model's name.

networkIsolationoptionalbooleannetwork_isolationoptionalboolnetworkIsolationoptionalBooleanNetworkIsolationoptionalboolNetworkIsolationoptional*bool = false #
Whether to enable network isolation for the model container.

When enabled, no inbound or outbound network calls can be made to or from the model container.

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole #
The IAM role that the Amazon SageMaker service assumes.

Default: a new IAM role will be created with the AmazonSageMakerFullAccess policy attached.

securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup #
The security groups to associate to the Model.

Default: A security group will be automatically created if 'vpc' is supplied

If no security groups are provided and 'vpc' is configured, one security group will be created automatically.

vpcoptionalIVpcvpcoptionalIVpcvpcoptionalIVpcVpcoptionalIVpcVpcoptionalIVpc = none #
The VPC to deploy model containers to.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection = none #
The VPC subnets to use when deploying model containers.