Invoke ModelLifeCycle using the AWS CLI examples - Amazon SageMaker AI

Invoke ModelLifeCycle using the AWS CLI examples

You can use the AWS CLI tool to manage your AWS resources. A few AWS CLI commands include search and list-actions. The following will provide examples on how to use ModelPackage while using these commands.

The examples on this page uses the following variables.

  • region is the region that your model package exists in.

  • stage-name is the name of your defined stage.

To search for your model packages with a stage name you have already defined, use the following command.

aws sagemaker search --region 'region' --resource ModelPackage --search-expression '{"Filters": [{"Name": "ModelLifeCycle.Stage","Value": "stage-name"}]}'

To list the actions associated with ModelLifeCycle, use the following command.

aws sagemaker list-actions --region 'region' --action-type ModelLifeCycle