简体   繁体   English

参数值在 aws cli Cloudformation 中不起作用

[英]Parameter values are not working in aws cli Cloudformation

I am running my cloud-formation template by AWS CLI.我正在通过 AWS CLI 运行我的云形成模板。 It is working properly and creating stack on the AWS portal but I am facing one issue ie not able to change the default parameter values.它工作正常并在 AWS 门户上创建堆栈,但我面临一个问题,即无法更改默认参数值。 I am passing my own parameters with CLI but only last parameter value is changing from the stack(ie 30) rest is not changing instead picking the default values from the template body.我正在使用 CLI 传递我自己的参数,但只有最后一个参数值从堆栈中更改(即 30) rest 没有更改,而是从模板正文中选择默认值。 I have tried every possible thing by changing the positions of parameter but it still the same.我已经通过更改参数的位置尝试了所有可能的事情,但它仍然是一样的。 So please let me know how will i resolve this annoying issue.所以请让我知道我将如何解决这个烦人的问题。 This is my command:-这是我的命令:-

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"
        }
    }

I was able to reproduce this CloudFormation behavior, removing the commas between the parameter pairs ( as shown here ) fixed it for me:我能够重现此 CloudFormation 行为,删除参数对之间的逗号( 如此处所示)为我修复了它:

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

You dont need all that Double Quotes.你不需要所有的双引号。 Try尝试

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

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM