簡體   English   中英

參數值在 aws cli Cloudformation 中不起作用

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

我正在通過 AWS CLI 運行我的雲形成模板。 它工作正常並在 AWS 門戶上創建堆棧,但我面臨一個問題,即無法更改默認參數值。 我正在使用 CLI 傳遞我自己的參數,但只有最后一個參數值從堆棧中更改(即 30) rest 沒有更改,而是從模板正文中選擇默認值。 我已經通過更改參數的位置嘗試了所有可能的事情,但它仍然是一樣的。 所以請讓我知道我將如何解決這個煩人的問題。 這是我的命令:-

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

我能夠重現此 CloudFormation 行為,刪除參數對之間的逗號( 如此處所示)為我修復了它:

--parameters ParameterKey=Maxvalue,ParameterValue=7 ParameterKey=increment,ParameterValue=1 ParameterKey=incrementtime,ParameterValue=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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM