java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:35.246Z") @Stability(Stable) public class CfnModel extends CfnResource implements IInspectable
A CloudFormation AWS::SageMaker::Model.

The AWS::SageMaker::Model resource to create a model to host at an Amazon SageMaker endpoint. For more information, see Deploying a Model on Amazon SageMaker Hosting Services in the Amazon SageMaker Developer Guide .

Example:

 // 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.*;
 Object environment;
 CfnModel cfnModel = CfnModel.Builder.create(this, "MyCfnModel")
         .executionRoleArn("executionRoleArn")
         // the properties below are optional
         .containers(List.of(ContainerDefinitionProperty.builder()
                 .containerHostname("containerHostname")
                 .environment(environment)
                 .image("image")
                 .imageConfig(ImageConfigProperty.builder()
                         .repositoryAccessMode("repositoryAccessMode")
                         // the properties below are optional
                         .repositoryAuthConfig(RepositoryAuthConfigProperty.builder()
                                 .repositoryCredentialsProviderArn("repositoryCredentialsProviderArn")
                                 .build())
                         .build())
                 .inferenceSpecificationName("inferenceSpecificationName")
                 .mode("mode")
                 .modelDataUrl("modelDataUrl")
                 .modelPackageName("modelPackageName")
                 .multiModelConfig(MultiModelConfigProperty.builder()
                         .modelCacheSetting("modelCacheSetting")
                         .build())
                 .build()))
         .enableNetworkIsolation(false)
         .inferenceExecutionConfig(InferenceExecutionConfigProperty.builder()
                 .mode("mode")
                 .build())
         .modelName("modelName")
         .primaryContainer(ContainerDefinitionProperty.builder()
                 .containerHostname("containerHostname")
                 .environment(environment)
                 .image("image")
                 .imageConfig(ImageConfigProperty.builder()
                         .repositoryAccessMode("repositoryAccessMode")
                         // the properties below are optional
                         .repositoryAuthConfig(RepositoryAuthConfigProperty.builder()
                                 .repositoryCredentialsProviderArn("repositoryCredentialsProviderArn")
                                 .build())
                         .build())
                 .inferenceSpecificationName("inferenceSpecificationName")
                 .mode("mode")
                 .modelDataUrl("modelDataUrl")
                 .modelPackageName("modelPackageName")
                 .multiModelConfig(MultiModelConfigProperty.builder()
                         .modelCacheSetting("modelCacheSetting")
                         .build())
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .vpcConfig(VpcConfigProperty.builder()
                 .securityGroupIds(List.of("securityGroupIds"))
                 .subnets(List.of("subnets"))
                 .build())
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnModel

      protected CfnModel(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnModel

      protected CfnModel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnModel

      @Stability(Stable) public CfnModel(@NotNull Construct scope, @NotNull String id, @NotNull CfnModelProps props)
      Create a new AWS::SageMaker::Model.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrModelName

      @Stability(Stable) @NotNull public String getAttrModelName()
      The name of the model, such as MyModel .
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      A list of key-value pairs to apply to this resource.

      For more information, see Resource Tag and Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide .

    • getExecutionRoleArn

      @Stability(Stable) @NotNull public String getExecutionRoleArn()
      The Amazon Resource Name (ARN) of the IAM role that SageMaker can assume to access model artifacts and docker image for deployment on ML compute instances or for batch transform jobs.

      Deploying on ML compute instances is part of model hosting. For more information, see SageMaker Roles .

      To be able to pass this role to SageMaker, the caller of this API must have the iam:PassRole permission.

    • setExecutionRoleArn

      @Stability(Stable) public void setExecutionRoleArn(@NotNull String value)
      The Amazon Resource Name (ARN) of the IAM role that SageMaker can assume to access model artifacts and docker image for deployment on ML compute instances or for batch transform jobs.

      Deploying on ML compute instances is part of model hosting. For more information, see SageMaker Roles .

      To be able to pass this role to SageMaker, the caller of this API must have the iam:PassRole permission.

    • getContainers

      @Stability(Stable) @Nullable public Object getContainers()
      Specifies the containers in the inference pipeline.
    • setContainers

      @Stability(Stable) public void setContainers(@Nullable IResolvable value)
      Specifies the containers in the inference pipeline.
    • setContainers

      @Stability(Stable) public void setContainers(@Nullable List<Object> value)
      Specifies the containers in the inference pipeline.
    • getEnableNetworkIsolation

      @Stability(Stable) @Nullable public Object getEnableNetworkIsolation()
      Isolates the model container.

      No inbound or outbound network calls can be made to or from the model container.

    • setEnableNetworkIsolation

      @Stability(Stable) public void setEnableNetworkIsolation(@Nullable Boolean value)
      Isolates the model container.

      No inbound or outbound network calls can be made to or from the model container.

    • setEnableNetworkIsolation

      @Stability(Stable) public void setEnableNetworkIsolation(@Nullable IResolvable value)
      Isolates the model container.

      No inbound or outbound network calls can be made to or from the model container.

    • getInferenceExecutionConfig

      @Stability(Stable) @Nullable public Object getInferenceExecutionConfig()
      Specifies details of how containers in a multi-container endpoint are called.
    • setInferenceExecutionConfig

      @Stability(Stable) public void setInferenceExecutionConfig(@Nullable IResolvable value)
      Specifies details of how containers in a multi-container endpoint are called.
    • setInferenceExecutionConfig

      @Stability(Stable) public void setInferenceExecutionConfig(@Nullable CfnModel.InferenceExecutionConfigProperty value)
      Specifies details of how containers in a multi-container endpoint are called.
    • getModelName

      @Stability(Stable) @Nullable public String getModelName()
      The name of the new model.
    • setModelName

      @Stability(Stable) public void setModelName(@Nullable String value)
      The name of the new model.
    • getPrimaryContainer

      @Stability(Stable) @Nullable public Object getPrimaryContainer()
      The location of the primary docker image containing inference code, associated artifacts, and custom environment map that the inference code uses when the model is deployed for predictions.
    • setPrimaryContainer

      @Stability(Stable) public void setPrimaryContainer(@Nullable IResolvable value)
      The location of the primary docker image containing inference code, associated artifacts, and custom environment map that the inference code uses when the model is deployed for predictions.
    • setPrimaryContainer

      @Stability(Stable) public void setPrimaryContainer(@Nullable CfnModel.ContainerDefinitionProperty value)
      The location of the primary docker image containing inference code, associated artifacts, and custom environment map that the inference code uses when the model is deployed for predictions.
    • getVpcConfig

      @Stability(Stable) @Nullable public Object getVpcConfig()
      A VpcConfig object that specifies the VPC that you want your model to connect to. Control access to and from your model container by configuring the VPC. VpcConfig is used in hosting services and in batch transform. For more information, see Protect Endpoints by Using an Amazon Virtual Private Cloud and Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud .
    • setVpcConfig

      @Stability(Stable) public void setVpcConfig(@Nullable IResolvable value)
      A VpcConfig object that specifies the VPC that you want your model to connect to. Control access to and from your model container by configuring the VPC. VpcConfig is used in hosting services and in batch transform. For more information, see Protect Endpoints by Using an Amazon Virtual Private Cloud and Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud .
    • setVpcConfig

      @Stability(Stable) public void setVpcConfig(@Nullable CfnModel.VpcConfigProperty value)
      A VpcConfig object that specifies the VPC that you want your model to connect to. Control access to and from your model container by configuring the VPC. VpcConfig is used in hosting services and in batch transform. For more information, see Protect Endpoints by Using an Amazon Virtual Private Cloud and Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud .