如何在 Cloudformation 模板参数中创建 IAM 角色下拉列表
How can I create IAM Role Dropdown in Cloudformation Template Parameters
我正在寻找一种在 Cloudformation 模板中列出现有 IAM 角色的方法,其方式类似于列出 EC2 密钥对。下面是我正在尝试使用 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
如果这有可能实现,有什么想法吗?
并非所有类型都在下拉列表中受支持,并且 IAM 角色不是受支持的类型。因此,您无法获得 IAM 角色的下拉列表。相反,您将不得不使用一个简单的文本框。
这是当前支持的参数类型列表:
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>
来源:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
我正在寻找一种在 Cloudformation 模板中列出现有 IAM 角色的方法,其方式类似于列出 EC2 密钥对。下面是我正在尝试使用 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 如果这有可能实现,有什么想法吗?
并非所有类型都在下拉列表中受支持,并且 IAM 角色不是受支持的类型。因此,您无法获得 IAM 角色的下拉列表。相反,您将不得不使用一个简单的文本框。
这是当前支持的参数类型列表:
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>
来源:http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html