CfnModel

class aws_cdk.aws_sagemaker.CfnModel(scope, id, *, execution_role_arn, containers=None, enable_network_isolation=None, inference_execution_config=None, model_name=None, primary_container=None, tags=None, vpc_config=None)

Bases: CfnResource

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 .

CloudformationResource

AWS::SageMaker::Model

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

# environment: Any

cfn_model = sagemaker.CfnModel(self, "MyCfnModel",
    execution_role_arn="executionRoleArn",

    # the properties below are optional
    containers=[sagemaker.CfnModel.ContainerDefinitionProperty(
        container_hostname="containerHostname",
        environment=environment,
        image="image",
        image_config=sagemaker.CfnModel.ImageConfigProperty(
            repository_access_mode="repositoryAccessMode",

            # the properties below are optional
            repository_auth_config=sagemaker.CfnModel.RepositoryAuthConfigProperty(
                repository_credentials_provider_arn="repositoryCredentialsProviderArn"
            )
        ),
        inference_specification_name="inferenceSpecificationName",
        mode="mode",
        model_data_url="modelDataUrl",
        model_package_name="modelPackageName",
        multi_model_config=sagemaker.CfnModel.MultiModelConfigProperty(
            model_cache_setting="modelCacheSetting"
        )
    )],
    enable_network_isolation=False,
    inference_execution_config=sagemaker.CfnModel.InferenceExecutionConfigProperty(
        mode="mode"
    ),
    model_name="modelName",
    primary_container=sagemaker.CfnModel.ContainerDefinitionProperty(
        container_hostname="containerHostname",
        environment=environment,
        image="image",
        image_config=sagemaker.CfnModel.ImageConfigProperty(
            repository_access_mode="repositoryAccessMode",

            # the properties below are optional
            repository_auth_config=sagemaker.CfnModel.RepositoryAuthConfigProperty(
                repository_credentials_provider_arn="repositoryCredentialsProviderArn"
            )
        ),
        inference_specification_name="inferenceSpecificationName",
        mode="mode",
        model_data_url="modelDataUrl",
        model_package_name="modelPackageName",
        multi_model_config=sagemaker.CfnModel.MultiModelConfigProperty(
            model_cache_setting="modelCacheSetting"
        )
    ),
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    vpc_config=sagemaker.CfnModel.VpcConfigProperty(
        security_group_ids=["securityGroupIds"],
        subnets=["subnets"]
    )
)

Create a new AWS::SageMaker::Model.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • execution_role_arn (str) – 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 . .. epigraph:: To be able to pass this role to SageMaker, the caller of this API must have the iam:PassRole permission.

  • containers (Union[IResolvable, Sequence[Union[IResolvable, ContainerDefinitionProperty, Dict[str, Any]]], None]) – Specifies the containers in the inference pipeline.

  • enable_network_isolation (Union[bool, IResolvable, None]) – Isolates the model container. No inbound or outbound network calls can be made to or from the model container.

  • inference_execution_config (Union[IResolvable, InferenceExecutionConfigProperty, Dict[str, Any], None]) – Specifies details of how containers in a multi-container endpoint are called.

  • model_name (Optional[str]) – The name of the new model.

  • primary_container (Union[IResolvable, ContainerDefinitionProperty, Dict[str, Any], None]) – 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.

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – 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 .

  • vpc_config (Union[IResolvable, VpcConfigProperty, Dict[str, Any], None]) – 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 .

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::SageMaker::Model'
attr_model_name

The name of the model, such as MyModel .

CloudformationAttribute

ModelName

Return type

str

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

containers

Specifies the containers in the inference pipeline.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-containers

Return type

Union[IResolvable, List[Union[IResolvable, ContainerDefinitionProperty]], None]

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

enable_network_isolation

Isolates the model container.

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-enablenetworkisolation

Return type

Union[bool, IResolvable, None]

execution_role_arn

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 . .. epigraph:

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

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-executionrolearn

Return type

str

inference_execution_config

Specifies details of how containers in a multi-container endpoint are called.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-inferenceexecutionconfig

Return type

Union[IResolvable, InferenceExecutionConfigProperty, None]

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

model_name

The name of the new model.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-modelname

Return type

Optional[str]

node

The construct tree node associated with this construct.

Return type

ConstructNode

primary_container

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-primarycontainer

Return type

Union[IResolvable, ContainerDefinitionProperty, None]

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

tags

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 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-tags

Return type

TagManager

vpc_config

//docs.aws.amazon.com/sagemaker/latest/dg/host-vpc.html>`_ and Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-vpcconfig

Type

A `VpcConfig <https

Type

//docs.aws.amazon.com/sagemaker/latest/dg/API_VpcConfig.html>`_ 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 <https

