简体   繁体   English

AWS CloudFormation:“参数[subnetIds]无效”

[英]AWS CloudFormation: “Parameter [subnetIds] is invalid”

I have a AWS CodePipeline to deploy a stack in CloudFormation using a YAML template as well as a template configuration JSON file. 我有一个AWS CodePipeline,可使用YAML模板以及模板配置JSON文件在CloudFormation中部署堆栈。

Relevant Template Snippet: 相关模板摘要:

AWSTemplateFormatVersion: '2010-09-09'
...
Parameters:
  subnetIds:
    Type: List<AWS::EC2::Subnet::Id>
...

Relevant Configuration File Snippet: 相关配置文件片段:

{
    "Parameters": {
      ...
      "subnetIds": [
        "subnet-a",
        "subnet-b",
        "subnet-c"
      ]
    },
    ...
}

For some reason the Deploy stage (CloudFormation) keeps failing with Parameter [subnetIds] is invalid , so my question is how do I pass a list of subnetIds to the template from the configuration file? 由于某些原因,部署阶段(CloudFormation)不断失败, Parameter [subnetIds] is invalid ,所以我的问题是如何将配置文件中的subnetIds列表传递给模板?

It is explained here in the docs about list data types, such as: 这说明这里在有关列表数据类型,如文档:

List<AWS::EC2::Subnet::Id>

An array of subnet IDs, such as subnet-123a351e, subnet-456b351e . 子网ID的数组,例如subnet-123a351e, subnet-456b351e

That is to say, all List types in CloudFormation are also comma-separated strings. 也就是说,CloudFormation中的所有List类型也是逗号分隔的字符串。

Since you are using a CodePipeline Template Configuration File , you will have something like: 由于您使用的是CodePipeline 模板配置文件 ,因此将具有以下内容:

{
  "Parameters": {
    "subnetIds": "subnet-a,subnet-b,subnet-c"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 cloudformation 的参考参数中使用 AWS principal - How to use AWS principal in reference parameter in cloudformation Cloudformation错误:“模板验证错误:无效的模板参数属性&#39;VPC&#39;” - Cloudformation error: “Template validation error: Invalid template parameter property 'VPC'” 如何在 aws cloudformation yaml 模板中格式化数据类型 json 的参数? - How to format parameter of data type json in a aws cloudformation yaml template? 使用 AWS CloudFormation json 创建堆栈时 AWS::Route53::RecordSet 中出现无效请求错误 - Invalid request error in AWS::Route53::RecordSet when creating stack with AWS CloudFormation json AWS CloudFormation链接功能 - AWS CloudFormation chaining functions AWS CLI:解析参数“--item”时出错:JSON 无效: - AWS CLI: Error parsing parameter '--item': Invalid JSON: AWS CLI:解析参数“--config-rule”时出错:JSON 无效: - AWS CLI: Error parsing parameter '--config-rule': Invalid JSON: 网络接口的 AWS CloudFormation 错误 - AWS CloudFormation error with network interface 简单StackPolicy在CloudFormation上始终无效 - Simple StackPolicy always invalid on CloudFormation cloudformation- 如何在 AWS::CloudFormation::Init 部分的来源中使用 Ref? - cloudformation- how to use Ref in sources of AWS::CloudFormation::Init section?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM