Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 复杂参数文件_Amazon Web Services_Config_Amazon Cloudformation - Fatal编程技术网

Amazon web services 复杂参数文件

Amazon web services 复杂参数文件,amazon-web-services,config,amazon-cloudformation,Amazon Web Services,Config,Amazon Cloudformation,如何使用组名设置json文件的复杂参数,我可以稍后在堆栈文件中引用为!参考数据库用户 下面是my parameters.json文件的示例: [ { "ParameterKey": "DBName", "ParameterValue": { "Default": "test", "Description": "The database name", "Type": "String", "MinLength": "1", "MaxLengt

如何使用组名设置json文件的复杂参数,我可以稍后在堆栈文件中引用为!参考数据库用户

下面是my parameters.json文件的示例:

[
{
  "ParameterKey": "DBName",
  "ParameterValue": {
     "Default": "test",
     "Description": "The database name",
     "Type": "String",
     "MinLength": "1",
     "MaxLength": "64",
     "AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
     "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
  }
},
{
  "ParameterKey": "DBUser",
  "ParameterValue" : {
     "NoEcho": "true",
     "Default": "test",
     "Description": "The database admin account username",
     "Type": "String",
     "MinLength": "1",
     "MaxLength": "16",
     "AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
     "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
  }
}
]

我会遇到如下错误:

Parameter validation failed:
Unknown parameter in Parameters[0]: "Label", must be one of: ParameterKey, ParameterValue, UsePreviousValue, ResolvedValue

我想你把两个不同的文件弄糊涂了

云信息模板用于定义参数、资源和输出。
参数
部分如下所示:

"VPCCIDR": {
  "Description": "CIDR Block for VPC",
  "Type": "String",
  "Default": "10.0.0.0/16",
  "AllowedValues": [
    "10.0.0.0/16"
  ]
},
[
  {
    "ParameterKey": "string",
    "ParameterValue": "string",
    "UsePreviousValue": true|false,
    "ResolvedValue": "string"
  }
  ...
]
定义包括参数类型、默认值等

然后是参数文件,可用于传递模板中定义的参数值。该文件不定义参数本身,而是为参数提供一个值列表,而不必在命令行上指定它们

它看起来像:

"VPCCIDR": {
  "Description": "CIDR Block for VPC",
  "Type": "String",
  "Default": "10.0.0.0/16",
  "AllowedValues": [
    "10.0.0.0/16"
  ]
},
[
  {
    "ParameterKey": "string",
    "ParameterValue": "string",
    "UsePreviousValue": true|false,
    "ResolvedValue": "string"
  }
  ...
]
根据您的问题,我认为您应该使用第一类文件,它定义了应该部署在CloudFormation堆栈中的所有资源,而您的代码(上面)正试图将这些字段转换为第二类文件的格式


请参阅:

我认为您将两个不同的文件混淆了

云信息模板用于定义参数、资源和输出。
参数
部分如下所示:

"VPCCIDR": {
  "Description": "CIDR Block for VPC",
  "Type": "String",
  "Default": "10.0.0.0/16",
  "AllowedValues": [
    "10.0.0.0/16"
  ]
},
[
  {
    "ParameterKey": "string",
    "ParameterValue": "string",
    "UsePreviousValue": true|false,
    "ResolvedValue": "string"
  }
  ...
]
定义包括参数类型、默认值等

然后是参数文件,可用于传递模板中定义的参数值。该文件不定义参数本身,而是为参数提供一个值列表,而不必在命令行上指定它们

它看起来像:

"VPCCIDR": {
  "Description": "CIDR Block for VPC",
  "Type": "String",
  "Default": "10.0.0.0/16",
  "AllowedValues": [
    "10.0.0.0/16"
  ]
},
[
  {
    "ParameterKey": "string",
    "ParameterValue": "string",
    "UsePreviousValue": true|false,
    "ResolvedValue": "string"
  }
  ...
]
根据您的问题,我认为您应该使用第一类文件,它定义了应该部署在CloudFormation堆栈中的所有资源,而您的代码(上面)正试图将这些字段转换为第二类文件的格式

见: