Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Many thanks for this article, it helped me getting into cloud-init a lot. Unfortunately I am missing one really important aspect: How can I use cloud-init to perform one of the following scenarios:
Conditions:
Also for security reasons: can you please clarify on the missing PW for the ‘demo’ user? –> ‘root’ is disabled & ‘demo’ created, added to sudo group and no password created at all: How can I secure that ‘demo’ to ensure the only option to login is ssh? –> if it above scenario 2. is possible at all to copy a file to the droplet, would the contents of that file be available as metadata to all users as well? Even if I delete that bootstrap.sh after it was executed?
weird, works well on ubuntu but I can’t get the cloud-config to work on CentOS7 (on AMS2) (and yes: I used service sshd restart to restart ssh daemon on CentOS7).
Any hints are mich appreciated.
using cloud-config on CoreOS, i want to use a different coreos.etcd2.discovery url value.
currently i create a new file in the droplet called cloud-config and run sudo coreos-cloudinit --from-file cloud-config which updates /run/systemd/system/etcd2.service.d/20-cloudinit.conf properly. however, it only applies once, when the droplet reboots, the original (wrong) cloud-config is read in from DO metadata and overwrites the discovery url.
is there a way to change the cloud-config metadata on DO ?
Great overview, after a quick read, I was confident this would be easy. Actually it is not as easy as it seems. Even simple user creation fails. And from log files /var/log/cloud-init.log all that can be seen is that user creation failed …
Is there a way to re-run the script on a newly created droplet? If so, where is the YAML cloud-config file pasted in text-edit on droplet creation located? cloud-init command seems to take some parameters but it’s unclear how to pass a file.
Seems like the workaround is working on a gist and recreating a test server until figured out what went wrong.
I think I’ll need to take some more time to read and learn from examples at: http://cloudinit.readthedocs.org/en/latest/topics/examples.html
I have the same complaint as @erikusaj - I may be a noobie at this, but I followed the basic steps (not including more advanced options) exactly and cannot login as the user I allegedly created. It would be great it you could provide support for this.
Thanks for the informative, well-written tutorial. If possible, would anyone in this thread be able to offer some advice on the following:
At times, after provisioning a droplet, I’ve found it helpful to permanently alter its hostname.
I use an interactive script to change my droplet’s hostname (here’s the GitHub link).
I’d like to accomplish the same task using cloud-config.
I believe that the following should work:
#cloud-config
runcmd:
- newhostn="<%newhostn%>"
- hostn=$(cat /etc/hostname)
- echo "Exisitng hostname is $hostn"
- echo "New hostname will be $newhostn"
- sed -i "s/$hostn/$newhostn/g" /etc/hosts
- sed -i "s/$hostn/$newhostn/g" /etc/hostname
power_state:
mode: reboot
If it does, great. If not, why, and what would I need to do differently?
Lastly, I think there’s an easier way to do this, since hostname is among the harvested metadata:
#cloud-config
hostname:
- hostname: newhostname
but with limited documentation, I’m not sure. Any suggestions? If I can get an answer that works reliably, I’m happy to post it to do_user_scripts on GitHub.
Cheers!
Hello
is it possible to run cloud-init at any time later passing it a YAML file?
thanks
Is this article still correct for Ubuntu 16.04?
I’m asking because I’m even when using the following cloudconfig, my droplet stops accepting ssh request:
#cloud-config
users:
- name: thibault
ssh-authorized-keys:
- ssh-rsa HereGoesMySuperSecretSSHKey
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
packages:
- python
- unzip
- htop
runcmd:
- sed -i -e '/^Port/s/^.*$/Port 4512/' /etc/ssh/sshd_config
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin no/' /etc/ssh/sshd_config
- sed -i -e '$aAllowUsers thibault' /etc/ssh/sshd_config
- service ssh restart
And this is what my console looks like: http://imgur.com/a/5c7u8
Hi,
In the article it says “Any information passed in your cloud-config is accessible to every user on the system. Do not place anything confidential in your cloud-config files.”
However, we’re passing our SSH Keys in the cloud-config file. How is this any safer?
Thank you