【问题标题】:Parameter values are not working in aws cli Cloudformation参数值在 aws cli Cloudformation 中不起作用
【发布时间】:2020-11-17 00:41:19
【问题描述】:

我正在通过 AWS CLI 运行我的云形成模板。它工作正常并在 AWS 门户上创建堆栈,但我面临一个问题,即无法更改默认参数值。我正在使用 CLI 传递我自己的参数,但只有最后一个参数值从堆栈中更改(即 30)其余没有更改,而是从中选择默认值 模板主体。我已经通过更改参数的位置尝试了所有可能的事情,但它仍然是一样的。 所以请让我知道我将如何解决这个烦人的问题。这是我的命令:-

aws --region eu-north-1 cloudformation  create-stack --stack-name cli4  --template-body file://app_cli.json --parameters "ParameterKey"="Maxvalue","ParameterValue"="7","ParameterKey"="increment","ParameterValue"="1","ParameterKey"="incrementtime","ParameterValue"="30"

"Parameters": {
        "EnvironmentName": {
            "Description": "An environment name that will be prefixed to resource names",
            "Type": "String",
            "Default": "Codavel"
        },
        "amiID": {
        "Description": "Put ami-id in this",
        "Type": "String",
        "Default": "ami-085045326daf7e309"
        },
        "Maxvalue": {
        "Description": "Put max value in this",
        "Type": "String",
        "Default": "100"
        },
        "increment": {
        "Description": "Put No. of incremental instance this",
        "Type": "String",
        "Default": "2"
        },
        "incrementtime": {
          "Description": "Put incremental time this",
        "Type": "String",
        "Default": "60"
          
        },
        "VpcCIDR": {
            "Description": "Please enter the IP range (CIDR notation) for this VPC",
            "Type": "String",
            "Default": "10.0.0.0/16"
        },
        "PublicSubnet1CIDR": {
            "Description": "Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone",
            "Type": "String",
            "Default": "10.0.0.0/24"
        },
        "PublicSubnet2CIDR": {
            "Description": "Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone",
            "Type": "String",
            "Default": "10.0.1.0/24"
        },
        "PrivateSubnet1CIDR": {
            "Description": "Please enter the IP range (CIDR notation) for the private subnet in the first Availability Zone",
            "Type": "String",
            "Default": "10.0.2.0/24"
        },
        "PrivateSubnet2CIDR": {
            "Description": "Please enter the IP range (CIDR notation) for the private subnet in the second Availability Zone",
            "Type": "String",
            "Default": "10.0.3.0/24"
        }
    }

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation devops aws-cli aws-cloudformation-custom-resource


    【解决方案1】:

    我能够重现此 CloudFormation 行为,删除参数对之间的逗号 (as shown here) 为我修复了它:

    --parameters ParameterKey=Maxvalue,ParameterValue=7 ParameterKey=increment,ParameterValue=1 ParameterKey=incrementtime,ParameterValue=30
    

    【讨论】:

      【解决方案2】:

      你不需要所有的双引号。试试

      aws --region eu-north-1 cloudformation  create-stack --stack-name cli4  --template-body file://app_cli.json --parameters ParameterKey=Maxvalue,ParameterValue=7,ParameterKey=increment,ParameterValue=1,ParameterKey=incrementtime,ParameterValue=30
      

      【讨论】:

      • 嗨,Oxi,感谢您的回复我已经尝试过了,但对我没有用。
      • 你能分享 Cloudformation 的参数部分吗?
      • 我已对问题进行了更改,请查看。
      猜你喜欢
      • 1970-01-01
      • 2020-03-21
      • 2016-11-12
      • 1970-01-01
      • 2020-12-04
      • 2017-11-30
      • 2017-07-27
      • 2020-06-13
      • 2019-02-22
      相关资源
      最近更新 更多