我正在尝试为DynamoDB自动部署DAX,但是不断从python和CLI获得以下错误:
调用CreateCluster操作时发生错误(InvalidParameterValueException):无权假定角色:
arn:aws:iam::xxxxxxxxxxxx:role/service-role/230e772f-DAXServiceRole
我使用的CLI命令是:
aws dax create-cluster --region some.region --cluster-name some.dax_name --node-type some.node_type --replication-factor 1 --subnet-group-name some.subnet_group_name --security-group-ids some.security_group_id --iam-role-arn some.iam_role_arn
直接从cli运行它,工作正常,通过控制台手动运行也可以正常工作。其他人有这个问题吗?
答案 0 :(得分:0)
好的,看来我的脚本在创建角色之后过早尝试创建DAX集群。这导致它无法找到它。我在这之间增加了时间,因此能够找到该角色。
答案 1 :(得分:0)
需要使用服务创建IAM角色,否则您将遇到相同的错误,例如,我使用以下策略创建了角色,并且遇到了相同的问题。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "some role arn"
},
"Action": "sts:AssumeRole"
}
]
}
基本上,以上策略将在“委托人”下添加信任实体。
Dax IAM角色需要使用以下策略方法创建,以避免出现上述错误。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "dax.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
有关更多详细信息,请查看aws doc https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.create-cluster.cli.create-service-role.html