简体   繁体   English

如何在Cloudformation模板参数中创建IAM角色下拉列表

[英]How can I create IAM Role Dropdown in Cloudformation Template Parameters

I'm looking for a way to list out existing IAM roles in a Cloudformation Template in a similar way to listing say EC2 Key Pairs. 我正在寻找一种方法来列出Cloudformation模板中现有的IAM角色,其方式与列出EC2密钥对相似。 Below is an example of what I'm trying with both EC2 Key Pairs and IAM Roles however Cloudformation throws an error saying that "RoleName" does not exist. 下面是我正在尝试使用EC2密钥对和IAM角色的示例,但是Cloudformation会抛出错误,指出“RoleName”不存在。

"KeyName": {
  "Description" : "Choose a Key Pair that is available in this region",
  "Type": "AWS::EC2::KeyPair::KeyName",
  "ConstraintDescription": "Must be the name of an existing EC2 Key Pair"
},
"ServiceRole": {
  "Description" : "Choose an IAM Role that is available in this region",
  "Type": "AWS::IAM::Role::RoleName",
  "ConstraintDescription": "Must be the name of an existing IAM Role"
},

Screenshot of Cloudformation Interface Any ideas if this is possible to achieve? Cloudformation Interface的屏幕截图如果有可能实现这个想法吗?

Not all types are supported in dropdown lists, and IAM Roles are not a supported type. 下拉列表中并不支持所有类型,并且IAM角色不是受支持的类型。 So you cannot get a dropdown for IAM roles. 因此,您无法获得IAM角色的下拉列表。 Instead, you will have to use a simple text box. 相反,您将不得不使用一个简单的文本框。

Here is the current list of supported parameter types: 以下是支持的参数类型的当前列表:

  • String
  • Number
  • List<Number>
  • CommaDelimitedList
  • AWS::EC2::AvailabilityZone::Name
  • AWS::EC2::Image::Id
  • AWS::EC2::Instance::Id
  • AWS::EC2::KeyPair::KeyName
  • AWS::EC2::SecurityGroup::GroupName
  • AWS::EC2::SecurityGroup::Id
  • AWS::EC2::Subnet::Id
  • AWS::EC2::Volume::Id
  • AWS::EC2::VPC::Id
  • AWS::Route53::HostedZone::Id
  • List<AWS::EC2::AvailabilityZone::Name>
  • List<AWS::EC2::Image::Id>
  • List<AWS::EC2::Instance::Id>
  • List<AWS::EC2::SecurityGroup::GroupName>
  • List<AWS::EC2::SecurityGroup::Id>
  • List<AWS::EC2::Subnet::Id>
  • List<AWS::EC2::Volume::Id>
  • List<AWS::EC2::VPC::Id>
  • List<AWS::Route53::HostedZone::Id>

Source: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html 资料来源: http//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以使用现有的AWS IAM角色通过Cloudformation模板创建S3存储桶吗? - Can I use existing AWS IAM role to create S3 bucket via Cloudformation template? 我可以从模板为 Cloudformation 堆栈自动创建 IAM 角色吗? - Can I AutoCreate an IAM role for a Cloudformation stack from the template? 如何识别定义了 IAM 角色的 CloudFormation 模板? - How to identify CloudFormation template that defined IAM role? 如何使用 cloudformation 创建 IAM 用户/角色 - How to use cloudformation to create an IAM user/role 如何在Cloudformation模板中指定Lambda函数和IAM角色名称 - How to specify lambda function and IAM role name in cloudformation template 如何在 aws cloudformation 模板中限制特定于 SQS 的 IAM 角色 - How to restrict IAM Role specific to SQS in aws cloudformation template 如何在我的新 CloudFormation 模板中引用现有角色? - How can I reference an existing role in my new CloudFormation template? 如何允许 IAM 角色通过 cloudformation 承担另一个 IAM 角色? - how to allow IAM role to assume another IAM role, via cloudformation? Cloudformation模板为SQS创建角色 - Cloudformation template to create a role for SQS CloudFormation IAM角色 - AssumeRolePolicyDocument - CloudFormation IAM Role — AssumeRolePolicyDocument
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM