按照模板中的顺序订购参数

问题描述

在控制台中创建堆栈时,控制台将按其逻辑ID的字母顺序列出输入参数。有使用界面自定义订单的方法

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-interface.html

但是有什么方法可以按照模板中的说明对参数进行排序?

解决方法

使用AWS::CloudFormation::Interface可以设置顺序,此外,您还可以将参数分组在一起。在Parameters列表中指定参数的顺序将成为它们在控制台中显示的顺序。

以下示例,取自the aws docs

Metadata: 
  AWS::CloudFormation::Interface: 
    ParameterGroups: 
      - 
        Label: 
          default: "Network Configuration"
        Parameters: 
          - VPCID
          - SubnetId
          - SecurityGroupID
      - 
        Label: 
          default: "Amazon EC2 Configuration"
        Parameters: 
          - InstanceType
          - KeyName
    ParameterLabels: 
      VPCID: 
        default: "Which VPC should this be deployed to?"