AmazonSageMakerFullAccess ポリシーを付与しているのに、Amazon SageMaker Studio のユーザーが作成できない時の対処方法

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

困っていた内容

AmazonSageMakerFullAccess ポリシーで Amazon SageMaker Studio のユーザーを追加したいのですが、以下のエラーが発生して追加できません。
対処方法を教えてください。

User: arn:aws:sts::123456789012:assumed-role/test-sagemaker/sagemaker-user is not authorized to perform: sagemaker:CreateUserProfile on resource: arn:aws:sagemaker:ap-northeast-1:123456789012:user-profile/d-samplexxxxxx/default-1234567890123 because no identity-based policy allows the sagemaker:CreateUserProfile action

どう対応すればいいの?

AmazonSageMakerFullAccess ポリシーでは、 下記のように SageMaker のアクションを許可するリソースが NotResource で制限されております。
下記のポリシーにより、NotResource に含まれているリソースにはアクセスが許可されていない形となっております。
その中には、user-profile に関連するリソースを含まれているため、ユーザーを作成中に権限のエラーが発生します。

{    "Effect": "Allow",
    "Action": [
        "sagemaker:*"
    ],
    "NotResource": [
        "arn:aws:sagemaker:*:*:domain/*",
        "arn:aws:sagemaker:*:*:user-profile/*",
        "arn:aws:sagemaker:*:*:app/*",
        "arn:aws:sagemaker:*:*:flow-definition/*"
    ]
},

そのため、SageMaker Studio でユーザーを作成したい場合は、AmazonSageMakerFullAccessポリシーに加え、以下のポリシーを新規に作成いただき、アタッチする必要がございます。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sagemaker:*"
            ],
            "Resource": [
                "arn:aws:sagemaker:*:*:domain/*",
                "arn:aws:sagemaker:*:*:user-profile/*",
                "arn:aws:sagemaker:*:*:app/*",
                "arn:aws:sagemaker:*:*:flow-definition/*"
            ]
        }
    ]
}

また、SageMaker Studio のユーザーを作成する際にSageMaker プロジェクトと JumpStart - オプション のオプションを有効化する場合は、追加で下記のポリシーを追加いただくとでユーザーを正常に作成できます。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:GetRole",
                "servicecatalog:AssociatePrincipalWithPortfolio"
            ],
            "Resource": "*"
        }
    ]
}

参考情報