代码之家  ›  专栏  ›  技术社区  ›  razimbres

aws sagemaker无权执行:ecr:createrepository on resource:*

  •  0
  • razimbres  · 技术社区  · 7 年前

    我正在创建自己的Docker图像,以便在AWS Sagemaker中使用自己的模型。我成功地在sagemaker ml.t2.medium实例的jupyter笔记本中使用命令行创建了一个docker映像,该实例使用了一个自定义的dockerfile:

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

    但当我在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、ec2container服务权限和以下策略,但仍然会出现相同的错误。

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

    我能解决这个问题吗?

    提前谢谢。

    1 回复  |  直到 7 年前
        1
  •  1
  •   razimbres    7 年前

    我解决了这个问题。我们必须在sagemaker执行角色处设置以下权限:

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