Prepare a cloud-init Userdata File

Use the following information to prepare your cloud-init userdata file. The userdata file is optional for cloud-init.

  • The userdata file is a plain-text file in raw cloud-init format, without compression or base64 encoding.
  • The maximum file size is 512KB.
  • Userdata configuration can be used to accomplish a number of configuration tasks in the guest operating system. For instance, some of the more common tasks include:
    • Add user accounts
    • Install software
    • Run scripts
    • Import SSH keys
This example shows a userdata file that adds a new user to the guest operating system:
#cloud-config

users:
  - default
  - name: testuser
    primary_group: testgroup
    sudo: ALL=[ALL] NOPASSWD:ALL
    groups: sudo, wheel
    ssh_import_id: None
    lock_passwd: true
    ssh_authorized_keys:
    - ssh-rsa myRsaPubKey