cloudformation模板验证错误

问题描述 投票:0回答:1

我需要使用云形成模板将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"
  }
  }
}
}
}
amazon-cloudformation amazon-sns
1个回答
1
投票

可能是在SNS主题之前创建规则。尝试确保首先使用DependsOn创建SNS主题,例如:

"Rule": {
    DependsOn: TheSNSTopic
    ...
}
© www.soinside.com 2019 - 2024. All rights reserved.