gpt4 book ai didi

json - 无法确定哪些属性值为空?

转载 作者:行者123 更新时间:2023-12-03 07:31:48 24 4
gpt4 key购买 nike

使用以下模板(预先存在的嵌套堆栈的一部分)运行 AWS CloudFormation 时,出现“属性值不能为空”的错误消息。对于我尝试为其创建 CloudWatch 警报的两个 lambda 项目。我尝试将它作为嵌套堆栈的一部分以及模板本身来运行,但无济于事。谁能提供任何见解?

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Creation of CloudWatch Alarms",
"Resources": {
"CLFirstLambdaAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmName": "CLFirstLambdaErrors",
"AlarmDescription": "Alarms when an error occurs on the first lambda",
"AlarmActions": [{ "Ref": "AlarmNotificationTopic" }],
"MetricName": "Errors",
"Namespace": "AWS/Lambda",
"Dimensions": [{
"Name": "first-lambda"
},
{
"Value": { "Fn::ImportValue": "CLFirstLambda" }
}
],
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"EvaluationPeriods": "1",
"Period": "60",
"Unit": "Count",
"Statistic": "Sum",
"Threshold": "1",
"TreatMissingData": "notBreaching"
}
},
"CLSecondLambdaAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmName": "CLSecondLambdaErrors",
"AlarmDescription": "Alarms when an error occurs on the second lambda",
"AlarmActions": [{ "Ref": "AlarmNotificationTopic" }],
"MetricName": "Errors",
"Namespace": "AWS/Lambda",
"Dimensions": [{
"Name": "second-lambda"
},
{
"Value": { "Fn::ImportValue": "CLSecondLambda" }
}
],
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"EvaluationPeriods": "1",
"Period": "60",
"Unit": "Count",
"Statistic": "Sum",
"Threshold": "1",
"TreatMissingData": "notBreaching"
}
},
"AlarmNotificationTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {
"TopicName": "cl-alarm-topic",
"Subscription": [{
"Endpoint": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6aba386a2a9aba7afa8e8a5a9ab" rel="noreferrer noopener nofollow">[email protected]</a>",
"Protocol": "email"
}]
}
}
},
"Outputs": {
"AlarmNotificationTopicArn": {
"Description": "ARN of AlarmNotificationTopic",
"Value": { "Ref" : "AlarmNotificationTopic" },
"Export": { "Name" : "AlarmNotificationTopic" }
}
}
}

最佳答案

CloudFormation Linter给出更详细的错误消息:

E3003 Property Value missing at Resources/CLFirstLambdaAlarm/Properties/Dimensions/0
template.json:13:30

E3003 Property Name missing at Resources/CLFirstLambdaAlarm/Properties/Dimensions/1
template.json:16:19

E3003 Property Value missing at Resources/CLSecondLambdaAlarm/Properties/Dimensions/0
template.json:37:30

E3003 Property Name missing at Resources/CLSecondLambdaAlarm/Properties/Dimensions/1
template.json:40:19

AWS::CloudWatch::Alarm

AWS::CloudWatch::Alarm.Dimension


尝试使用这些 AWS::CloudWatch::Alarm.Dimensions 属性:

              "Dimensions": [{
"Name": "first-lambda",
"Value": { "Fn::ImportValue": "CLFirstLambda" }
}
],


"Dimensions": [{
"Name": "second-lambda",
"Value": { "Fn::ImportValue": "CLSecondLambda" }
}
],

关于json - 无法确定哪些属性值为空?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61073272/

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