将策略附加到角色无法通过 boto3

时间:2021-05-20 06:01:09

标签: python amazon-web-services aws-lambda boto3

我正在尝试将 AWSLambdaBasicExecutionRole 附加到自定义角色。程序运行没有错误,但在 AWS UI 中我没有看到附加到角色的策略。这是我的代码

iam_client = boto3.client("iam")
res = iam_client.attach_role_policy(RoleName = "dummy", PolicyArn= "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole")
print(res)

这是角色文档:

{'Version': '2012-10-17', 'Statement': [{'Effect': 'Allow', 'Principal': {'Service': 'lambda.amazonaws.com'}, 'Action': 'sts:AssumeRole'}]}

enter image description here

这里缺少什么?

0 个答案:

没有答案