Hugo Future Imperfect Slim

Tech Notes


1-Minute Read

  1. Launch any linux vm (Centos, Ubuntu etc) from a iso

  2. Install the cloud init package

RHEL: yum install cloud-init

Ubuntu : apt-get install cloud-init

  1. Configure the cloud init by adding the cloudstack datasource package

vi /etc/cloud/cloud.cfg.d/99_cloudstack.cfg

datasource_list: [ CloudStack, None ]

  1. Create a template of the disk

  2. Launch a vm based on the template created and pass the userdata parameter

deploy virtualmachine serviceofferingid=720d1320-06d7-4918-9f2a-ef5ba7e07bf3 templateid=0d9bf1f4-288d-4510-b2c5-8e980c51c98d zoneid=10a26e0d-2085-4b09-bd0f-c726a6bd9443 networkids=cf8fcdb8-741c-4f98-b856-adc4fd99c157 userdata=I2Nsb3VkLWNvbmZpZwpydW5jbWQ6CiAgLSBta2RpciAvcnVuL2tpcmFuCiAgLSBlY2hvIGtpcmFuIHNheXMgaGkgPj4gL3J1bi9raXJhbi9zYW1wbGUudHh0CiAgLSBbIHNoLCAteGMsICAvcm9vdC9zdXJlZWRnZV9zZXJ2ZXJfdXRpbGl0eV9pbnN0YWxsZXIuc2ggLS10b2tlbiAxNDY2Q0IxNTc3NzdCQjcyIF0=

Note: Make sure the userdata is encoded in base64 format if calling from Api , if you are passing the userdata from UI , there is no need to encode it

For example the following data is encoded

#cloud-config runcmd:

  • mkdir /run/kiran
  • echo kiran says hi » /run/kiran/sample.txt
  • [ /root/ –token 1466CB157777BB72 ]


  1. To trouble shoot the logs

tailf /var/log/cloud-init.log

cat /var/run/cloud-init/result.json

The runcmd is stored at

cat /var/lib/cloud/instance/scripts/runcmd

In summary, CloudInit takes the user data passed to the vm and executes the instructions at boot time


comments powered by Disqus

Recent Posts




I am a Software Engineer at Persistent Systems, working on Cloud Stack Orchestration and various tech related to Cloud Infra, container technology like Docker, Kubernetes