NavigationContentFooter
Jump toSuggest an edit
Was this page helpful?

Power your Instance on and off with Serverless Jobs and the Scaleway CLI

Reviewed on 23 June 2025Published on 09 June 2025
  • serverless
  • jobs
  • instance
  • cli
  • turn
  • on
  • off
  • power
  • start
  • stop
  • reboot

Scaleway Serverless Jobs allows you to create and automate recurring tasks. This tutorial will guide you through the process of powering a Scaleway Instance on and off, on a recurring schedule using a Serverless Job.

Serverless Jobs are perfectly adapted for these autonomous tasks, as we do not need autoscaling or exposure via a web server. Refer to the documentation on differences between jobs, containers, and functions for more information.

Before you startLink to this anchor

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console.
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization.
  • Created an Instance.

Creating the job definitionsLink to this anchor

Serverless Job to power on the InstanceLink to this anchor

  1. In the Scaleway console, click Jobs in the Serverless section of the side menu. The jobs page displays.

  2. Click Create job. The job creation wizard displays.

  3. For Container Image, select External, and in Image URL, set: scaleway/cli:latest.

  4. Enter a name or use the automatically generated one.

  5. Select the region in which your job will be created.

  6. Keep the default resources values, as this job requires little compute capability.

  7. Set cron schedule to 0 9 * * 1-5 and select the relevant time zone to run the job every morning at 9:00 a.m (09:00) from Monday through Friday. Refer to the cron schedules documentation for more information.

  8. Define the following environment variables:

    • SCW_ACCESS_KEY: your API access key.
    • SCW_SECRET_KEY: your API secret key.
    • SCW_DEFAULT_PROJECT_ID: your Project ID.
    • SCW_DEFAULT_ORGANIZATION_ID: your Organization ID.
    • SCW_DEFAULT_REGION: the preferred region.
Note

We recommend using Secret Manager to store the SCW_ACCESS_KEY and SCW_SECRET_KEY.

For more details about variables used by cli, refer to the CLI config documentation.

  1. In the Execution tab, define the command below, and replace the placeholder with the ID of your Instance:

    /scw instance server start 11111111-1111-1111-1111-111111111111
  2. Click Create job.

Serverless Job to power off the InstanceLink to this anchor

  1. In the Scaleway console, click Jobs in the Serverless section of the side menu. The jobs page displays.

  2. Click Create job. The job creation wizard displays.

  3. For Container Image, select External, and in Image URL, set: scaleway/cli:latest.

  4. Enter a name or use the automatically generated one.

  5. Select the region in which your job will be created.

  6. Keep the default resources values, as this job requires little compute capability.

  7. Set cron schedule to 0 18 * * 1-5 and select the relevant time zone to run the job every evening at 6:00 p.m (18:00) from Monday through Friday. Refer to the cron schedules documentation for more information.

  8. Define the following environment variables:

    • SCW_ACCESS_KEY: your API access key.
    • SCW_SECRET_KEY: your API secret key.
    • SCW_DEFAULT_PROJECT_ID: your Project ID.
    • SCW_DEFAULT_ORGANIZATION_ID: your Organization ID.
    • SCW_DEFAULT_REGION: the preferred region.
    Note

    We recommend using Secret Manager to store the SCW_ACCESS_KEY and SCW_SECRET_KEY.

    For more details about variables used by cli, refer to the CLI config documentation.

  9. In the Execution tab, define the command below, and replace the placeholder with the ID of your Instance:

    /scw instance server stop 11111111-1111-1111-1111-111111111111
  10. Click Create job.

Testing the jobsLink to this anchor

According to the current state of your Instance, run either the Power on or Power off job first.

From the Overview tab of each Serverless job you just created, click Actions, then select Run job from the contextual menu.

The execution appears in the Job runs section. You can access the logs of your jobs by clicking «See more Icon» next to the job run ID, and selecting See on Cockpit.

Possible improvementsLink to this anchor

This tutorial is a lightweight example of how to manage the power cycle of an Instance. You can go further by:

  • Using it to manage all your Instances’ power cycles
  • Using Jobs to create snapshots of your Instances
  • Setting up an alerting system in case of unexpected behavior
  • Exploring scaleway/serverless-examples repository for advanced automation examples

Additional resourcesLink to this anchor

  • Serverless Jobs Documentation
  • Other methods to deploy Jobs
  • API keys documentation
  • CRON schedule reference
Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2025 – Scaleway