amazon-web-services - AWS Sagemaker 自动扩展 | 假定角色角色没有访问权限
问题描述
我有一个要自动扩展的 sagemaker 实例,目前它正在处理 4 个实例,但我想根据负载将其从 1 个自动扩展为 4 个。
这是我用来自动缩放的代码
resource_id = 'endpoint/[end-point-name]/variant/config1'
sc_client = boto3.client('application-autoscaling')
role = 'arn:aws:iam::[1234]:role/service-role/AmazonSageMaker-ExecutionRole-[1234]'
response = sc_client.register_scalable_target(
ServiceNamespace='sagemaker',
ResourceId=resource_id,
ScalableDimension='sagemaker:variant:DesiredInstanceCount',
MinCapacity=1,
MaxCapacity=4,
RoleARN= role,
SuspendedState={
'DynamicScalingInSuspended': True,
'DynamicScalingOutSuspended': True,
'ScheduledScalingSuspended': True
}
)
我已将所有资源的所有访问权限(sagemaker 和 cloudwatch)授予此角色:AmazonSageMaker-ExecutionRole-[1234]
现在,每当我运行此代码时,我都会收到此错误
ClientError: An error occurred (AccessDeniedException) when calling the RegisterScalableTarget
operation: User: arn:aws:sts::[1234]:assumed-role/AmazonSageMaker-ExecutionRole-[1234]/SageMaker
is not authorized to perform: iam:PassRole on resource: arn:aws:iam::[1234]:role/service-role/AmazonSageMaker-ExecutionRole-[1234]
现在我不确定它是如何选择“假定角色”而不是“服务角色”以及如何解决这个问题,我正在使用具有所有访问权限的管理员帐户,并且上述“服务角色”也具有所有使用权
解决方案
When users call RegisterScalableTarget, Application Auto Scaling creates a service-linked role in your account, if the role does not exist already. The service-linked role grants permissions to Application Auto Scaling, so that it can call other services on your behalf.
For automatic role creation to succeed, users must have permissions for the iam:CreateServiceLinkedRole action.
SageMaker 文档中也提到了这一点。
从错误消息中,您的角色似乎缺少 CreateServiceLinkedRole 操作。我会将 IAM 策略与 SageMaker 自动缩放文档中提供的示例进行比较,确保所有必需的权限都存在,然后重试。
推荐阅读
- android-adapterview - adapterviewflipper 上的页面指示器
- java - 获取JAVA中存储过程的返回值
- powershell - 如何从文件中读取名称和 IP 地址?
- python-3.x - 为什么在部署到 AppEngine 时没有安装 requirements.txt?
- qt - CUDA 10 不支持高于 7 的 Gcc 版本 - Arch Linux 中的 Qt 错误
- elasticsearch - Elasticsearch 集群运行状况在“绿色”和“黄色”之间间歇性波动
- apache-spark - 有没有办法在运行 master 的不同服务器上提交 spark 作业
- node.js - 从两个 json 文件中获取数据 ajax 节点
- json - React--Div 存在,但为空&更多问题
- regex - awk - 在文本文件中搜索多个命令行参数