gpt4 book ai didi

amazon-web-services - IAM CloudFormation 模板 AWS 角色

转载 作者:行者123 更新时间:2023-12-03 07:32:40 25 4
gpt4 key购买 nike

因此,如果我要为开发人员创建一个联合开发人员角色(废话)并以 cf 模板的形式将其推送到 AWS,则该角色的名称就是我所命名的。但由于某种原因,如果该角色是为 AWS 服务/资源而设计的(例如,EC2 实例的 Lambda 角色),则该角色会附加一个看似随机的 12 个字符的字符串。

例如:iam-lam-role-85C94J38RDE2

为什么 CloudFormation 会自动附加此内容?

最佳答案

请参阅Name Type CloudFormation 文档部分:

By default, AWS CloudFormation generates a unique physical ID to name a resource. For example, AWS CloudFormation might name an Amazon S3 bucket with the following physical ID stack123123123123-s3bucket-abcdefghijk1. [...]

If you want to use a custom name, specify a name property for that resource in your AWS CloudFormation template.

对于AWS::IAM::Role (这是 resources that supports custom names 之一),指定 RoleName属性来提供自定义名称。

您的问题表明,默认物理 ID 实际上是根据 AssumeRolePolicyDocument 的内容而更改的。 AWS::IAM::Role 资源中的属性。我在实践中没有观察到任何此类行为,因此我认为您可能为一种资源指定了 RoleName,而不是另一种资源。

关于amazon-web-services - IAM CloudFormation 模板 AWS 角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41983558/

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