我需要使用云形成模板将sns主题指定为目标。
JobFailedAlert是sns主题的名称。
我有这个模板rule.json,我收到错误
错误:
Template validation error: Template error: instance of Fn::GetAtt references undefined resource SNSTopic
模板:
{
"Resources": {
"Rule": {
"Type" : "AWS::Events::Rule",
"Properties" : {
"Description" : "create a sns alert when a batch job changes state to failed",
"EventPattern" : {
"detail-type": [
"Batch Job State Change"
],
"source": [
"aws.batch"
],
"detail": {
"jobQueue": [
"arn:aws:batch:us-east-1:************:job-queue/testbatchjobqueue"
],
"status": [
"FAILED"
]
}
},
"Name" : "alertonfailedbatchjobs2",
"State" : "Enabled",
"Targets": [
{
"Arn": { "Ref": "SNS Topic" },
"Id": "JobFailedAlert"
}
}
}
}
}
答案 0 :(得分:1)
可能是在SNS主题之前创建规则。尝试确保首先使用DependsOn
创建SNS主题,例如:
"Rule": {
DependsOn: TheSNSTopic
...
}