If you were to reboot the instance a few days later, you would see this: sudo cat /root/joyoutput.txt Provision the instance: sdc-createmachine -dataset 46407334-9096-40ef-bb72-6f9a094f0507 \Īfter provisioning, check the output: sudo cat /root/joyoutput.txt The time is now $(date -R)!" | tee /root/joyoutput.txt In this example, the script userscript.sh will run when the instance is provisioned as well as on every reboot. The user script can be provided as the name of a file to the -script option to sdc-createmachine, or as the value of the user-script metadata key. Ii apache2-data 2.4.6-2ubuntu2.1 all Apache HTTP Server (common files) Joyent user-script exampleĪny script provided as a user script, will run every time the instance boots. Ii apache2-bin 2.4.6-2ubuntu2.1 amd64 Apache HTTP Server (binary files and modules) Ii apache2 2.4.6-2ubuntu2.1 amd64 Apache HTTP Server metadata-file cloud-init:user-data=./cloud.initĪfter provisioning, you can check that the apache2 packages were installed: $ dpkg -l | grep apache To provision an Ubuntu instance, you would use the sdc-createmachine command like this, using the name of the config file. In this example, cloud.init is a cloud-init config file that:
Ubuntu 14.04.2 root access how to#
The time is now Fri, 23:15:13 +0000! cloud-init with a cloud-config commandĬloud-init can also take a YAML file that describes how to configure the instance. metadata-file cloud-init:user-data=./Īfter the instance is provisioned, you can log in to it and verify that the script ran: $ sudo cat /root/output.txt To provision an Ubuntu instance, you would use the sdc-createmachine command like this. The time is now $(date -R)!" | tee /root/output.txt It should be in the same directory that you run the sdc-createmachine in. does nothing more than to write a message with the current time in /root/output.txt. In this example, the shell script will run on first boot. cloud-init with a shell scriptĪnything in the cloud-init:user-data, runs once per instance on the first boot. To run these examples, make sure that you are using at least version 7.2.0 of the CloudAPI tools. These examples use the (Working with CloudAPI.html). You can learn more information about cloud-init here and in the cloud-int documentation.
cloud-init examplesĬloud-init is the Ubuntu package that handles first-boot initialization of a cloud instance. Complex cloud-init or user-script scripts could take several minutes to complete. Keep in mind that you may be able to log in to your instance before cloud-init is finished. cloud-init:user-data is consumed once per instance.Joyent boot-time data is supplied as metadata with the user-data and user-script keys. You can provide this metadata CLI command option -metadata-file (or -script for Joyent images).Ĭloud-init data is provided as metadata with the cloud-init:user-data key. Initialization data (like cloud-init) is provided as metadata when the instance is created. The certified images can use both cloud-init and Joyent boot-time setup.
dev/vdb 33G 177M 31G 1% /mnt Boot-time setup $ df -hįilesystem Size Used Avail Use% Mounted on The following output of the df command shows the default file system in a Certified Image. In Joyent-supplied images, the ephemeral device is mounted at /data. In certified images, the ephemeral device (data disk) is mounted at /mnt. However, the ubuntu user is authorized to use sudo to do things as root. In certified images, the default user is ubuntu. This section describes some basic differences between the Certified Images and the legacy Joyent-supplied Ubuntu images. The goal of the Ubuntu Certified Images is to work the same way regardless of the cloud infrastructure hosting them. The summary of differences section summarizes those differences. Joyent-supplied Ubuntu images prior to these Certified Images have some basic differences. To learn how to configure Juju to work with the Joyent Cloud, see Configuring for Joyent Cloud in the Juju documentation You can use Juju to deploy your web applications on Joyent-hosted Ubuntu instances. Joyent Cloud boot script user-script metadata is also available to do per-boot scripting. The Certified Images support cloud-init to provide a uniform boot-time setup. The Ubuntu Certified Images are designed by Canonical to be optimized for various cloud infrastructures, including the Joyent Cloud.