You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,200 +22,36 @@ Serverless Jobs are perfectly adapted for these autonomous tasks, as we do not n
22
22
23
23
- A Scaleway account logged into the [console](https://console.scaleway.com)
24
24
-[Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
25
-
- Created a [Container Registry namespace](/container-registry/how-to/create-namespace/).
26
25
- Created an [Instance](/instances/how-to/create-an-instance/)
27
-
- Installed and started the [Docker daemon](https://docs.docker.com/engine/install/) to build the image.
28
-
29
-
## Creating the snapshot generator files
30
-
31
-
<Messagetype="note">
32
-
You can also download the work files by cloning our [Scaleway Serverless examples repository](https://github.com/scaleway/serverless-examples/tree/main/jobs/instances-snapshot).
33
-
</Message>
34
-
35
-
1. Create a file named `main.go`, and add the code below to it:
3. Run the following command to download the required dependencies:
142
-
143
-
```go
144
-
go get
145
-
```
146
-
147
-
## Building and pushing the image to Container Registry
148
-
149
-
Serverless Jobs rely on containers to run in the cloud and therefore require a [container image](/serverless-jobs/concepts/#container-image) hosted in the cloud using [Scaleway Container Registry](/container-registry/).
150
-
151
-
1. Create a `Dockerfile`, and add the following code to it:
152
-
153
-
```dockerfile
154
-
# Using apline/golang image
155
-
FROM golang:1.23-alpine
156
-
157
-
# Set destination for COPY
158
-
WORKDIR /app
159
-
160
-
# Copy required files
161
-
COPY go.mod ./
162
-
COPY go.sum ./
163
-
COPY *.go ./
164
-
165
-
# Build the executable
166
-
RUN go build -o /jobs-snapshot
167
-
168
-
# Run the executable
169
-
CMD [ "/jobs-snapshot" ]
170
-
```
171
-
172
-
2. Run the following command in a terminal to connect to your Container Registry namespace. Do not forget to edit the command with your namespace name.
Your image and its tag now appear in the [Container Registry in the Scaleway console](https://console.scaleway.com/registry/namespaces).
194
26
195
27
## Creating the Job Definition
196
28
197
29
1. In the [Scaleway console](https://console.scaleway.com), click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
198
30
199
31
2. Click **Create job**. The job creation wizard displays.
200
32
201
-
3.Select the **Scaleway**Container Registry, then select your Container Registry namespace from the drop-down list, and the container image and tag.
33
+
3.**Container Image** select **External**and in **Image URL** set: `scaleway/cli:latest`
202
34
203
35
4. Enter a name or use the automatically generated one.
204
36
205
37
5. Select the region in which your job will be created.
206
38
207
-
6. Keep the default **resources** values, as this job requires little compute capabilities.
39
+
6. Keep default **resources** values, as this job requires little compute capabilities.
208
40
209
-
7. Set the **cron schedule** to `0 2 * * *` and select the relevant time zone to run the job every day at 2:00 a.m. Refer to the [cron schedules documentation](/serverless-jobs/reference-content/cron-schedules/) for more information.
41
+
7. Set **cron schedule** to `0 2 * * *` and select relevant time zone to run the job every day at 2:00 a.m. Refer to the [cron schedules documentation](/serverless-jobs/reference-content/cron-schedules/) for more information.
210
42
211
43
8. Define the following environment variables:
212
-
-`INSTANCE_ID`: the ID of the Instance you want to snapshot
213
-
-`INSTANCE_ZONE`: the [Availabilitiy Zone](/instances/concepts/#availability-zone) of your Instance (e.g. `fr-par-2`)
214
44
-`SCW_ACCESS_KEY`: your API access key
215
45
-`SCW_SECRET_KEY`: your API secret key
46
+
-`SCW_DEFAULT_PROJECT_ID`: your Project ID
216
47
-`SCW_DEFAULT_ORGANIZATION_ID`: your Organization ID
48
+
-`SCW_DEFAULT_REGION`: Concerned region
49
+
50
+
For more details about variables used by `cli` please refer to [cli config documentation](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/config.md).
51
+
52
+
9. In **Execution** tab, define desired command `/scw block snapshot create volume-id=11111111-1111-1111-1111-111111111111` (replace the ID with your desired volume ID).
0 commit comments