【发布时间】:2020-03-13 23:01:10
【问题描述】:
我正在尝试使用 ServiceLinkedRole for Config 为 AWS Config 服务创建 CloudFormation 堆栈,但是我不知道如何在同一 CloudFormation 模板中引用创建的 AWS Config 角色的 ARN,这是配置 sn-p:
AWSServiceLinkedRoleForConfig:
Type: 'AWS::IAM::ServiceLinkedRole'
Properties:
AWSServiceName: config.amazonaws.com
Description: AWS Config Service Linked role
ConfigRecorder:
Type: AWS::Config::ConfigurationRecorder
Properties:
Name: AWSConfigForTest
RecordingGroup:
ResourceTypes:
- "AWS::EC2::SecurityGroup"
RoleARN: ??
我尝试过以下格式:
RoleARN: !Ref "AWSServiceLinkedRoleForConfig"
传递的角色 'AWSServiceRoleForConfig' 无效。 (服务: 亚马逊配置;状态码:400;错误代码:InvalidRoleException; )
RoleARN: !Ref "AWSServiceLinkedRoleForConfig.Arn"
模板格式错误:未解决的资源依赖关系 [AWSServiceLinkedRoleForConfig.Arn] 在 Resources 块的 模板
根据下面的备忘单,ServiceLinkedRole 资源没有输出 ARN: https://theburningmonk.com/cloudformation-ref-and-getatt-cheatsheet/
如果是这种情况,我如何在 CloudFormation 模板文件中引用此角色的 ARN?
【问题讨论】: