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 searchModelPackage
while using these commands. For information and
examples on setting up your stage construct, see Set up Staging
Construct Examples.
The examples on this page uses the following variables.
-
is the region that your model package exists in.region
-
is the name of your defined stage.stage-name
-
is the name of your defined stage status.stage-status
The following are example AWS CLI commands using ModelLifeCycle.
Search for your model packages with a stage-name
you have already defined.
aws sagemaker search --region '
region
' --resource ModelPackage --search-expression '{"Filters": [{"Name": "ModelLifeCycle.Stage","Value": "stage-name
"}]}'
List the actions associated with ModelLifeCycle
.
aws sagemaker list-actions --region '
region
' --action-type ModelLifeCycle
Create a model package with ModelLifeCycle.
aws sagemaker create-model-package --model-package-group-name '
model-package-group-name
' --source-uri 'source-uri
' --region 'region
' --model-life-cycle '{"Stage":"stage-name
", "StageStatus":"stage-status
", "StageDescription":"Your Staging Comment
"}'
Update a model package with ModelLifeCycle.
aws sagemaker update-model-package --model-package '
model-package-arn
' --region 'region
' --model-life-cycle '{"Stage":"stage-name
", "StageStatus":"stage-status
"}'
Search via the ModelLifeCycle field.
aws sagemaker search --region '
region
' --resource ModelPackage --search-expression '{"Filters": [{"Name": "ModelLifeCycle.Stage","Value": "stage-name
"}]}'
Fetch audit records for ModelLifeField updates via Amazon SageMaker ML Lineage Tracking APIs.
aws sagemaker list-actions --region '
region
' --action-type ModelLifeCycle
aws sagemaker describe-action --region '
region
' --action-name 'action-arn or action-name
'