Skip to content

Commit f77699c

Browse files
committed
docs(srv): update
1 parent 7f59d9e commit f77699c

File tree

3 files changed

+104
-12
lines changed

3 files changed

+104
-12
lines changed

tutorials/power-on-off-instances-jobs/index.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Serverless Jobs are perfectly adapted for these autonomous tasks, as we do not n
5454

5555
For more details about variables used by `cli`, refer to the [CLI config documentation](https://cli.scaleway.com/instance/#power-on-server).
5656

57-
9. In the **Execution** tab, enter the command below, and replace the placeholder with your Instance ID:
57+
9. In the **Execution** tab, define the command below, and replace the placeholder with the ID of your Instance:
5858

5959
```
6060
scw instance server start 11111111-1111-1111-1111-111111111111
@@ -85,15 +85,15 @@ Serverless Jobs are perfectly adapted for these autonomous tasks, as we do not n
8585
- `SCW_DEFAULT_ORGANIZATION_ID`: your Organization ID.
8686
- `SCW_DEFAULT_REGION`: the preferred region.
8787

88-
<Message type="note">
89-
We recommend using Secret Manager to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
90-
</Message>
88+
<Message type="note">
89+
We recommend using Secret Manager to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
90+
</Message>
9191

92-
For more details about variables used by `cli`, refer to the [CLI config documentation](https://cli.scaleway.com/instance/#power-on-server).
92+
For more details about variables used by `cli`, refer to the [CLI config documentation](https://cli.scaleway.com/instance/#power-on-server).
9393

94-
9. In the **Execution** tab, enter the command below, and replace the placeholder with your Instance ID:
94+
9. In the **Execution** tab, define the command below, and replace the placeholder with the ID of your Instance:
9595

96-
```
96+
```sh
9797
scw instance server stop 11111111-1111-1111-1111-111111111111
9898
```
9999

tutorials/snapshot-instances-jobs/index.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@ Serverless Jobs are perfectly adapted for these autonomous tasks, as we do not n
4646
- `SCW_DEFAULT_ORGANIZATION_ID`: your Organization ID.
4747
- `SCW_DEFAULT_REGION`: concerned region.
4848

49-
<Message type="note">
50-
We recommend using Secret Manager to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
51-
</Message>
49+
<Message type="note">
50+
We recommend using Secret Manager to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
51+
</Message>
5252

53-
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+
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).
5454

55-
9. In the **Execution** tab, define the desired command: `/scw block snapshot create volume-id=11111111-1111-1111-1111-111111111111` (replace the ID with your desired volume ID).
55+
9. In the **Execution** tab, define the command below, and replace the placeholder with the ID of your Block Storage volume:
56+
```sh
57+
scw block snapshot create volume-id=11111111-1111-1111-1111-111111111111
58+
```
5659

5760
10. Click **Create job**.
5861

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
meta:
3+
title: Create recurring scheduled backups and snapshots of a database with Serverless Jobs and the Scaleway CLI
4+
description: This step-by-step tutorial will help you automate the creation and scheduling of backups and snapshots of your database using Serverless Jobs and the Scaleway CLI
5+
content:
6+
h1: Create recurring scheduled backups and snapshots of a database with Serverless Jobs and the Scaleway CLI
7+
paragraph: This step-by-step tutorial will help you automate the creation and scheduling of backups and snapshots of your database using Serverless Jobs and the Scaleway CLI
8+
tags: serverless jobs instance snapshot backup image disk storage cli schedule cron recurring
9+
categories:
10+
- instances
11+
- jobs
12+
dates:
13+
validation: 2025-03-12
14+
posted: 2024-06-19
15+
---
16+
[Scaleway Serverless Jobs](/serverless-jobs/quickstart/) allows you to create and automate recurring tasks. This tutorial will guide you through the process of creating backups and snapshots of a [Managed Database](/managed-databases-for-postgresql-and-mysql/quickstart/) on a recurring schedule using a Serverless Job.
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+
- Created a [managed database](/classic-hosting/how-to/create-postgresql-database/).
25+
26+
## Creating the job definition
27+
28+
1. In the [Scaleway console](https://console.scaleway.com), click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
29+
30+
2. Click **Create job**. The job creation wizard displays.
31+
32+
3. For **Container Image**, select **External**, and in **Image URL**, set: `scaleway/cli:latest`.
33+
34+
4. Enter a name or use the automatically generated one.
35+
36+
5. Select the region in which your job will be created.
37+
38+
6. Keep the default **resources** values, as this job requires little compute capability.
39+
40+
7. Set **cron schedule** to `0 18 * * *` and select the relevant time zone to run the job every evening at 18:00. Refer to the [cron schedules documentation](/serverless-jobs/reference-content/cron-schedules/) for more information.
41+
42+
8. Define the following environment variables:
43+
- `SCW_ACCESS_KEY`: your API access key.
44+
- `SCW_SECRET_KEY`: your API secret key.
45+
- `SCW_DEFAULT_PROJECT_ID`: your Project ID.
46+
- `SCW_DEFAULT_ORGANIZATION_ID`: your Organization ID.
47+
- `SCW_DEFAULT_REGION`: concerned region.
48+
49+
<Message type="note">
50+
We recommend using Secret Manager to store the `SCW_ACCESS_KEY` and `SCW_SECRET_KEY`.
51+
</Message>
52+
53+
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).
54+
55+
9. In the **Execution** tab, define the command below, and replace the placeholder with the ID of your Database Instance:
56+
<Tabs>
57+
<TabsTab label="Backup">
58+
```sh
59+
scw rdb backup create instance-id=11111111-1111-1111-1111-111111111111
60+
```
61+
</TabsTab>
62+
<TabsTab label="Snapshot">
63+
```sh
64+
scw rdb snapshot create instance-id=11111111-1111-1111-1111-111111111111
65+
```
66+
</TabsTab>
67+
</Tabs>
68+
10. Click **Create job**.
69+
70+
## Running the job
71+
72+
From the **Overview** tab of the Serverless job you just created, click **Actions**, then select **Run job** from the contextual menu.
73+
74+
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**.
75+
76+
## Possible improvements
77+
78+
This tutorial is a lightweight example of how to create recurring backups and snapshots of a Managed Database for PostgreSQL and MySQL. You can go further by:
79+
- Using it to manage all your Databases' backups and snapshots
80+
- Creating other recurring database operations
81+
- Setting up an alerting system in case of unexpected behavior
82+
- Explore [scaleway/serverless-examples repository](https://github.com/scaleway/serverless-examples) for advanced automation examples
83+
84+
## Additional resources
85+
86+
- [Serverless Jobs Documentation](/serverless-jobs/how-to/create-job/)
87+
- [Other methods to deploy Jobs](/serverless-jobs/reference-content/deploy-job/)
88+
- [API keys documentation](/iam/how-to/create-api-keys/)
89+
- [CRON schedule reference](/serverless-jobs/reference-content/cron-schedules/)

0 commit comments

Comments
 (0)