YAML (YAML Ain't Markup Language) is a human-readable data serialization language designed for configuration files and data exchange between programming languages. Originally released in 2001, YAML has become the de facto standard for infrastructure-as-code tools like Kubernetes, Ansible, Docker Compose, and CI/CD pipelines, where its clean syntax and readability make complex configurations manageable. YAML's power lies in its indentation-based structure, which eliminates the visual noise of brackets and braces while supporting rich data types including mappings (dictionaries), sequences (lists), and scalars (strings, numbers, booleans). However, this apparent simplicity conceals significant complexity: implicit type coercion can lead to unexpected parsing (the infamous "Norway problem" where NO becomes false), and subtle indentation errors can silently produce incorrect data structures rather than syntax errors.
What This Cheat Sheet Covers
This topic spans 12 focused tables and 101 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Fundamental Syntax Rules
| Rule | Example | Description |
|---|---|---|
name: value | • Three dashes denote the beginning of a YAML document • optional for single documents but required when multiple documents exist in one stream | |
data: value... | • Three dots indicate document termination without starting a new one • primarily used in streaming contexts or when explicitly separating documents | |
parent: child: value another: data | • Spaces only (tabs forbidden) define structure and nesting • the number of spaces doesn't matter but must be consistent within the same level | |
key: value # inline comment# full line comment | • Hash symbol # starts a comment• everything after it on the line is ignored by parsers and serves only human documentation purposes |