当前的 AWS 身份不是 sagemaker 的角色? [英] The current AWS identity is not a role for sagemaker?

查看:28
本文介绍了当前的 AWS 身份不是 sagemaker 的角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 python 中从 sagemaker 调用 get_execution_role() 时出错.我已经附上了同样的错误.

I am getting error when i call get_execution_role() from sagemaker in python. I have attached the error for the same.

我已将 SagemakerFullAccess 策略添加到角色和用户.

I have added the SagemakerFullAccess Policy to role and user both.

推荐答案

get_execution_role()Amazon SageMaker 示例 GitHub 存储库.

这些示例是从 Amazon SageMaker 提供的完全托管的 Jupyter 笔记本中执行的.

These examples were made to be executed from the fully managed Jupyter notebooks that Amazon SageMaker provides.

从这些笔记本内部,get_execution_role() 将返回作为笔记本创建的一部分传入的 IAM 角色名称.这允许在不更改代码的情况下执行笔记本示例.

From inside these notebooks, get_execution_role() will return the IAM role name that was passed in as part of the notebook creation. That allows the notebook examples to be executed without code changes.

在这些笔记本之外,get_execution_role() 将返回一个异常,因为它不知道 SageMaker 需要的角色名称是什么.

From outside these notebooks, get_execution_role() will return an exception because it does not know what is the role name that SageMaker requires.

要解决此问题,请传递 IAM 角色名称而不是使用 get_execution_role().

To solve this issue, pass the IAM role name instead of using get_execution_role().

代替:

role = get_execution_role()

kmeans = KMeans(role=role,
                train_instance_count=2,
                train_instance_type='ml.c4.8xlarge',
                output_path=output_location,
                k=10,
                data_location=data_location)

你需要做的:

role = 'role_name_with_sagemaker_permissions'

kmeans = KMeans(role=role,
                train_instance_count=2,
                train_instance_type='ml.c4.8xlarge',
                output_path=output_location,
                k=10,
                data_location=data_location)

这篇关于当前的 AWS 身份不是 sagemaker 的角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