Class: AWSCDK::Sagemaker::CfnModel::ContainerDefinitionProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
sagemaker/cfn_model.rb

Overview

Describes the container, as part of model definition.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container_hostname: nil, environment: nil, image: nil, image_config: nil, inference_specification_name: nil, mode: nil, model_data_source: nil, model_data_url: nil, model_package_name: nil, multi_model_config: nil) ⇒ ContainerDefinitionProperty

Returns a new instance of ContainerDefinitionProperty.

Parameters:

  • container_hostname (String, nil) (defaults to: nil)

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

  • environment (Object, nil) (defaults to: nil)

    The environment variables to set in the Docker container. Don't include any sensitive data in your environment variables.

  • image (String, nil) (defaults to: nil)

    The path where inference code is stored.

  • image_config (AWSCDK::IResolvable, AWSCDK::Sagemaker::CfnModel::ImageConfigProperty, nil) (defaults to: nil)

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

  • inference_specification_name (String, nil) (defaults to: nil)

    The inference specification name in the model package version.

  • mode (String, nil) (defaults to: nil)

    Whether the container hosts a single model or multiple models.

  • model_data_source (AWSCDK::IResolvable, AWSCDK::Sagemaker::CfnModel::ModelDataSourceProperty, nil) (defaults to: nil)

    Specifies the location of ML model data to deploy.

  • model_data_url (String, nil) (defaults to: nil)

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

  • model_package_name (String, nil) (defaults to: nil)

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

  • multi_model_config (AWSCDK::IResolvable, AWSCDK::Sagemaker::CfnModel::MultiModelConfigProperty, nil) (defaults to: nil)

    Specifies additional configuration for multi-model endpoints.



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'sagemaker/cfn_model.rb', line 630

def initialize(container_hostname: nil, environment: nil, image: nil, image_config: nil, inference_specification_name: nil, mode: nil, model_data_source: nil, model_data_url: nil, model_package_name: nil, multi_model_config: nil)
  @container_hostname = container_hostname
  Jsii::Type.check_type(@container_hostname, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "containerHostname") unless @container_hostname.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "environment") unless @environment.nil?
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image") unless @image.nil?
  @image_config = image_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnModel::ImageConfigProperty.new(**image_config.transform_keys(&:to_sym)) : image_config
  Jsii::Type.check_type(@image_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuTW9kZWwuSW1hZ2VDb25maWdQcm9wZXJ0eSJ9XX19")), "imageConfig") unless @image_config.nil?
  @inference_specification_name = inference_specification_name
  Jsii::Type.check_type(@inference_specification_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inferenceSpecificationName") unless @inference_specification_name.nil?
  @mode = mode
  Jsii::Type.check_type(@mode, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "mode") unless @mode.nil?
  @model_data_source = model_data_source.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnModel::ModelDataSourceProperty.new(**model_data_source.transform_keys(&:to_sym)) : model_data_source
  Jsii::Type.check_type(@model_data_source, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuTW9kZWwuTW9kZWxEYXRhU291cmNlUHJvcGVydHkifV19fQ==")), "modelDataSource") unless @model_data_source.nil?
  @model_data_url = model_data_url
  Jsii::Type.check_type(@model_data_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "modelDataUrl") unless @model_data_url.nil?
  @model_package_name = model_package_name
  Jsii::Type.check_type(@model_package_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "modelPackageName") unless @model_package_name.nil?
  @multi_model_config = multi_model_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnModel::MultiModelConfigProperty.new(**multi_model_config.transform_keys(&:to_sym)) : multi_model_config
  Jsii::Type.check_type(@multi_model_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuTW9kZWwuTXVsdGlNb2RlbENvbmZpZ1Byb3BlcnR5In1dfX0=")), "multiModelConfig") unless @multi_model_config.nil?
end

Instance Attribute Details

#container_hostnameString? (readonly)

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.



659
660
661
# File 'sagemaker/cfn_model.rb', line 659

def container_hostname
  @container_hostname
end

#environmentObject? (readonly)

The environment variables to set in the Docker container. Don't include any sensitive data in your environment variables.

The maximum length of each key and value in the Environment map is 1024 bytes. The maximum length of all keys and values in the map, combined, is 32 KB. If you pass multiple containers to a CreateModel request, then the maximum length of all of their maps, combined, is also 32 KB.



666
667
668
# File 'sagemaker/cfn_model.rb', line 666

def environment
  @environment
end

#imageString? (readonly)

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 .

The model artifacts in an Amazon S3 bucket and the Docker image for inference container in Amazon EC2 Container Registry must be in the same region as the model or endpoint you are creating.



675
676
677
# File 'sagemaker/cfn_model.rb', line 675

def image
  @image
end

#image_configAWSCDK::IResolvable, ... (readonly)

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 .

The model artifacts in an Amazon S3 bucket and the Docker image for inference container in Amazon EC2 Container Registry must be in the same region as the model or endpoint you are creating.



684
685
686
# File 'sagemaker/cfn_model.rb', line 684

def image_config
  @image_config
end

#inference_specification_nameString? (readonly)

The inference specification name in the model package version.



689
690
691
# File 'sagemaker/cfn_model.rb', line 689

def inference_specification_name
  @inference_specification_name
end

#modeString? (readonly)

Whether the container hosts a single model or multiple models.



694
695
696
# File 'sagemaker/cfn_model.rb', line 694

def mode
  @mode
end

#model_data_sourceAWSCDK::IResolvable, ... (readonly)

Specifies the location of ML model data to deploy.

Currently you cannot use ModelDataSource in conjunction with SageMaker batch transform, SageMaker serverless endpoints, SageMaker multi-model endpoints, and SageMaker Marketplace.



701
702
703
# File 'sagemaker/cfn_model.rb', line 701

def model_data_source
  @model_data_source
end

#model_data_urlString? (readonly)

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 .

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 AWS 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 .

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 .



714
715
716
# File 'sagemaker/cfn_model.rb', line 714

def model_data_url
  @model_data_url
end

#model_package_nameString? (readonly)

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



719
720
721
# File 'sagemaker/cfn_model.rb', line 719

def model_package_name
  @model_package_name
end

#multi_model_configAWSCDK::IResolvable, ... (readonly)

Specifies additional configuration for multi-model endpoints.



724
725
726
# File 'sagemaker/cfn_model.rb', line 724

def multi_model_config
  @multi_model_config
end

Class Method Details

.jsii_propertiesObject



726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'sagemaker/cfn_model.rb', line 726

def self.jsii_properties
  {
    :container_hostname => "containerHostname",
    :environment => "environment",
    :image => "image",
    :image_config => "imageConfig",
    :inference_specification_name => "inferenceSpecificationName",
    :mode => "mode",
    :model_data_source => "modelDataSource",
    :model_data_url => "modelDataUrl",
    :model_package_name => "modelPackageName",
    :multi_model_config => "multiModelConfig",
  }
end

Instance Method Details

#to_jsiiObject



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'sagemaker/cfn_model.rb', line 741

def to_jsii
  result = {}
  result.merge!({
    "containerHostname" => @container_hostname,
    "environment" => @environment,
    "image" => @image,
    "imageConfig" => @image_config,
    "inferenceSpecificationName" => @inference_specification_name,
    "mode" => @mode,
    "modelDataSource" => @model_data_source,
    "modelDataUrl" => @model_data_url,
    "modelPackageName" => @model_package_name,
    "multiModelConfig" => @multi_model_config,
  })
  result.compact
end