本文介绍了AWS SageMaker 无权在资源上执行:ecr:CreateRepository:*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建自己的 Docker 映像,以便可以在 AWS SageMaker 中使用自己的模型.我使用自定义 Dockerfile 在 SageMaker ml.t2.medium 实例中的 Jupyter Notebook 中使用命令行成功创建了一个 Docker 映像:

I am creating my own Docker image so that I can use my own models in AWS SageMaker. I sucessfully created a Docker image using command line inside the Jupyter Notebook in SageMaker ml.t2.medium instance using a customized Dockerfile:

REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
sklearn               latest              01234212345        6 minutes ago       1.23GB

但是当我在 Jupyter 中运行时:

But when I run in Jupyter:

! aws ecr create-repository --repository-name sklearn

我收到以下错误:

An error occurred (AccessDeniedException) when calling the CreateRepository operation: User: arn:aws:sts::1234567:assumed-role/AmazonSageMaker-ExecutionRole-12345/SageMaker is not authorized to perform: ecr:CreateRepository on resource: *

我已经为 EC2Container 设置了 SageMaker、EC2、EC2ContainerService 权限和以下策略,但我仍然遇到相同的错误.

I already set up SageMaker, EC2, EC2ContainerService permissions and the following policy for EC2Container but I still get the same error.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "sagemaker:*",
        "ec2:*"
      ],
      "Resource": "*"
    }
  ]
}

知道如何解决这个问题吗?

Any idea on how I can solve this issue?

提前致谢.

推荐答案

我解决了这个问题.我们必须在 SageMaker 执行角色中设置权限,如下所示:

I solved the problem. We must set a permission at SageMaker Execution Role as following:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "ecr:*"            ],
        "Resource": "*"
    }
]}

这篇关于AWS SageMaker 无权在资源上执行:ecr:CreateRepository:*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 15:33