Jinja template

Example cloud-config

## template: jinja
#cloud-config
runcmd:
  - echo 'Running on {{ v1.cloud_name }}' > /var/tmp/cloud_name

Example user-data script

## template: jinja
#!/bin/sh
echo 'Current instance id: {{ v1.instance_id }}' > /var/tmp/instance_id

Explanation

Jinja templates may be used for cloud-config and user-data scripts. Any instance-data variables may be used as jinja template variables. Any jinja templated configuration must contain the original header along with the new jinja header above it.

Note

Use of Jinja templates is supported for cloud-config, user-data scripts, and cloud-boothooks. Jinja templates are not supported for meta configs.