Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions api-reference/endpoint/create-compute.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ Use these slugs for the `region`, `image`, and `specification` fields in your re

---

### User Data

Pass your own [cloud-init](https://cloudinit.readthedocs.io/) configuration in `userData` to set up the instance on its first boot: install packages, write files, create users or run a script. Send a `#cloud-config` file or a shell script starting with `#!`. It works with every image.

- Encode it as standard base64, on one line.
- It can be at most 32 KiB after decoding.
- It's optional. Leave it out and the instance is created as usual.

```bash
USER_DATA=$(printf '#cloud-config\npackages:\n - nginx\n' | base64 | tr -d '\n')

curl -X POST https://api.strettch.cloud/api/v1/computes \
-H "Authorization: Bearer $STRETTCH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"hostName": "web-01",
"image": "UBUNTU-24.04",
"region": "KGL-1",
"specification": "S-1C-1G",
"publicKeys": ["ssh-ed25519 AAAA... you@laptop"],
"userData": "'"$USER_DATA"'"
}'
```

<Note>
The instance receives the data exactly as you sent it. Where your cloud-config and Strettch Cloud's defaults set the same key, your value wins.
</Note>

---

### Response Error Codes

If the request fails, the `code` field in the error response will contain one of the following.
Expand Down
6 changes: 6 additions & 0 deletions api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,12 @@
"web"
]
},
"userData": {
"description": "Optional cloud-init user data: a #cloud-config file or a shell script starting with #!, base64 encoded, at most 32 KiB after decoding. The instance receives it unchanged on its first boot.",
"type": "string",
"contentEncoding": "base64",
"example": "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg=="
},
"withPublicIp": {
"type": "boolean",
"example": true
Expand Down
1 change: 1 addition & 0 deletions skills/strettch-cloud/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Body:
| `publicKeys` | string[] | Yes (min 1) | SSH public keys for access |
| `withPublicIp` | boolean | No | Allocate a public IP address |
| `tags` | string[] | No | Labels for the instance |
| `userData` | string (base64) | No | cloud-init user data (`#cloud-config` or a `#!` script), at most 32 KiB decoded |

### Upsize Compute Request (PATCH /computes/{id}/upsize)

Expand Down
Loading