Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/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
redis参数组的Cloudformation_Redis_Amazon Cloudformation - Fatal编程技术网

redis参数组的Cloudformation

redis参数组的Cloudformation,redis,amazon-cloudformation,Redis,Amazon Cloudformation,我想创建一个cloudformation模板来部署redis参数组。问题在于,我的每个参数如下所示: { "Parameters": [ { "ParameterName": "activedefrag", "ParameterValue": "no", "Description": "Enabled active memory defragmentation", "Sourc

我想创建一个cloudformation模板来部署redis参数组。问题在于,我的每个参数如下所示:

{
    "Parameters": [
        {
            "ParameterName": "activedefrag",
            "ParameterValue": "no",
            "Description": "Enabled active memory defragmentation",
            "Source": "user",
            "DataType": "string",
            "AllowedValues": "yes,no",
            "IsModifiable": true,
            "MinimumEngineVersion": "4.0.9",
            "ChangeType": "immediate"
        },
        {
            "ParameterName": "active-defrag-cycle-max",
            "ParameterValue": "75",
            "Description": "Maximal effort for defrag in CPU percentage",
            "Source": "user",
            "DataType": "integer",
            "AllowedValues": "1-75",
            "IsModifiable": true,
            "MinimumEngineVersion": "4.0.9",
            "ChangeType": "immediate"
        }
}
现在我了解了模板的基本格式,但不知道如何传递如上所示的参数

失败的模板:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Template to create a consul cluster",
  "Parameters": {
    "CacheParameterGroupFamily": {
      "Description": "The name of the cache parameter group family that this cache parameter group is compatible with.",
      "Type": "String",
      "Default": "redis4.0",
      "AllowedValues": ["memcached1.4", "memcached1.5", "redis2.6", "redis2.8", "redis3.2", "redis4.0", "redis5.0"]
    },
    "ParameterGroupDescription": {
      "Description": "What this parameter group will be used for",
      "Type": "String"
    }
  },
  "Resources": {
    "RedisParameterGroup": {
      "Type": "AWS::ElastiCache::ParameterGroup",
      "Properties": {
        "CacheParameterGroupFamily" : { "Ref": "CacheParameterGroupFamily" },
        "Description" : { "Ref": "ParameterGroupDescription" },
        "Properties" : {
            "Parameters": [{
                "ParameterName": "activedefrag",
                "ParameterValue": "no",
                "Description": "Enabled active memory defragmentation",
                "Source": "user",
                "DataType": "string",
                "AllowedValues": "yes,no",
                "IsModifiable": true,
                "MinimumEngineVersion": "4.0.9",
                "ChangeType": "immediate"
            }]
        }
      }
    }
  }
}

欢迎来到StackOverflow

您需要将这些参数合并到模板的
parameters
部分中,并更改语法以使其符合标准


但是如何在该参数中指定内容呢。例如:在参数activedefrag中,如果要将“源”指定为“用户”。我该怎么做?创建堆栈时,用户必须输入模板的
参数
部分中指定的所有参数。
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Template to create a consul cluster",
  "Parameters": {
    "CacheParameterGroupFamily": {
      "Description": "The name of the cache parameter group family that this cache parameter group is compatible with.",
      "Type": "String",
      "Default": "redis4.0",
      "AllowedValues": ["memcached1.4", "memcached1.5", "redis2.6", "redis2.8", "redis3.2", "redis4.0", "redis5.0"]
    },
    "ParameterGroupDescription": {
      "Description": "What this parameter group will be used for",
      "Type": "String"
    },
    "activedefrag": {
        "Description": "Enabled active memory defragmentation",
        "Type": "String",
        "AllowedValues": ["yes", "no"],
        "Default": "no"
    },
    "activedefragcyclemax": {
        "Description": "Maximal effort for defrag in CPU percentage",
        "Type": "Number",
        "Default": 75,
        "MinValue": 1,
        "MaxValue": 75
    }
  },
  "Resources": {
    "RedisParameterGroup": {
      "Type": "AWS::ElastiCache::ParameterGroup",
      "Properties": {
        "CacheParameterGroupFamily" : { "Ref": "CacheParameterGroupFamily" },
        "Description" : { "Ref": "ParameterGroupDescription" },
        "Properties" : {
            "activedefrag": {"Ref": "activedefrag"},
            "active-defrag-cycle-max": {"Ref": "activedefragcyclemax"}
        }
      }
    }
  }
}