How to convert your Lambda Function into a CronJob

  1. Open the CloudWatch console
  2. Make sure you’re in your desired region, if not change it
  3. On the left panel, click on Events —> Rules
  4. Since CloudWatch Events is now EventBridge, we’ll go to Amazon EventBridge —>
  5. Click on Create rule
  6. Give it an appropriate name, usually the same as function name
  7. At the bottom select the option: Schedule (A rule that runs on time)
  8. Provide a time interval. Your Lambda Function will execute based on this time interval i.e everyday / every week / every month.
  9. A cron expression is a combination of 6 values that tell EventBridge when to run the rule. For example cron(0 12 ? *) runs the rule every day at 12:00pm UTC+0.
  10. Select the Target Type as AWS service
  11. Select the Target as Lambda function
  12. Now Select the lambda function, if it’s not there, click on the refresh button right beside or check if you’ve pushed your Lambda function into amplify properly
  13. Create a tag for easier search later on if you want
  14. Review all the config and create