Linux Cloud Init

From Ever changing code

Cloud Init is multi-distribution package that handles early initialization of a cloud instance. Comes installed in the Ubuntu Cloud Images and images available on EC2, Azure, GCE, etc. Have following use cases:

  • Setting a default locale
  • Setting an instance hostname
  • Generating instance SSH private keys
  • Adding SSH keys to a user’s .ssh/authorized_keys
  • Setting up ephemeral mount points
  • Configuring network devices

Command line

cloud-init init     #Initializes cloud-init and performs initial modules
cloud-init single   #Runs a single module
cloud-init modules  #Activates modules using a given configuration key
cloud-init features #Lists defined features
cloud-init clean    #Removes logs and artifacts so cloud-init can re-run
cloud-init status   #Reports cloud-init status or wait on completion
cloud-init analyze  #Analyzes cloud-init logs and data
cloud-init devel    #Runs development tools
cloud-init collect-logs  #Collects and tar all cloud-init debug info
cloud-init dhclient-hook #Runs the dhclient hook to record network info