2017-08-12 40 views
0

我正在尋找一種方式,列出在Cloudformation模板的現有IAM角色以類似的方式,以上市說EC2密鑰對。下面是什麼,我既EC2密鑰對和IAM角色試圖然而Cloudformation拋出一個錯誤,指出「角色名」不存在的例子。我怎樣才能創建Cloudformation模板參數IAM角色下拉

"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 任何想法,如果這是可能實現的?

回答

3

並非所有類型在下拉列表的支持,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

+0

太好了!感謝您的聯繫和詳細的解答@馬特 - 豪澤 –

相關問題