Skip to content

update_endpoint

update_endpoint(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    endpoint_name: Optional[EndpointName] = None,
    endpoint_config_name: Optional[EndpointConfigName] = None,
    retain_all_variant_properties: Optional[Boolean] = None,
    exclude_retained_variant_properties: Optional[VariantPropertyList] = None,
    deployment_config: Optional[DeploymentConfig] = None,
    retain_deployment_config: Optional[Boolean] = None,
) -> UpdateEndpointOutput

Deploys the EndpointConfig specified in the request to a new fleet of instances. SageMaker shifts endpoint traffic to the new instances with the updated endpoint configuration and then deletes the old instances using the previous EndpointConfig (there is no availability loss). For more information about how to control the update and traffic shifting process, see Update models in production.

When SageMaker receives the request, it sets the endpoint status to Updating. After updating the endpoint, it sets the status to InService. To check the status of an endpoint, use the DescribeEndpoint API.

You must not delete an EndpointConfig in use by an endpoint that is live or while the UpdateEndpoint or CreateEndpoint operations are being performed on the endpoint. To update an endpoint, you must create a new EndpointConfig.

If you delete the EndpointConfig of an endpoint that is active or being created or updated you may lose visibility into the instance type the endpoint is using. The endpoint must be deleted in order to stop incurring charges.

Parameters:

  • endpoint_name (Optional[EndpointName], default: None ) –

    The name of the endpoint whose configuration you want to update.

  • endpoint_config_name (Optional[EndpointConfigName], default: None ) –

    The name of the new endpoint configuration.

  • retain_all_variant_properties (Optional[Boolean], default: None ) –

    When updating endpoint resources, enables or disables the retention of variant properties, such as the instance count or the variant weight. To retain the variant properties of an endpoint when updating it, set RetainAllVariantProperties to true. To use the variant properties specified in a new EndpointConfig call when updating an endpoint, set RetainAllVariantProperties to false. The default is false.

  • exclude_retained_variant_properties (Optional[VariantPropertyList], default: None ) –

    When you are updating endpoint resources with RetainAllVariantProperties, whose value is set to true, ExcludeRetainedVariantProperties specifies the list of type VariantProperty to override with the values provided by EndpointConfig. If you don't specify a value for ExcludeRetainedVariantProperties, no variant properties are overridden.

  • deployment_config (Optional[DeploymentConfig], default: None ) –

    The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.

  • retain_deployment_config (Optional[Boolean], default: None ) –

    Specifies whether to reuse the last deployment configuration. The default value is false (the configuration is not reused).

Raises:

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def update_endpoint(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    endpoint_name: Optional[
        "capo_sagemaker.types.endpoint_name.EndpointName"
    ] = None,
    endpoint_config_name: Optional[
        "capo_sagemaker.types.endpoint_config_name.EndpointConfigName"
    ] = None,
    retain_all_variant_properties: Optional[
        "capo_sagemaker.types.boolean.Boolean"
    ] = None,
    exclude_retained_variant_properties: Optional[
        "capo_sagemaker.types.variant_property_list.VariantPropertyList"
    ] = None,
    deployment_config: Optional[
        "capo_sagemaker.types.deployment_config.DeploymentConfig"
    ] = None,
    retain_deployment_config: Optional[
        "capo_sagemaker.types.boolean.Boolean"
    ] = None,
) -> "capo_sagemaker.types.update_endpoint_output.UpdateEndpointOutput":
    """<p>Deploys the <code>EndpointConfig</code> specified in the request to a new fleet of instances. SageMaker shifts endpoint traffic to the new instances with the updated endpoint configuration and then deletes the old instances using the previous <code>EndpointConfig</code> (there is no availability loss). For more information about how to control the update and traffic shifting process, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/deployment-guardrails.html"> Update models in production</a>.</p> <p>When SageMaker receives the request, it sets the endpoint status to <code>Updating</code>. After updating the endpoint, it sets the status to <code>InService</code>. To check the status of an endpoint, use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpoint.html">DescribeEndpoint</a> API. </p> <note> <p>You must not delete an <code>EndpointConfig</code> in use by an endpoint that is live or while the <code>UpdateEndpoint</code> or <code>CreateEndpoint</code> operations are being performed on the endpoint. To update an endpoint, you must create a new <code>EndpointConfig</code>.</p> <p>If you delete the <code>EndpointConfig</code> of an endpoint that is active or being created or updated you may lose visibility into the instance type the endpoint is using. The endpoint must be deleted in order to stop incurring charges.</p> </note>

    Args:
        endpoint_name: <p>The name of the endpoint whose configuration you want to update.</p>
        endpoint_config_name: <p>The name of the new endpoint configuration.</p>
        retain_all_variant_properties: <p>When updating endpoint resources, enables or disables the retention of <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VariantProperty.html">variant properties</a>, such as the instance count or the variant weight. To retain the variant properties of an endpoint when updating it, set <code>RetainAllVariantProperties</code> to <code>true</code>. To use the variant properties specified in a new <code>EndpointConfig</code> call when updating an endpoint, set <code>RetainAllVariantProperties</code> to <code>false</code>. The default is <code>false</code>.</p>
        exclude_retained_variant_properties: <p>When you are updating endpoint resources with <code>RetainAllVariantProperties</code>, whose value is set to <code>true</code>, <code>ExcludeRetainedVariantProperties</code> specifies the list of type <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VariantProperty.html">VariantProperty</a> to override with the values provided by <code>EndpointConfig</code>. If you don't specify a value for <code>ExcludeRetainedVariantProperties</code>, no variant properties are overridden. </p>
        deployment_config: <p>The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.</p>
        retain_deployment_config: <p>Specifies whether to reuse the last deployment configuration. The default value is false (the configuration is not reused).</p>

    Raises:
        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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.update_endpoint_input.UpdateEndpointInput]",
    ) -> OperationResponse[
        "capo_sagemaker.types.update_endpoint_output.UpdateEndpointOutput"
    ]:
        import capo_sagemaker._operations.sage_maker.update_endpoint

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateEndpoint")
    )
    input_: capo_sagemaker.types.update_endpoint_input.UpdateEndpointInput = {}
    if endpoint_name is not None:
        input_["endpoint_name"] = endpoint_name
    if endpoint_config_name is not None:
        input_["endpoint_config_name"] = endpoint_config_name
    if retain_all_variant_properties is not None:
        input_["retain_all_variant_properties"] = retain_all_variant_properties
    if exclude_retained_variant_properties is not None:
        input_["exclude_retained_variant_properties"] = (
            exclude_retained_variant_properties
        )
    if deployment_config is not None:
        input_["deployment_config"] = deployment_config
    if retain_deployment_config is not None:
        input_["retain_deployment_config"] = retain_deployment_config

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