Skip to content

create_image_version

create_image_version(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    base_image: Optional[ImageBaseImage] = None,
    client_token: Optional[ClientToken] = None,
    image_name: Optional[ImageName] = None,
    aliases: Optional[SageMakerImageVersionAliases] = None,
    vendor_guidance: Optional[VendorGuidance] = None,
    job_type: Optional[JobType] = None,
    ml_framework: Optional[MLFramework] = None,
    programming_lang: Optional[ProgrammingLang] = None,
    processor: Optional[Processor] = None,
    horovod: Optional[Horovod] = None,
    release_notes: Optional[ReleaseNotes] = None,
) -> CreateImageVersionResponse

Creates a version of the SageMaker AI image specified by ImageName. The version represents the Amazon ECR container image specified by BaseImage.

Parameters:

  • base_image (Optional[ImageBaseImage], default: None ) –

    The registry path of the container image to use as the starting point for this version. The path is an Amazon ECR URI in the following format:

    <acct-id>.dkr.ecr.<region>.amazonaws.com/<repo-name[:tag] or [@digest]>

  • client_token (Optional[ClientToken], default: None ) –

    A unique ID. If not specified, the Amazon Web Services CLI and Amazon Web Services SDKs, such as the SDK for Python (Boto3), add a unique value to the call.

  • image_name (Optional[ImageName], default: None ) –

    The ImageName of the Image to create a version of.

  • aliases (Optional[SageMakerImageVersionAliases], default: None ) –

    A list of aliases created with the image version.

  • vendor_guidance (Optional[VendorGuidance], default: None ) –

    The stability of the image version, specified by the maintainer.

    • NOT_PROVIDED: The maintainers did not provide a status for image version stability.

    • STABLE: The image version is stable.

    • TO_BE_ARCHIVED: The image version is set to be archived. Custom image versions that are set to be archived are automatically archived after three months.

    • ARCHIVED: The image version is archived. Archived image versions are not searchable and are no longer actively supported.

  • job_type (Optional[JobType], default: None ) –

    Indicates SageMaker AI job type compatibility.

    • TRAINING: The image version is compatible with SageMaker AI training jobs.

    • INFERENCE: The image version is compatible with SageMaker AI inference jobs.

    • NOTEBOOK_KERNEL: The image version is compatible with SageMaker AI notebook kernels.

  • ml_framework (Optional[MLFramework], default: None ) –

    The machine learning framework vended in the image version.

  • programming_lang (Optional[ProgrammingLang], default: None ) –

    The supported programming language and its version.

  • processor (Optional[Processor], default: None ) –

    Indicates CPU or GPU compatibility.

    • CPU: The image version is compatible with CPU.

    • GPU: The image version is compatible with GPU.

  • horovod (Optional[Horovod], default: None ) –

    Indicates Horovod compatibility.

  • release_notes (Optional[ReleaseNotes], default: None ) –

    The maintainer description of the image version.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_image_version(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    base_image: Optional[
        "capo_sagemaker.types.image_base_image.ImageBaseImage"
    ] = None,
    client_token: Optional["capo_sagemaker.types.client_token.ClientToken"] = None,
    image_name: Optional["capo_sagemaker.types.image_name.ImageName"] = None,
    aliases: Optional[
        "capo_sagemaker.types.sage_maker_image_version_aliases.SageMakerImageVersionAliases"
    ] = None,
    vendor_guidance: Optional[
        "capo_sagemaker.types.vendor_guidance.VendorGuidance"
    ] = None,
    job_type: Optional["capo_sagemaker.types.job_type.JobType"] = None,
    ml_framework: Optional["capo_sagemaker.types.ml_framework.MLFramework"] = None,
    programming_lang: Optional[
        "capo_sagemaker.types.programming_lang.ProgrammingLang"
    ] = None,
    processor: Optional["capo_sagemaker.types.processor.Processor"] = None,
    horovod: Optional["capo_sagemaker.types.horovod.Horovod"] = None,
    release_notes: Optional[
        "capo_sagemaker.types.release_notes.ReleaseNotes"
    ] = None,
) -> (
    "capo_sagemaker.types.create_image_version_response.CreateImageVersionResponse"
):
    """<p>Creates a version of the SageMaker AI image specified by <code>ImageName</code>. The version represents the Amazon ECR container image specified by <code>BaseImage</code>.</p>

    Args:
        base_image: <p>The registry path of the container image to use as the starting point for this version. The path is an Amazon ECR URI in the following format:</p> <p> <code>&lt;acct-id&gt;.dkr.ecr.&lt;region&gt;.amazonaws.com/&lt;repo-name[:tag] or [@digest]&gt;</code> </p>
        client_token: <p>A unique ID. If not specified, the Amazon Web Services CLI and Amazon Web Services SDKs, such as the SDK for Python (Boto3), add a unique value to the call.</p>
        image_name: <p>The <code>ImageName</code> of the <code>Image</code> to create a version of.</p>
        aliases: <p>A list of aliases created with the image version.</p>
        vendor_guidance: <p>The stability of the image version, specified by the maintainer.</p> <ul> <li> <p> <code>NOT_PROVIDED</code>: The maintainers did not provide a status for image version stability.</p> </li> <li> <p> <code>STABLE</code>: The image version is stable.</p> </li> <li> <p> <code>TO_BE_ARCHIVED</code>: The image version is set to be archived. Custom image versions that are set to be archived are automatically archived after three months.</p> </li> <li> <p> <code>ARCHIVED</code>: The image version is archived. Archived image versions are not searchable and are no longer actively supported. </p> </li> </ul>
        job_type: <p>Indicates SageMaker AI job type compatibility.</p> <ul> <li> <p> <code>TRAINING</code>: The image version is compatible with SageMaker AI training jobs.</p> </li> <li> <p> <code>INFERENCE</code>: The image version is compatible with SageMaker AI inference jobs.</p> </li> <li> <p> <code>NOTEBOOK_KERNEL</code>: The image version is compatible with SageMaker AI notebook kernels.</p> </li> </ul>
        ml_framework: <p>The machine learning framework vended in the image version.</p>
        programming_lang: <p>The supported programming language and its version.</p>
        processor: <p>Indicates CPU or GPU compatibility.</p> <ul> <li> <p> <code>CPU</code>: The image version is compatible with CPU.</p> </li> <li> <p> <code>GPU</code>: The image version is compatible with GPU.</p> </li> </ul>
        horovod: <p>Indicates Horovod compatibility.</p>
        release_notes: <p>The maintainer description of the image version.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_image_version_request.CreateImageVersionRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_image_version_response.CreateImageVersionResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_image_version

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_image_version.create_image_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateImageVersion")
    )
    input_: capo_sagemaker.types.create_image_version_request.CreateImageVersionRequest = {}
    if base_image is not None:
        input_["base_image"] = base_image
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if image_name is not None:
        input_["image_name"] = image_name
    if aliases is not None:
        input_["aliases"] = aliases
    if vendor_guidance is not None:
        input_["vendor_guidance"] = vendor_guidance
    if job_type is not None:
        input_["job_type"] = job_type
    if ml_framework is not None:
        input_["ml_framework"] = ml_framework
    if programming_lang is not None:
        input_["programming_lang"] = programming_lang
    if processor is not None:
        input_["processor"] = processor
    if horovod is not None:
        input_["horovod"] = horovod
    if release_notes is not None:
        input_["release_notes"] = release_notes

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output