Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I already have my lambda/roles defined in cloudformation and would love to also use it to add a scheduled eventsources ... are there any docs or examples around?

1 Answer

0 votes
by (44.4k points)

Using these:

// rule to periodically call the lambda

"TagWatcherRule": {

  "Type": "AWS::Events::Rule",

  "Properties": {

    "ScheduleExpression": "rate(10 minutes)",

    "Targets": [

      {

        "Id": "TagWatcherScheduler",

        "Arn": {

          "Fn::GetAtt": [

            "TagWatcherFunction",

            "Arn"

          ]

        }

      }

    ]

  }

},

// role may call the lambda

"InvokeLambdaPermission": {

  "Type": "AWS::Lambda::Permission",

  "Properties": {

    "FunctionName": {

      "Fn::GetAtt": [

        "TagWatcherFunction",

        "Arn"

      ]

    },

    "Action": "lambda:InvokeFunction",

    "Principal": "events.amazonaws.com",

    "SourceArn": {

      "Fn::GetAtt": [

        "TagWatcherRule",

        "Arn"

      ]

    }

  }

}

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories

...