From 13c526337a03d0bd8b328aadb3ef62f6cce1853e Mon Sep 17 00:00:00 2001 From: "Arnaud M." Date: Sat, 3 Jan 2026 00:03:13 +0100 Subject: [PATCH] Add userdata Signed-off-by: Arnaud M. --- cloud/training/101.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/cloud/training/101.md b/cloud/training/101.md index d39ca33..1e12ce2 100644 --- a/cloud/training/101.md +++ b/cloud/training/101.md @@ -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.