Return type

Union[IResolvable, VpcConfigProperty, None]

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

ContainerDefinitionProperty

class CfnModel.ContainerDefinitionProperty(*, container_hostname=None, environment=None, image=None, image_config=None, inference_specification_name=None, mode=None, model_data_url=None, model_package_name=None, multi_model_config=None)

Bases: object

Describes the container, as part of model definition.

Parameters
  • container_hostname (Optional[str]) – This parameter is ignored for models that contain only a PrimaryContainer . When a ContainerDefinition is part of an inference pipeline, the value of the parameter uniquely identifies the container for the purposes of logging and metrics. For information, see Use Logs and Metrics to Monitor an Inference Pipeline . If you don’t specify a value for this parameter for a ContainerDefinition that is part of an inference pipeline, a unique name is automatically assigned based on the position of the ContainerDefinition in the pipeline. If you specify a value for the ContainerHostName for any ContainerDefinition that is part of an inference pipeline, you must specify a value for the ContainerHostName parameter of every ContainerDefinition in that pipeline.

  • environment (Optional[Any]) – The environment variables to set in the Docker container. Each key and value in the Environment string to string map can have length of up to 1024. We support up to 16 entries in the map.

  • image (Optional[str]) – The path where inference code is stored. This can be either in Amazon EC2 Container Registry or in a Docker registry that is accessible from the same VPC that you configure for your endpoint. If you are using your own custom algorithm instead of an algorithm provided by SageMaker, the inference code must meet SageMaker requirements. SageMaker supports both registry/repository[:tag] and registry/repository[@digest] image path formats. For more information, see Using Your Own Algorithms with Amazon SageMaker

  • image_config (Union[IResolvable, ImageConfigProperty, Dict[str, Any], None]) – Specifies whether the model container is in Amazon ECR or a private Docker registry accessible from your Amazon Virtual Private Cloud (VPC). For information about storing containers in a private Docker registry, see Use a Private Docker Registry for Real-Time Inference Containers

  • inference_specification_name (Optional[str]) – CfnModel.ContainerDefinitionProperty.InferenceSpecificationName.

  • mode (Optional[str]) – Whether the container hosts a single model or multiple models.

  • model_data_url (Optional[str]) – The S3 path where the model artifacts, which result from model training, are stored. This path must point to a single gzip compressed tar archive (.tar.gz suffix). The S3 path is required for SageMaker built-in algorithms, but not if you use your own algorithms. For more information on built-in algorithms, see Common Parameters . .. epigraph:: The model artifacts must be in an S3 bucket that is in the same region as the model or endpoint you are creating. If you provide a value for this parameter, SageMaker uses AWS Security Token Service to download model artifacts from the S3 path you provide. AWS STS is activated in your IAM user account by default. If you previously deactivated AWS STS for a region, you need to reactivate AWS STS for that region. For more information, see Activating and Deactivating AWS STS in an AWS Region in the AWS Identity and Access Management User Guide . .. epigraph:: If you use a built-in algorithm to create a model, SageMaker requires that you provide a S3 path to the model artifacts in ModelDataUrl .

  • model_package_name (Optional[str]) – The name or Amazon Resource Name (ARN) of the model package to use to create the model.

  • multi_model_config (Union[IResolvable, MultiModelConfigProperty, Dict[str, Any], None]) – Specifies additional configuration for multi-model endpoints.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

# environment: Any

container_definition_property = sagemaker.CfnModel.ContainerDefinitionProperty(
    container_hostname="containerHostname",
    environment=environment,
    image="image",
    image_config=sagemaker.CfnModel.ImageConfigProperty(
        repository_access_mode="repositoryAccessMode",

        # the properties below are optional
        repository_auth_config=sagemaker.CfnModel.RepositoryAuthConfigProperty(
            repository_credentials_provider_arn="repositoryCredentialsProviderArn"
        )
    ),
    inference_specification_name="inferenceSpecificationName",
    mode="mode",
    model_data_url="modelDataUrl",
    model_package_name="modelPackageName",
    multi_model_config=sagemaker.CfnModel.MultiModelConfigProperty(
        model_cache_setting="modelCacheSetting"
    )
)

Attributes

container_hostname

This parameter is ignored for models that contain only a PrimaryContainer .

When a ContainerDefinition is part of an inference pipeline, the value of the parameter uniquely identifies the container for the purposes of logging and metrics. For information, see Use Logs and Metrics to Monitor an Inference Pipeline . If you don’t specify a value for this parameter for a ContainerDefinition that is part of an inference pipeline, a unique name is automatically assigned based on the position of the ContainerDefinition in the pipeline. If you specify a value for the ContainerHostName for any ContainerDefinition that is part of an inference pipeline, you must specify a value for the ContainerHostName parameter of every ContainerDefinition in that pipeline.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-containerhostname

