首页 > 解决方案 > 属性 VPCZoneIdentifier 的值必须是字符串列表类型

问题描述

"wordpressASG": {
      "Type": "AWS::AutoScaling::AutoScalingGroup",
      "Properties": {
        "AvailabilityZones": [
          "ap-southeast-2a",
          "ap-southeast-2b"
        ],
        "VPCZoneIdentifier": [
          {
            "ref": "subnetA"
          },
          {
            "ref": "subnetB"
          }
        ],
        "MinSize": "0",
        "HealthCheckGracePeriod": 300,
        "MaxSize": "0",
        "Cooldown": "300",
        "LaunchTemplate": {
          "LaunchTemplateId": {
            "Ref": "wordpressTemplate"
          },
          "Version": {
            "Fn::GetAtt": [
              "wordpressTemplate",
              "LatestVersionNumber"
            ]
          }
        },
        "MetricsCollection": [
          {
            "Granularity": "1Minute",
            "Metrics": [
              "GroupMinSize",
              "GroupMaxSize"
            ]
          }
        ],
        "TargetGroupARNs": [
          {
            "Ref": "wordpressTG"
          }
        ]
      }
    }

可能不是一个新问题,但所有示例都是使用子网参数。List 需要是字符串,但是 ref 应该为这个东西提供字符串。子网是在同一个脚本中创建的。

标签: amazon-web-servicesamazon-ec2amazon-cloudformation

解决方案


老实说,您的参数使用List<AWS::EC2::Subnet::Id>,然后只使用它的值,而不是尝试使用列表中的单个子网。

更多参数:https ://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html


推荐阅读