Skip to content

Create Advanced Instance (Cloud-Native)

This document guides you through creating "cloud-native" instances using Ephemeral storage and Cloud-Init for bootstrapping. This approach is ideal for stateless applications, auto-scaling groups, and immutable infrastructure patterns.

Prerequisites

  • Access to your Horizon dashboard.
  • A project with sufficient quota.
  • A key pair for SSH access.
  • (Optional) A prepared cloud-init script.

Concept: Ephemeral vs Persistent Storage

  • Ephemeral (Local Disk): The instance boots directly from the image onto the hypervisor's local disk. If the instance is terminated, all data is lost. This is faster to provision and ideal for stateless workloads where data is stored externally (databases, object storage).
  • Persistent (Boot from Volume): The instance boots from a networked Cinder volume. If the instance is terminated, the volume can persist (if configured), and data is safe. This is more like a traditional server and is the default for "Basic" instances.

Steps

Sign in to Horizon

  1. Navigate to the Compute Control Panel.

    🌐Open Horizon
  2. Sign in to your project.

Open the Launch Instance wizard

  1. Go to Compute > Instances.
  2. Click Launch Instance.

Configure the instance

Source (Storage)

To create a cloud-native, ephemeral instance:

  • Select Boot Source: Image
  • Create New Volume: No
  • Select an Image: Choose your desired OS (e.g., Ubuntu, Rocky).

Note: If you specifically need a Persistent volume but want to use Cloud-Init, you can set "Create New Volume" to Yes here. The Cloud-Init steps below apply to both.

Flavor

  • Select a flavor. Ensure the flavor has enough Root Disk defined, as ephemeral instances rely on the flavor's disk size.

Networks & Security Groups

  • Select your Network.
  • Select Security Groups (ensure SSH is allowed).

Key Pair

  • Select your existing Key Pair.

Configuration (Cloud-Init)

This is where the magic happens. You can provide a script to configure the instance upon first boot.

Paste your script into the "Customization Script" (User Data) field.

Example 1: Set Default User Password

If you need password auth (not recommended for production, but useful for testing):

yaml
#cloud-config
password: mysecretpassword
chpasswd: { expire: False }
ssh_pwauth: True
Example 2: Install Packages on Boot

Update apt and install Nginx:

yaml
#cloud-config
package_upgrade: true
packages:
  - nginx
Example 3: Run Arbitrary Commands

Create a file and restart a service:

yaml
#cloud-config
runcmd:
  - echo "Hello World" > /etc/motd
  - systemctl restart nginx

Launch

Click Launch Instance.

Connecting

Connect as usual using your Key Pair (or the password if you configured it via Cloud-Init).

bash
ssh -i key.pem ubuntu@<IP>