Wednesday, 15 July 2020

Building Your Own Twitter Bot - Scheduling with AWS CloudWatch Events


<< Deployment                                                Table of Contents

In this post, we will be using AWS CloudWatch to set up an event that will trigger our AWS Lambda function at regular intervals.

There are a couple of ways to achieve this outcome. We can either create the event first in CloudWatch and link to the Lambda function or we can create it directly via AWS Lambda.

Let's go with the second option.

Open the AWS Lamba function, under Designer we want to see the following setup. Notice the CloudWatch Event trigger.

To add this trigger, click on "Add trigger"


Select EventBridge(CloudWatch Events)



You will now see a Rule dropdown box. Select "Create a new rule"


We want an event to trigger an AWS Lambda function once a day.

Set the Rule name to "RunOnceADay".

Select "Schedule expression" as Rule type.
Set the Schedule expression to "rate(1 day)".
The Schedule expression can support cron or rate expressions.

Click on "Add"

That's it! As long as the Event is enabled on the Lambda function, it will be triggered each and every day.

<< Deployment                                                Table of Contents





No comments:

Post a Comment