Skip to content

Commit eba2dc6

Browse files
committed
docs(srv): how to automate scw resource mgmt w/ jobs MTA-6074
1 parent 5352238 commit eba2dc6

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
meta:
3+
title: How to automate the management of your resources using Serverless Jobs
4+
description: This step-by-step guide will help you automate the management of your resources using Serverless Jobs and the Scaleway CLI
5+
content:
6+
h1: How to automate the management of your resources using Serverless Jobs
7+
paragraph: This step-by-step guide will help you automate the management of your resources using Serverless Jobs and the Scaleway CLI
8+
tags: serverless jobs command line interface cli automate resources management
9+
categories:
10+
- developer-tools
11+
- jobs
12+
dates:
13+
validation: 2025-06-13
14+
posted: 2025-06-13
15+
---
16+
[Scaleway Serverless Jobs](/serverless-jobs/quickstart/) allows you to create and automate recurring tasks. This page shows how to create jobs to perform any operation available with the [Scaleway CLI](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/config.md) to auo automate the management of your Scaleway resources.
17+
18+
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](/serverless-jobs/reference-content/difference-jobs-functions-containers/) for more information.
19+
20+
<Macro id="requirements" />
21+
22+
- A Scaleway account logged into the [console](https://console.scaleway.com).
23+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization.
24+
25+
## Creating the job definition
26+
27+
1. In the [Scaleway console](https://console.scaleway.com), click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
28+
29+
2. Click **Create job**. The job creation wizard displays.
30+
31+
3. For **Container Image**, select **External**, and in **Image URL**, set: `scaleway/cli:latest`.
32+
33+
4. Enter a name or use the automatically generated one.
34+
35+
5. Select the region in which your job will be created.
36+
37+
6. Keep the default **resources** values, as this job requires little compute capability.
38+
39+
7. Optionally, set a **cron schedule** (in the `* * * * *` format), and select the relevant time zone to run the job at the desired frequency. Refer to the [cron schedules documentation](/serverless-jobs/reference-content/cron-schedules/) for more information.
40+
41+
8. Define the following environment variables:
42+
- `SCW_ACCESS_KEY`: your API access key.
43+
- `SCW_SECRET_KEY`: your API secret key.
44+
- `SCW_DEFAULT_PROJECT_ID`: your Project ID.
45+
- `SCW_DEFAULT_ORGANIZATION_ID`: your Organization ID.
46+
- `SCW_DEFAULT_REGION`: desired region.
47+
48+
<Message type="note">
49+
We recommend using [Secret Manager](/secret-manager/quickstart/) to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
50+
</Message>
51+
52+
For more details about variables used by `cli`, refer to the [CLI config documentation](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/config.md).
53+
54+
9. In the **Execution** tab, define the desired Scaleway CLI command, as shown in the examples below:
55+
56+
<Tabs id="cli-examples">
57+
<TabsTab label="">
58+
</TabsTab>
59+
<TabsTab label="">
60+
</TabsTab>
61+
</Tabs>
62+
63+
10. Click **Create job**.
64+
65+
## Running the job
66+
67+
From the **Overview** tab of the Serverless job you just created, click **Actions**, then select **Run job** from the contextual menu.
68+
69+
The execution appears in the **Job runs** section. You can access the logs of your job by clicking <Icon name="more" /> next to the job run ID, and selecting **See on Cockpit**.

0 commit comments

Comments
 (0)