Skip to main content

User Data

When provisioning a server on Equinix Metal™ you have the option to include User Data, which can be used to perform various automation tasks after the server is ready, such as executing common scripts, installing packages, or triggering other more advanced configuration processes.

Usage

Equinix Metal user data is based on open-source project cloudbase-init and officially supports two user data formats.

User Data Scripts

Scripts are for executing shell scripts and begin with #! for Linux shell or #ps1 for Windows Powershell.

#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y
apt-get install nginx -y

Cloud Config Data

Cloud Config data must use valid yaml syntax and begins with #cloud-config

#cloud-config
package_upgrade: true
packages:
- nginx
info

Support for formats other than #!<script> and #cloud-config are experimental.

Provisioning with User Data

When provisioning a server from the Metal console, add User Data by expanding the Optional Settings > User data tab.

Example User Data Field when Provisioning

Paste your script into the field. Click Deploy Now. The script is read and executed during the server provisioning process.

note

Depending on the length of your script, allow some time for the server provisioning process to execute after you see the server as "Active."

Managing User Data

A server's user data is available in the server's Settings tab, under User Data.

Example User Data field for a Server

info

You can also access the user data from the server from its metadata endpoint. SSH into the server and send a request to https://metadata.platformequinix.com/userdata.

Verifying User Data on the Server

To verify the user data stored on your server, check for it at /var/lib/cloud/instance/user-data.txt.

The server logs for user data are available at /var/log/cloud-init.log and /var/log/cloud-init-output.log

Adding User Data Post-Provisioning

During provisioning, user data is executed on a server's first bootup. You can add user data to an already provisioned server, but you must reinstall the server first to execute the new user data.

warning

Reinstalling is a disruptive operation and has options that include deleting data. Proceed with caution.

Update the user data field in the server's Settings tab, under User Data.

Example User Data field for a Server

Click Save. The new user data will be written to the server and appear in the server's metadata immediately, but will not be executed until you preform a server Reinstall.