amazon-web-services - 当前的AWS身份不是Sagemaker的角色吗?

标签 amazon-web-services amazon-sagemaker

我在python中从sagemaker调用get_execution_role()时遇到错误。
我已经附上了同样的错误。
enter image description here

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

最佳答案

get_execution_role()是Amazon SageMaker Examples GitHub repository中使用的功能帮助器。

这些示例是通过Amazon SageMaker提供的完全托管的Jupyter笔记本执行的。

从这些笔记本内部,get_execution_role()将返回在笔记本创建过程中传入的IAM角色名称。这样便可以在不更改代码的情况下执行笔记本示例。

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

要解决此问题,请传递IAM角色名称,而不要使用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)

关于amazon-web-services - 当前的AWS身份不是Sagemaker的角色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47710558/

相关文章:

powershell - 如何将特定类型的所有文件上传到 S3 Bucket?

mysql 高效执行数百万条 INSERT 语句

amazon-web-services - 更改 SageMaker 上训练模型的预处理

amazon-web-services - 使用 "source-ref"的 AWS Ground Truth 文本分类 list 不显示文本

amazon-web-services - 适用于tensorflow和pymysql的Sagemaker内核

javascript - 如何解决 AWS 错误 : "The difference between the request time and the current time is too large" front-end only?

Amazon S3 中的 Tomcat/Apache Solr?那可能吗?

pyspark - 如何在AWS Sagemaker中集成spark.ml管道拟合和超参数优化?

python-3.x - SageMaker 脚本模式服务

amazon-web-services - Glue AWS 在 boto3 python 上创建数据目录表