cloud-init

Cloud-init is supported by some of the pre-built linux images. Cloud-init simplifies the process of the instance initialization after the instance is launched.

Overview

Cloud-init enabless instance configuration in two ways.

Configuration by cloud-config

The following file is an example of basic cloud-config file setting hostname of the instance to “newUltiCloudInstance” and upgrading yum (apt) repository.

#cloud-config
hostname: newUltiCloudInstance
package_upgrade: true

Configuration by script

The script below will enable SSH password authentication (by default the only enabled way is a keypair authentication) and then it will create user with password as specified.

#!/bin/bash
# SSH password connection -> ON
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

# Restart SSH
service restart sshd

# New guy
useradd UltiCloudUser

# New guy password: 'Sdr1ga6739'
echo Sdr1ga6739 | passwd UltiCloudUser --stdin

Last modified: 0001-01-01