是否有办法获取在当前堆栈中未创建的角色的profileInstance?可以说我在cloudformation中获得了角色的名称(作为参数传递),有没有办法获取其profileinstance?
类似:
{"Fn::GetAtt" : ["MyRoleName", "ArnOfProfileInstance"] }
一个更笼统的问题,我们可以访问在当前堆栈中还是根本没有通过Cloudformation创建的资源吗?
是,如果您知道角色的知识,则个人资料具有已知格式。例如:
# role
arn:aws:iam::xxxxxx:role/my-role-name
# profile
arn:aws:iam::xxxxxx:instance-profile/my-role-name
因此,您可以创建来自角色arn的配置文件arn。例如:
ProflieArn:
Fn::Sub:
- "arn:${AWS::Partition}:iam::${AWS::AccountId}:instance-profile/${rolename}"
- rolename: !Select [1, !Split ['/', !GetAtt MyInstanceRole.Arn] ]