Using AWS Lambda with Scheduled Events
You can create a Lambda function and direct AWS Lambda to execute it on a regular schedule. You can specify a fixed rate (for example, execute a Lambda function every hour or 15 minutes), or you can specify a Cron expression. For more information on expressions schedules, see Schedule Expressions Using Rate or Cron.
This functionality is available when you create a Lambda function using the AWS Lambda console or the AWS CLI. To configure it using the AWS CLI, see Run an AWS Lambda Function on a Schedule Using the AWS CLI. The console provides the CloudWatch Events - Schedule as an event source. At the time of creating a Lambda function, you choose this event source and specify a time interval.
If you have made any manual changes to the permissions on your function, you may need to reapply the scheduled event access to your function. You can do that by using the following CLI command.
aws lambda add-permission \ --statement-id 'Allow-scheduled-events' \ --action 'lambda:InvokeFunction'\ --principal 'events.amazonaws.com'\ --function-name function:MyFunction
Each AWS account can have up to 50 unique event sources of the CloudWatch Events - Schedule source type. Each of these can be the event source for up to five Lambda functions. That is, you can have up to 250 Lambda functions that can be executing on a schedule in your AWS account.
The console also provides a blueprint (lambda-canary) that uses the CloudWatch Events - Schedule source type. Using this blueprint, you can create a sample Lambda function and test this feature. The example code that the blueprint provides checks for the presence of a specific webpage and specific text string on the webpage. If either the webpage or the text string is not found, the Lambda function throws an error.
For a tutorial that walks you through an example setup, see Tutorial: Using AWS Lambda with Scheduled Events.