amazon-web-services - CloudFormation参数模板错误: Parameter is non alphanumeric

标签 amazon-web-services parameters aws-cloudformation

我正在使用

aws cloudformation validate-template --template-body file://template.json

然后出现错误:

CloudFormation Parameter Template Error : Parameter is non alphanumeric

以下代码显示了我的 params.jsontemplate.json 文件。

params.json

[
    {
        "ParameterKey": "name_for_abc",
        "ParameterValue": "abc"
    }
]

模板.json

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Transform": "AWS::Serverless-2016-10-31",
    "Description": "some text",
    "Parameters": {
        "name": {
            "Description": "name_of_abc",
            "Type": "String"
        }
    },
    "Resources": {
        "LambdaFunctionAuto": {
            "Type": "AWS::Serverless::Function",
            "Properties": {
                "Environment": {
                    "Variables": {
                        "name_of_abc": {
                            "Ref": "name_of_abc"
                        }
                    }
                }
            }
        }
    }
}

最佳答案

要解决此问题,请将 params.json 文件和 Parameters 中的参数 name_of_abc 重命名为 nameofabc > CloudFormation 模板的部分。

来自AWS documentation :

Each parameter must be given a logical name (also called logical ID), which must be alphanumeric and unique among all logical names within the template.

关于amazon-web-services - CloudFormation参数模板错误: Parameter is non alphanumeric,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53626203/

相关文章:

PHP AWS DynamoDB : Limit the Number of Total Query Results Using an Iterator

powershell - 仅在提供值时传递参数

amazon-web-services - 从管理器检索 secret 并在 ec2 cfn-init 中使用它

aws-lambda - 如何为自定义 GatewayAPI 域的 Route53 别名记录创建 SAM 模板 block

amazon-web-services - 如何替换 AWS CloudFormation 中的某些字符串

linux - Elastic Beanstalk 上的 PostgreSQL (Amazon Linux 2)

python - 将参数传递到 AWS CLI 命令

amazon-web-services - 将 AWS 拆分列表转换为多个 yaml/json block

grails - Grails如何遍历参数和设置值

c# - C#如何选择带歧义和params