Sagemaker cross-account deployments

1

I am trying to setup an aws code pipeline project that will deploy a sagemaker model from a model registry cross-account from our qa account.

The plan is to deploy the latest approval model from the registry . I followed steps https://docs.aws.amazon.com/sagemaker/latest/dg/model-registry-deploy.html#model-registry-deploy-xaccount but the code below fails when trying to find the latest approved model to deploy. Is their another API endpoint that allows me to look up by ARN instead of using list_model_package_groups?

# try to find the latest approved model package from  model registry from our dev/qa VPC 
groups = self.sm.list_model_package_groups(NameContains=self.model_package, SortOrder='Descending')
most_recent_group = groups['ModelPackageGroupSummaryList'][0]
packages = self.sm.list_model_packages(ModelPackageGroupName=most_recent_group['ModelPackageGroupName'],
                                       SortOrder='Descending', ModelApprovalStatus='Approved')
most_recent_packages = packages['ModelPackageSummaryList']
most_recent_package = most_recent_packages[0]
model_name = '-'.join(most_recent_package['ModelPackageArn'].split('/')[-2:])
model_package_arn = most_recent_package['ModelPackageArn']
container_list = [{'ModelPackageName': model_package_arn}]
self.sm.create_model(
    ModelName=model_name,
    ExecutionRoleArn=self.role,
    Containers=container_list
)
return model_name
已提問 2 年前檢視次數 826 次
1 個回答
0

Hello,

Thank you for using SageMaker Service.

I understand that you are facing error while deploying model which happens to be under different account and want to know how to overcome the error while listing down the lates model registered or identify other API call which could lookup the latest Model register using ARN.

We would like to know the exact error message that has occurred at your end to narrow down the issue and help you overcome this.

To better understanding of the error and your implementation, I'd recommend you to open a case with Premium Support SageMaker team so that you can share complete error message and required logs tp help you overcome this issue.

Open a support case with AWS using the link:

https://console.aws.amazon.com/support/home?#/case/create

AWS
支援工程師
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南