Class CfnModel
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.sagemaker.CfnModel
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggable,IModelRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-04T09:27:49.758Z")
@Stability(Stable)
public class CfnModel
extends CfnResource
implements IInspectable, IModelRef, ITaggable
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")
.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")
.modelDataSource(ModelDataSourceProperty.builder()
.s3DataSource(S3DataSourceProperty.builder()
.compressionType("compressionType")
.s3DataType("s3DataType")
.s3Uri("s3Uri")
// the properties below are optional
.hubAccessConfig(HubAccessConfigProperty.builder()
.hubContentArn("hubContentArn")
.build())
.modelAccessConfig(ModelAccessConfigProperty.builder()
.acceptEula(false)
.build())
.build())
.build())
.modelDataUrl("modelDataUrl")
.modelPackageName("modelPackageName")
.multiModelConfig(MultiModelConfigProperty.builder()
.modelCacheSetting("modelCacheSetting")
.build())
.build()))
.enableNetworkIsolation(false)
.executionRoleArn("executionRoleArn")
.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")
.modelDataSource(ModelDataSourceProperty.builder()
.s3DataSource(S3DataSourceProperty.builder()
.compressionType("compressionType")
.s3DataType("s3DataType")
.s3Uri("s3Uri")
// the properties below are optional
.hubAccessConfig(HubAccessConfigProperty.builder()
.hubContentArn("hubContentArn")
.build())
.modelAccessConfig(ModelAccessConfigProperty.builder()
.acceptEula(false)
.build())
.build())
.build())
.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();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnModel.static interfaceDescribes the container, as part of model definition.static interfaceThe configuration for a private hub model reference that points to a public SageMaker JumpStart model.static interfaceSpecifies whether the model container is in Amazon ECR or a private Docker registry accessible from your Amazon Virtual Private Cloud (VPC).static interfaceSpecifies details about how containers in a multi-container endpoint are run.static interfaceThe access configuration file to control access to the ML model.static interfaceSpecifies the location of ML model data to deploy.static interfaceSpecifies additional configuration for hosting multi-model endpoints.static interfaceSpecifies an authentication configuration for the private docker registry where your model image is hosted.static interfaceDescribes the S3 data source.static interfaceSpecifies an Amazon Virtual Private Cloud (VPC) that your SageMaker jobs, hosted models, and compute resources have access to.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.sagemaker.IModelRef
IModelRef.Jsii$Default, IModelRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnModel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnModel(software.amazon.jsii.JsiiObjectRef objRef) CfnModel(software.constructs.Construct scope, String id, CfnModelProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe name of the model, such asMyModel.Specifies the containers in the inference pipeline.Isolates the model container.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.Specifies details of how containers in a multi-container endpoint are called.The name of the new model.A reference to a Model resource.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.getTags()Tag Manager which manages the tags for this resource.A list of key-value pairs to apply to this resource.A VpcConfig object that specifies the VPC that you want your model to connect to.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetContainers(List<Object> value) Specifies the containers in the inference pipeline.voidsetContainers(IResolvable value) Specifies the containers in the inference pipeline.voidsetEnableNetworkIsolation(Boolean value) Isolates the model container.voidIsolates the model container.voidsetExecutionRoleArn(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.voidSpecifies details of how containers in a multi-container endpoint are called.voidSpecifies details of how containers in a multi-container endpoint are called.voidsetModelName(String value) The name of the new model.voidsetPrimaryContainer(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.voidThe 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.voidsetTagsRaw(List<CfnTag> value) A list of key-value pairs to apply to this resource.voidsetVpcConfig(IResolvable value) A VpcConfig object that specifies the VPC that you want your model to connect to.voidA VpcConfig object that specifies the VPC that you want your model to connect to.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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 software.constructs.Construct scope, @NotNull String id, @Nullable CfnModelProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnModel
@Stability(Stable) public CfnModel(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrId
-
getAttrModelName
The name of the model, such asMyModel. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getModelRef
A reference to a Model resource.- Specified by:
getModelRefin interfaceIModelRef
-
getTags
Tag Manager which manages the tags for this resource. -
getContainers
Specifies the containers in the inference pipeline.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnModel.ContainerDefinitionProperty> -
setContainers
Specifies the containers in the inference pipeline. -
setContainers
Specifies the containers in the inference pipeline. -
getEnableNetworkIsolation
Isolates the model container.Returns union: either
BooleanorIResolvable -
setEnableNetworkIsolation
Isolates the model container. -
setEnableNetworkIsolation
Isolates the model container. -
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. -
setExecutionRoleArn
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. -
getInferenceExecutionConfig
Specifies details of how containers in a multi-container endpoint are called.Returns union: either
IResolvableorCfnModel.InferenceExecutionConfigProperty -
setInferenceExecutionConfig
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
The name of the new model. -
setModelName
The name of the new model. -
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.Returns union: either
IResolvableorCfnModel.ContainerDefinitionProperty -
setPrimaryContainer
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. -
getTagsRaw
A list of key-value pairs to apply to this resource. -
setTagsRaw
A list of key-value pairs to apply to this resource. -
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.VpcConfigis 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 .Returns union: either
IResolvableorCfnModel.VpcConfigProperty -
setVpcConfig
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.VpcConfigis 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
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.VpcConfigis 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 .
-