CloudFormation声明参数时是否只支持"Type":"String"?

Does CloudFormation only support "Type": "String" when declaring parameters?

当你在 CloudFormation 中声明参数时,你必须设置一个 "Type"。在我的实验中,"String" 似乎是唯一受支持的值。如果是这样,这个属性的用途是什么?

AWS Documentation on parameters中没有提到"Type"支持哪些值。但是,它包含一个示例,表明没有整数类型。 "WebServerPort" 也声明为 "String",尽管端口总是整数:

"Parameters" : {
   "InstanceType" : {
      "Type" : "String",
      "Default" : "m1.small",
      "Description" : "EC2 instance type, e.g. m1.small, m1.large, etc."
   },
   "WebServerPort" : {
      "Type" : "String",
      "Default" : "80",
      "Description" : "TCP/IP port of the web server"
   },
   "KeyName" : {
      "Type" : "String",
      "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server"
   }
}

String外,还有NumberList<Number>CommaDelimitedList以及各种AWS-Specific Parameter Types:

  • 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>

有关详细信息,请参阅 Properties section of the Parameters CloudFormation 文档。

请注意,指南的文档 linked to in the question was specifically regarding the Parameters Property within the AWS::CloudFormation::Stack Resource, which is why the documentation was limited there. The Template Anatomy 部分包含有关模板结构的更完整信息。