1
0
Fork 0

Add userdata

Signed-off-by: Arnaud M. <arnaud.choupinette@mailops.fr>
This commit is contained in:
Arnaud M. 2026-01-03 00:03:13 +01:00
parent 27cbed1241
commit 13c526337a
1 changed files with 28 additions and 5 deletions

View File

@ -13,6 +13,7 @@
* [Boot](#boot-1)
* [Floating IP](#floating-ip)
* [Connect with ssh](#connect-with-ssh-1)
* [Userdata](#userdata)
* [Bonus](#bonus)
@ -292,11 +293,33 @@ ssh debian@xxx.yyy.zzz.aaa # floating ip
Q: what IP can you see on ens3 interface of the instance?
## Userdata
### Create a script
Create a file named `postinstall.sh` with this content:
```
#!/bin/bash
echo "Hello from my instance" > /var/log/postinstall.log
```
### Start an instance
Figure out the command to start a new instance with this script as `user-data`.
Don't forget to start with your `keypair` so you can connect to it later
### Check the result
When the instance is booted, ssh into it and check the result of the file:
```
cat /var/log/postinstall.log
```
## demo-flask
Try to deploy `demo-flask` with a custom `user-data` script.
## Bonus
Try to deploy `demo-flask` with cloud-init
## Bonus 2
Take a look at the [skyline WebUI](http://skyline.54.36.119.253.xip.opensteak.fr) and try to boot another instance from there.