gpt4 book ai didi

amazon-web-services - 如何在cloudformation中引用AWS托管策略arn?

转载 作者:行者123 更新时间:2023-12-03 07:10:43 27 4
gpt4 key购买 nike

我将使用 cloudformation 创建一个 IAM 用户,并且需要附加 AWS 托管策略 AWSAppSyncInvokeFullAccess。我想我应该使用像下面的代码这样的托管策略:

Resources:
publisherUser:
Type: AWS::IAM::User
Properties:
UserName: userName
ManagedPolicyArns:
- !Ref AWSAppSyncInvokeFullAccess
- !Ref AWSLambdaBasicExecutionRole

但它不起作用,因为 AWSAppSyncInvokeFullAccess 来自 AWS 而不是来自此模板。引用政策的正确方法是什么?

最佳答案

这些是现有的 AWS 托管策略。因此,您应该使用他们的完整 ARN,您可以从 IAM 控制台获取该信息:

Resources:
publisherUser:
Type: AWS::IAM::User
Properties:
UserName: userName
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AWSAppSyncInvokeFullAccess
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

更新

或者使其独立于分区:

Resources:
publisherUser:
Type: AWS::IAM::User
Properties:
UserName: userName
ManagedPolicyArns:
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AWSAppSyncInvokeFullAccess"
- !Sub "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"

关于amazon-web-services - 如何在cloudformation中引用AWS托管策略arn?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64564447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com