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
asked 2 years ago813 views
1 Answer
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
SUPPORT ENGINEER
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions