gpt4 book ai didi

amazon-web-services - Lambda Cloudformation 遇到不支持的属性值错误

转载 作者:行者123 更新时间:2023-12-03 07:28:17 25 4
gpt4 key购买 nike

尝试创建 lambda 函数时,cloudformation 失败,并显示错误消息“遇到不支持的属性值”

没有提及不受支持的值,并且我找不到任何不正确的值。所有值均仅使用来自 AWS lambda 云形成模板的值。

此外,对于开发人员,我收到错误,指示安全组是字符串类型,但对于 QA 则没有收到错误。

您能否检查一下导致不受支持的值错误的原因以及如何解决开发环境的安全组相关错误。

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Create Lambda Function For abc",
"Parameters": {
"ID" : {
"Description" : "OwnerContact Value",
"Type" : "String",
"Default" : "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="05646766457d7c7f2b666a68" rel="noreferrer noopener nofollow">[email protected]</a>"
},
"abcVPCNAME": {
"Description": "abc VPC NAME",
"Type": "String",
"Default": "abc-e-dev",
"AllowedValues": [
"abc-e-dev",
"abc-e-qa",
"abc-e-prod",
"abc-w-qa",
"abc-w-prod",
]
}
},
"Mappings" : {
"params" : {
"abc-e-dev" : {
"S3bukcet" : "abc-dev-east",
"S3Key" : "/lambda/abc_S3.zip",
"TicketSNS" : "arn:aws:sns:us-east-1:212:abc",
"HOSTNAME" : "abc.com",
"ROLENAME" : "arn:aws:iam::454:role/Lambda-role",
"Subnets" : ["subnet-1","subnet-2","subnet-3"],
"SecGrps" : ["sg-1","sg-2"],
"TAG1" : "xyz",
"TAG2" : "123"
},
"abc-e-qa" : {
"S3bukcet" : "abc-qa-east",
"S3Key" : "/lambda/abc_S3.zip",
"TicketSNS" : "arn:aws:sns:us-east-1:212:abc",
"HOSTNAME" : "xyz.com",
"ROLENAME" : "arn:aws:iam::454:role/Lambda-role",
"Subnets" : ["subnet-1","subnet-2","subnet-3"],
"SecGrps" : "sg-123",
"TAG1" : "xyz",
"TAG2" : "123"
},
}
},
"Resources": {
"abcS3Get": {
"Type" : "AWS::Lambda::Function",
"Properties" : {
"Code" : {
"S3Bucket" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "S3bukcet" ]},
"S3Key" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "S3Key" ]}
},
"DeadLetterConfig" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "TicketSNS" ]},
"Description" : "abc Lambda Function For File Pickup",
"Environment" : {
"Key": "abcHOST",
"Value": { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "HOSTNAME" ]}
},
"FunctionName" : "abc-S3-Pickup",
"Handler" : "abc_S3_Get.lambda_handler",
"MemorySize" : 128,
"Role" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "ROLENAME" ]},
"Runtime" : "python2.7",
"Timeout" : 3,
"VpcConfig" : {
"SecurityGroupIds" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "SecGrps" ]},
"SubnetIds" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "Subnets" ]}
},
"Tags" : [{
"Key" : "KEY1",
"Value" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "TAG1" ]}
},
{
"Key" : "KEY2",
"Value" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "TAG2" ]}
},
{
"Key" : "KEY3",
"Value" : {"Ref":"ID"}
}
]
}
}
}
}

最佳答案

找到解决方案。这是环境中的值参数不正确的问题。

已更正以下内容并解决了问题。

"Environment" : {
"Variables" : {
"abcHOST": {
"Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "HOSTNAME" ]
}
}

还有其他一些问题。

"S3Key" : "/lambda/abc_S3.zip",

应该是

"S3Key" : "lambda/abc_S3.zip",

Deadletterconfig 参数也需要更改。

Current Value:

"DeadLetterConfig" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "TicketSNS" ]},

Correct Value:

"DeadLetterConfig" : {
"TargetArn" : { "Fn::FindInMap" : [ "params", {"Ref":"abcVPCNAME"}, "TicketSNS" ]}
},

在完成上述所有更改后,CFT 开始工作。

关于amazon-web-services - Lambda Cloudformation 遇到不支持的属性值错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47668425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com