Skip to content
uencoder

YAML Aliases

A YAML alias references an already-defined anchor node with *name, letting multiple places share one node instance.

Purpose

To reference anchor-defined nodes in YAML, achieving shared references instead of copies.

Mechanism

*alias resolves to the node marked with the matching &anchor. An alias is a shared reference: mutating the referenced node (when mutable) affects every alias site. YAML 1.2 removed anchors but most implementations still support them.

Use cases

  • Sharing configuration nodes
  • YAML DRY
  • Matrix definition reuse

Related tools

References