User-data script

Example

#!/bin/sh
echo "Hello World" > /var/tmp/output.txt

Explanation

A user-data script is a single script to be executed once per instance. User-data scripts are run relatively late in the boot process, during cloud-init’s final stage as part of the cc_scripts_user module.

Warning

Use of INSTANCE_ID variable within user-data scripts is deprecated. Use jinja templates with v1.instance_id instead.