Amazon-CloudFormation [SOLVED]: cloudformation template- validation error

Amazon-CloudFormation [SOLVED]: cloudformation template- validation error

Home Forums Amazon Web Services Amazon CloudFormation Amazon-CloudFormation [SOLVED]: cloudformation template- validation error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #247027

    Cloudy Point
    Keymaster

    QuestionQuestion

    I need to specify sns topic as a target using cloud formation template.

    JobFailedAlert is the name of the sns topic.

    I am have this template rule.json and I am getting the error

    Error:

    Template validation error: Template error: instance of Fn::GetAtt references undefined resource SNSTopic
    

    Template:

        {
    "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"
      }
      }
    }
    }
    }
    

    #247028

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    It may be that the rule is being created before the SNS topic. Try making sure that the SNS topic is created first by using DependsOn, such as:

    "Rule": {
        DependsOn: TheSNSTopic
        ...
    }
    

    Source: https://stackoverflow.com/questions/47915035/cloudformation-template-validation-error
    Author: Miles
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.