|
| 1 | +--- |
| 2 | +title: How to execute complex commands using Serverless Jobs |
| 3 | +description: Learn how to run complex commands and scripts using Scaleway Serverless Jobs and Secrets Manager. |
| 4 | +tags: run execute start serverless job scaleway script startup secret bash complex command pipe |
| 5 | +dates: |
| 6 | + validation: 2025-08-19 |
| 7 | + posted: 2025-08-19 |
| 8 | +--- |
| 9 | +import Requirements from '@macros/iam/requirements.mdx' |
| 10 | + |
| 11 | +Scaleway Serverless Jobs allows you to execute specific startup commands when running a job. Due to technical specifications, complex commands (e.g. piped commands, `xargs` commands) may fail occasionally, preventing jobs from running successfully. |
| 12 | + |
| 13 | +You can bypass this limitation by passing complex commands and scripts to a Serverless Job via a [secret reference](/serverless-jobs/concepts/#secrets-reference). You can then inject this secret as a file in your job, and call it at startup to execute the commands it contains. |
| 14 | + |
| 15 | +<Requirements /> |
| 16 | + |
| 17 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 18 | +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 19 | +- created a [Serverless Job](/serverless-jobs/how-to/create-job/) |
| 20 | + |
| 21 | +## How to create a secret containing your command |
| 22 | + |
| 23 | +1. Click **Secret Manager** in the **Security & Identity** section of the [Scaleway console](https://console.scaleway.com/) side menu. |
| 24 | + |
| 25 | +2. In the **Region** drop-down, select the [region](/secret-manager/concepts/#region) in which you want to store your secret. Secrets cannot be moved from one region to another after creation. |
| 26 | + |
| 27 | +3. Click **+ Create secret**. |
| 28 | + |
| 29 | +4. Select **Import secret**, choose the **Opaque** secret type, then drag and drop your file to the dedicated area. The maximum file size for your secret is 64 KiB. |
| 30 | + |
| 31 | +5. Choose the **Scaleway-managed encryption key**, as it requires no configuration on your side. |
| 32 | + |
| 33 | +6. Choose a [path](/secret-manager/concepts/#path) for your secret. |
| 34 | + |
| 35 | +7. Enter a name for your secret, and, optionally, add a description and tags. |
| 36 | + |
| 37 | +8. Click **Create secret** to confirm. |
| 38 | + |
| 39 | +Your file can now be passed to your Serverless Job as a secret reference. |
| 40 | + |
| 41 | +## |
0 commit comments