The resource owner can set up model package group discoverability by creating resource shares and attaching resource policies to the entities. For detailed steps about how to create a general resource share in AWS RAM, see Create a resource share in the AWS RAM documentation.
Complete the following instructions to set up model package group discoverability using the AWS RAM console or Model Registry Resource Policy APIs.
-
Create a resource share in the model owner account.
-
The model owner attaches a resource policy to the model package group using the SageMaker AI Resource Policy API put-model-package-group-policy, as demonstrated in the following command.
aws sagemaker put-model-package-group-policy --model-package-group-name
<model-package-group-name>
--resource-policy "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\": \"ExampleResourcePolicy\",\"Effect\":\"Allow\",\"Principal\":<principal>
, \"Action\":[\"sagemaker:DescribeModelPackage\", \"sagemaker:ListModelPackages\",\"sagemaker:DescribeModelPackageGroup\"], \"Resource\":[\"<model-package-group-arn>
,\" \"arn:aws:sagemaker:<region>
:<owner-account-id>
:model-package/<model-package-group-name>
/*\"]}]}"Note
Different combinations of actions can be attached to the resource policy. For custom policies, the permission created should be promoted by the model package group owner, and only entities with promoted permissions attached are discoverable. Unpromotable resource shares cannot be made discoverable or managed through AWS RAM.
-
To check that AWS RAM created the resource share ARN, use the following command:
aws ram get-resource-share-associations --association-type
resource
--resource-arn<model-package-group-arn>
The response contains the
resource-share-arn
for the entity. -
To check if the attached policy permission is a managed or custom policy, use the following command:
aws ram list-resource-share-permissions --resource-share-arn
<resource-share-arn>
The
featureSet
field can take valuesCREATED_FROM_POLICY
orSTANDARD
, which are defined as follows:-
STANDARD
: The permission already exists. -
CREATED_FROM_POLICY
: The permission needs to be promoted in order for the entity to be discoverable. For more information, see Promote the permission and resource share.
-
-
-
Accept the resource share invitation in the model consumer account.
-
The model package group consumer accepts the invitation for resource share. To see all resource invitations, run the following command:
aws ram get-resource-share-invitations
Identify the requests that have status
PENDING
and include the account ID of the owner account. -
Accept the resource share invitation from the model owner using the following command:
aws ram accept-resource-share-invitation --resource-share-invitation-arn
<resource-share-invitation-arn>
-