Return type

Optional[str]

environment

The environment variables to set in the Docker container.

Each key and value in the Environment string to string map can have length of up to 1024. We support up to 16 entries in the map.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-environment

Return type

Any

image

The path where inference code is stored.

This can be either in Amazon EC2 Container Registry or in a Docker registry that is accessible from the same VPC that you configure for your endpoint. If you are using your own custom algorithm instead of an algorithm provided by SageMaker, the inference code must meet SageMaker requirements. SageMaker supports both registry/repository[:tag] and registry/repository[@digest] image path formats. For more information, see Using Your Own Algorithms with Amazon SageMaker

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-image

Return type

Optional[str]

image_config

Specifies whether the model container is in Amazon ECR or a private Docker registry accessible from your Amazon Virtual Private Cloud (VPC).

For information about storing containers in a private Docker registry, see Use a Private Docker Registry for Real-Time Inference Containers

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-imageconfig

Return type

Union[IResolvable, ImageConfigProperty, None]

inference_specification_name

CfnModel.ContainerDefinitionProperty.InferenceSpecificationName.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-inferencespecificationname

Return type

Optional[str]

mode

Whether the container hosts a single model or multiple models.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-mode

Return type

Optional[str]

model_data_url

The S3 path where the model artifacts, which result from model training, are stored.

This path must point to a single gzip compressed tar archive (.tar.gz suffix). The S3 path is required for SageMaker built-in algorithms, but not if you use your own algorithms. For more information on built-in algorithms, see Common Parameters . .. epigraph:

The model artifacts must be in an S3 bucket that is in the same region as the model or endpoint you are creating.

If you provide a value for this parameter, SageMaker uses AWS Security Token Service to download model artifacts from the S3 path you provide. AWS STS is activated in your IAM user account by default. If you previously deactivated AWS STS for a region, you need to reactivate AWS STS for that region. For more information, see Activating and Deactivating AWS STS in an AWS Region in the AWS Identity and Access Management User Guide . .. epigraph:

If you use a built-in algorithm to create a model, SageMaker requires that you provide a S3 path to the model artifacts in ``ModelDataUrl`` .
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-modeldataurl

Return type

Optional[str]

model_package_name

The name or Amazon Resource Name (ARN) of the model package to use to create the model.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-modelpackagename

Return type

Optional[str]

multi_model_config

Specifies additional configuration for multi-model endpoints.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-multimodelconfig

Return type

Union[IResolvable, MultiModelConfigProperty, None]

ImageConfigProperty

class CfnModel.ImageConfigProperty(*, repository_access_mode, repository_auth_config=None)

Bases: object

Specifies whether the model container is in Amazon ECR or a private Docker registry accessible from your Amazon Virtual Private Cloud (VPC).

Parameters
  • repository_access_mode (str) – Set this to one of the following values:. - Platform - The model image is hosted in Amazon ECR. - Vpc - The model image is hosted in a private Docker registry in your VPC.

  • repository_auth_config (Union[IResolvable, RepositoryAuthConfigProperty, Dict[str, Any], None]) – (Optional) Specifies an authentication configuration for the private docker registry where your model image is hosted. Specify a value for this property only if you specified Vpc as the value for the RepositoryAccessMode field, and the private Docker registry where the model image is hosted requires authentication.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-imageconfig.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

image_config_property = sagemaker.CfnModel.ImageConfigProperty(
    repository_access_mode="repositoryAccessMode",

    # the properties below are optional
    repository_auth_config=sagemaker.CfnModel.RepositoryAuthConfigProperty(
        repository_credentials_provider_arn="repositoryCredentialsProviderArn"
    )
)

Attributes

repository_access_mode

.

  • Platform - The model image is hosted in Amazon ECR.

  • Vpc - The model image is hosted in a private Docker registry in your VPC.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-imageconfig.html#cfn-sagemaker-model-containerdefinition-imageconfig-repositoryaccessmode

Type

Set this to one of the following values

Return type

str

repository_auth_config

(Optional) Specifies an authentication configuration for the private docker registry where your model image is hosted.

Specify a value for this property only if you specified Vpc as the value for the RepositoryAccessMode field, and the private Docker registry where the model image is hosted requires authentication.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-imageconfig.html#cfn-sagemaker-model-containerdefinition-imageconfig-repositoryauthconfig

Return type

Union[IResolvable, RepositoryAuthConfigProperty, None]

InferenceExecutionConfigProperty

class CfnModel.InferenceExecutionConfigProperty(*, mode)

Bases: object

Specifies details about how containers in a multi-container endpoint are run.

Parameters

mode (str) – How containers in a multi-container are run. The following values are valid. - Serial - Containers run as a serial pipeline. - Direct - Only the individual container that you specify is run.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-inferenceexecutionconfig.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

inference_execution_config_property = sagemaker.CfnModel.InferenceExecutionConfigProperty(
    mode="mode"
)

Attributes

mode

How containers in a multi-container are run. The following values are valid.

  • Serial - Containers run as a serial pipeline.

  • Direct - Only the individual container that you specify is run.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-inferenceexecutionconfig.html#cfn-sagemaker-model-inferenceexecutionconfig-mode

Return type

str

MultiModelConfigProperty

class CfnModel.MultiModelConfigProperty(*, model_cache_setting=None)

Bases: object

Specifies additional configuration for hosting multi-model endpoints.

Parameters

model_cache_setting (Optional[str]) – Whether to cache models for a multi-model endpoint. By default, multi-model endpoints cache models so that a model does not have to be loaded into memory each time it is invoked. Some use cases do not benefit from model caching. For example, if an endpoint hosts a large number of models that are each invoked infrequently, the endpoint might perform better if you disable model caching. To disable model caching, set the value of this parameter to Disabled.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-multimodelconfig.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

multi_model_config_property = sagemaker.CfnModel.MultiModelConfigProperty(
    model_cache_setting="modelCacheSetting"
)

Attributes

model_cache_setting

Whether to cache models for a multi-model endpoint.

By default, multi-model endpoints cache models so that a model does not have to be loaded into memory each time it is invoked. Some use cases do not benefit from model caching. For example, if an endpoint hosts a large number of models that are each invoked infrequently, the endpoint might perform better if you disable model caching. To disable model caching, set the value of this parameter to Disabled.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-multimodelconfig.html#cfn-sagemaker-model-containerdefinition-multimodelconfig-modelcachesetting

Return type

Optional[str]

RepositoryAuthConfigProperty

class CfnModel.RepositoryAuthConfigProperty(*, repository_credentials_provider_arn)

Bases: object

Specifies an authentication configuration for the private docker registry where your model image is hosted.

Specify a value for this property only if you specified Vpc as the value for the RepositoryAccessMode field of the ImageConfig object that you passed to a call to CreateModel and the private Docker registry where the model image is hosted requires authentication.

Parameters

repository_credentials_provider_arn (str) – The Amazon Resource Name (ARN) of an AWS Lambda function that provides credentials to authenticate to the private Docker registry where your model image is hosted. For information about how to create an AWS Lambda function, see Create a Lambda function with the console in the AWS Lambda Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-imageconfig-repositoryauthconfig.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

repository_auth_config_property = sagemaker.CfnModel.RepositoryAuthConfigProperty(
    repository_credentials_provider_arn="repositoryCredentialsProviderArn"
)

Attributes

repository_credentials_provider_arn

The Amazon Resource Name (ARN) of an AWS Lambda function that provides credentials to authenticate to the private Docker registry where your model image is hosted.

For information about how to create an AWS Lambda function, see Create a Lambda function with the console in the AWS Lambda Developer Guide .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition-imageconfig-repositoryauthconfig.html#cfn-sagemaker-model-containerdefinition-imageconfig-repositoryauthconfig-repositorycredentialsproviderarn

Return type

str

VpcConfigProperty

class CfnModel.VpcConfigProperty(*, security_group_ids, subnets)

Bases: object

Specifies a VPC that your training jobs and hosted models have access to.

Control access to and from your training and model containers by configuring the VPC. For more information, see Protect Endpoints by Using an Amazon Virtual Private Cloud and Protect Training Jobs by Using an Amazon Virtual Private Cloud .

Parameters
  • security_group_ids (Sequence[str]) – The VPC security group IDs, in the form sg-xxxxxxxx. Specify the security groups for the VPC that is specified in the Subnets field.

  • subnets (Sequence[str]) – The ID of the subnets in the VPC to which you want to connect your training job or model. For information about the availability of specific instance types, see Supported Instance Types and Availability Zones .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_sagemaker as sagemaker

vpc_config_property = sagemaker.CfnModel.VpcConfigProperty(
    security_group_ids=["securityGroupIds"],
    subnets=["subnets"]
)

Attributes

security_group_ids

The VPC security group IDs, in the form sg-xxxxxxxx.

Specify the security groups for the VPC that is specified in the Subnets field.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html#cfn-sagemaker-model-vpcconfig-securitygroupids

Return type

List[str]

subnets

The ID of the subnets in the VPC to which you want to connect your training job or model.

For information about the availability of specific instance types, see Supported Instance Types and Availability Zones .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html#cfn-sagemaker-model-vpcconfig-subnets

Return type

List[str]