Update a model package stage and status example (boto3) - Amazon SageMaker AI
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

Update a model package stage and status example (boto3)

To update a model package stage and status, you will need to assume an execution role with the relevant permissions. The following provides an example on how you can update the stage status using the UpdateModelPackage API using AWS SDK for Python (Boto3).

In this example, the ModelLifeCycle stage "Development" and stage status "Approved" condition keys for the UpdateModelPackage API action has been granted to the your execution role. You can include a description in stage-description. See Set up Staging Construct Examples for more information.

from sagemaker import get_execution_role, session import boto3 region = boto3.Session().region_name role = get_execution_role() sm_client = boto3.client('sagemaker', region_name=region) model_package_update_input_dict = { "ModelLifeCycle" : { "stage" : "Development", "stageStatus" : "Approved", "stageDescription" : "stage-description" } } model_package_update_response = sm_client.update_model_package(**model_package_update_input_dict)