EN
EspañolEnglishFrançaisDeutschPortuguêsItaliano
Sign in Start free
Lambda

How to schedule a Lambda function to run on its own every night

You have a task that must happen every day at a set time: cleaning up, sending a summary, checking something. How to make a Lambda function run on its own with EventBridge Scheduler, in your time zone, and how to know whether it ran. Explained for anyone who has never scheduled a task in the cloud.

⏱ 15 minutes ◎ For everyone Updated on 26/10/2026

Some tasks are not launched by anyone: they happen every night. Deleting temporary files, sending the daily summary, checking that a website responds, making a backup. On a classic server you used cron; in AWS, when the task is a small program, the clean way is a Lambda function (the code) plus a scheduler (the alarm clock) that calls it at the time you say. The scheduler is called EventBridge Scheduler and is free in practice for a few executions a day. This guide connects the two.

Before you start: what each thing means

Lambda function
A piece of your code stored at Amazon that runs when something calls it. You pay per execution, not for having anything switched on.
EventBridge Scheduler
The AWS alarm clock: it performs an action (for example, calling your function) at the times you schedule.
Schedule
Each "alarm" of the alarm clock: when and whom to call.
Cron expression
The classic way of writing repeating timetables with numbers: minute, hour, day of the month, month, day of the week. The guide gives you the expressions ready-made.
Time zone
Scheduler lets you choose yours (Europe/Madrid), so 3:00 is 3:00 even after the clocks change.
Execution role
The permission the alarm clock needs to call your function. Scheduler creates it on its own if you ask it to.
CloudWatch Logs
Where the function writes its diary every time it runs. It is how you check that it worked.

Step by step

  1. Get the function ready to work with nobody watching

    Open the function in the Lambda console and try it with the Test button and an empty event ({}): it must finish without errors. If it needs data (a password, an address), put them in the function's environment variables (Configuration), not in the code. And check the timeout (General configuration): if the task takes two minutes and the limit is three seconds, it will fail every night.

  2. Open the scheduler

    Search for Amazon EventBridge in the console and, in the left-hand menu, Scheduler, Schedules, Create schedule. Name: limpieza-nocturna. Group: the default one.

  3. Say when

    Pattern: Recurring schedule, type Cron-based schedule. For every night at 3:00:

    cron(0 3 * * ? *)

    For 8:00 Monday to Friday: cron(0 8 ? * MON-FRI *). For the 1st of every month at 7:00: cron(0 7 1 * ? *). Below, Time zone: choose yours (Europe/Madrid). The screen shows you the next ten executions so you can check they are the ones you expect. Flexible time window: Off if you want the exact time.

  4. Say whom to call

    Target: Templated targets, AWS Lambda - Invoke. Select your function in the dropdown. In Payload you can leave {} or pass data for the function to read from the event, for example {"modo": "nocturno"}: that way the same function can do different things depending on who calls it.

  5. Permissions and retries

    Under Settings, leave Create new role for this schedule: Scheduler will give it exactly the permission to invoke that function. In the retry policy, 2 or 3 retries are fine for a task that is harmless to repeat; for one that sends emails, set 0 so it does not send twice. Leave the action after completion as NONE (the recurring schedule is not deleted). Next, review and Create schedule.

  6. Check the first execution

    The next day (or set a test execution five minutes from now and then change it), open the function, Monitor tab: the invocations chart must show one at the scheduled time, and View CloudWatch logs shows what it wrote. If there is nothing, look at the schedule in Scheduler: its state must be "Enabled" and the details tab shows the last execution and whether it failed.

What can go wrong

It did not run at the time I set

You left the time zone on UTC: in winter that is one hour behind Spain, in summer two. Edit the schedule and choose Europe/Madrid. Or the cron expression has its fields mixed up: in AWS the order is minute, hour, day of the month, month, day of the week, year, and one of the two "day" fields must be ?.

It runs but the function fails

The problem is the function, not the alarm clock. Look at the CloudWatch logs: the exception is there. The usual causes: it is missing a permission to do what it does (its own execution role), or it runs out of time.

It runs twice

Retries: the first execution failed or took too long and Scheduler retried. Lower the retries to 0 if repeating is a problem, and make sure the function does not take longer than its limit.

I want to pause the task for a few days

In Scheduler, select the schedule and Disable. It stays saved; you enable it again whenever you want. No need to delete it.

In Simplio

In Simplio each Lambda function shows its last execution, whether it went well and what it wrote, and scheduling it means choosing "every day", "every week" or "every month" and a time in your time zone: Simplio creates the schedule and the permission. If an execution fails, it alerts you by email. And you can run it right now with a button and see the response, without leaving the screen.

The same task, in AWS and in Simplio

In the AWS consoleIn Simplio
Scheduling the functionEventBridge Scheduler: cron expression, time zone, target, role, retries: 6 stepsOn the function: "every day at 3:00" in a dropdown and a time, in your time zone
Knowing whether it ranMonitor chart and CloudWatch logsLast execution, result and logs on the function card; email alert if it fails
Testing it by handTest button in Lambda with a JSON eventRun now button, with the response and the logs on the same screen

Try it free for 15 days See how it works

All of this, without the AWS console

Simplio is a panel to manage your AWS accounts: machines, scheduled copies, databases, domains, email and what AWS charges you, with per-person permissions and two-factor. Nothing installed on your servers.

Start free for 15 days, no card

Already a customer? Customer access.