Events and updates#
Cloud-init will fetch and apply cloud and user data configuration
upon several event types. The two most common events for
are when an instance first boots and any subsequent boot thereafter (reboot).
In addition to boot events,
cloud-init users and vendors are interested
in when devices are added.
Cloud-init currently supports the following
BOOT_NEW_INSTANCE: New instance first boot.
BOOT: Any system boot other than
BOOT_LEGACY: Similar to
BOOT, but applies networking config twice each boot: once during the Local stage, then again in the Network stage. As this behaviour was previously the default behaviour, this option exists to prevent regressing such behaviour.
HOTPLUG: Dynamic add of a system device.
Future work will likely include infrastructure and support for the following events:
METADATA_CHANGE: An instance’s metadata has changed.
USER_REQUEST: Directed request to update.
Datasource event support#
All datasources support the
by default. Each datasource will declare a set of these events that it is
capable of handling. Datasources may not support all event types. In some
cases a system may be configured to allow a particular event but may be
running on a platform whose datasource cannot support the event.
Configuring event updates#
Update configuration may be specified via user data, which can be used to enable or disable handling of specific events. This configuration will be honored as long as the events are supported by the datasource. However, configuration will always be applied at first boot, regardless of the user data specified.
Update policy configuration defines which events are allowed to be handled. This is separate from whether a particular platform or datasource has the capability for such events.
scope: <name of the
scopefor event policy>
scopevalue is a string which defines which domain the event occurs under. Currently, the only known
network, though more
scopesmay be added in the future.
Scopesare defined by convention but arbitrary values can be used.
when: <list of events to handle for a particular
whenelement to specify which events are to allowed to be handled.
hotplug event is supported by the datasource and configured in
cloud-init will respond to the addition or removal of network
interfaces to the system. In addition to fetching and updating the system
cloud-init will also bring up/down the newly added interface.
Due to its use of
hotplug functionality is
currently incompatible with SELinux. This issue is being tracked
on Launchpad. Additionally,
hotplug support is considered
experimental for non-Debian-based systems.
Apply network config every boot#
On every boot, apply network configuration found in the datasource.
# apply network config on every boot updates: network: when: ['boot']