Introduction
YAML is one of the most widely used configuration and data serialization formats across modern cloud engineering, DevOps, automation, and CI/CD environments.
From GitHub Actions workflows to Kubernetes manifests and infrastructure configuration, YAML provides a human-readable way to represent structured data while remaining easy for machines to process.
The YAML Learning Lab is a practical technical repository focused on YAML syntax, structured data representation, configuration patterns, validation, and its application within modern DevOps workflows.
đź”— GitHub Repository: YAML Learning Lab
A Brief History of YAML
YAML was created in 2001 by Clark Evans, Ingy döt Net, and Oren Ben-Kiki as a human-friendly data serialization language.
The name YAML originally stood for "Yet Another Markup Language." It was later reinterpreted as "YAML Ain't Markup Language", emphasizing that YAML is a data serialization language, rather than a markup language.
This distinction is important.
Markup languages such as HTML are primarily concerned with describing the structure and presentation of documents, while YAML focuses on representing structured information and configuration in a format that is readable by both humans and machines.
Today, YAML is widely used in:
- Cloud configuration
- CI/CD pipelines
- Kubernetes
- Infrastructure as Code
- Application configuration
- Automation
- DevOps tooling
Project Overview
The repository brings together practical YAML examples covering:
- Key-value pairs
- Mappings
- Nested structures
- Sequences
- Lists of objects
- Data types
- Comments
- Quoted strings
- Multiline strings
- Anchors and aliases
- Merge keys
- Multi-document YAML
- GitHub Actions workflows
- YAML validation with Python and PyYAML
The project demonstrates how YAML syntax translates into structured configuration used by modern engineering tools.
Project Setup
The project was organized as a Git repository with individual YAML files representing different concepts.
The repository structure keeps each concept isolated while also providing a final configuration challenge that combines multiple YAML features.
YAML Fundamentals
The first examples introduce YAML's basic key-value structure.
name: Raphael
role: Cloud Engineer
country: Nigeria
A YAML mapping associates each key with a value:
| Key | Value |
|---|---|
name |
Raphael |
role |
Cloud Engineer |
country |
Nigeria |
This simple structure is the foundation for more complex YAML configurations.
Mappings and Nested Structures
YAML uses indentation to represent relationships between data elements.
For example:
person:
name: Raphael
role: Cloud Engineer
Here, name and role are properties nested under person.
Nested structures allow configuration to represent relationships between related pieces of information without requiring complex syntax.
Nested mappings extend this idea by allowing multiple levels of configuration:
person:
name: Raphael
age: 30
country: Nigeria
One important YAML rule becomes obvious here:
Indentation defines structure.
YAML configuration should use spaces for indentation rather than tabs.
Sequences
YAML sequences represent ordered collections.
They are identified using a hyphen (-):
skills:
- Azure
- Docker
- Kubernetes
- Git
This creates a list of four values under the skills key.
Sequences are common in configuration files for representing:
- Packages
- Ports
- Hosts
- Skills
- Resources
- Configuration options
Lists of Objects
YAML sequences can contain mappings, making it possible to represent collections of structured objects.
employees:
- name: Raphael
role: Cloud Engineer
- name: Sarah
role: DevOps Engineer
- name: David
role: Solution Architect
Each list item contains multiple properties.
This pattern is particularly useful when configuration describes multiple resources that share a common structure.
YAML Data Types
YAML supports several common data types.
person:
name: Raphael
age: 30
salary: 4500.50
active: true
verified: false
phone: null
These values represent different data types:
| Value | Type |
|---|---|
Raphael |
String |
30 |
Integer |
4500.50 |
Floating-point number |
true |
Boolean |
false |
Boolean |
null |
Null |
Understanding how YAML interprets values is important when configuration is consumed by automation tools or programming languages.
Comments and Quoted Strings
Comments begin with # and are ignored by YAML parsers.
# Employee Information Configuration
city: Lagos
Comments are useful for documenting configuration and explaining why a particular value or section exists.
YAML also supports quoted strings:
message: "Welcome: Cloud Engineers!"
Quoting can make the intended value explicit, particularly when a value contains characters that could otherwise be interpreted specially.
Multiline Strings
YAML provides block scalar syntax for storing multiline text.
There are two important styles:
-
|— literal block -
>— folded block
Literal Block
The | character preserves line breaks.
bio_literal: |
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.
Folded Block
The > character folds consecutive lines into a paragraph-like value.
bio_folded: >
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.
The difference matters when YAML is being used to store scripts, documentation, certificates, configuration blocks, or other multiline content.
Anchors, Aliases, and Merge Keys
YAML provides anchors and aliases for reusing configuration without repeatedly defining the same values.
An anchor is created using &:
defaults: &default
country: Nigeria
role: Student
The configuration can then be reused using an alias:
student1:
<<: *default
name: Raphael
The << merge key incorporates the values from the anchored mapping.
Another object can reuse the same configuration:
student2:
<<: *default
name: Sarah
This approach reduces duplication and makes shared configuration easier to maintain.
Multi-Document YAML
A YAML file can contain multiple independent documents.
The document separator is:
---
For example:
student1:
name: Raphael
---
name: Third Document Stream
The separator marks the beginning of another YAML document.
This becomes important during validation because a file containing multiple documents must be parsed accordingly.
The repository demonstrates this concept in anchors.yaml.
YAML in GitHub Actions
YAML is heavily used in CI/CD systems.
The repository includes a GitHub Actions workflow:
name: Build Project
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Building project..."
The workflow demonstrates several important GitHub Actions concepts.
Workflow Name
name: Build Project
Defines the workflow's name.
Trigger
on:
push:
Specifies that the workflow runs when changes are pushed to the repository.
Job
jobs:
build:
Defines a job named build.
Runner
runs-on: ubuntu-latest
Specifies the GitHub-hosted runner that executes the job.
Steps
steps:
- uses: actions/checkout@v4
- run: echo "Building project..."
The first step checks out the repository contents.
The second executes a shell command.
Final Configuration Challenge
The student-profile.yaml configuration combines several YAML concepts into one structured document.
It includes:
- Mappings
- Nested mappings
- Sequences
- Strings
- Integers
- Floating-point numbers
- Booleans
- Multiline strings
- Folded strings
- Anchors
- Aliases
- Merge keys
The shared configuration begins with an anchor:
default_profile: &default
role: Student
country: Nigeria
active: true
score: 95.5
The configuration is then reused:
user1:
<<: *default
name: Sarah
user2:
<<: *default
name: David
The file also contains sequences:
skills:
- Azure
- Docker
- Kubernetes
hobbies:
- Coding
- Reading
Nested mappings:
address:
street: 12 Cloud Way
city: Abuja
country: Nigeria
And both multiline string styles:
bio_literal: |
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.
bio_folded: >
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.
This configuration demonstrates how multiple YAML structures can be combined to represent realistic configuration data.
YAML Validation
Configuration should be validated before being used by automation systems.
This repository uses Python, PyYAML, and Linux command-line tools to validate the YAML files.
Validate All YAML Documents
python3 -c 'import yaml, glob; [list(yaml.safe_load_all(open(f))) for f in glob.glob("*.yaml")]; print("All YAML files valid!")'
This command:
- Starts Python 3 using
python3. - Uses
-cto execute Python code directly from the command line. - Imports the PyYAML library with
import yaml. - Imports Python's
globmodule withimport glob. - Uses
glob.glob("*.yaml")to find every.yamlfile in the current directory. - Uses
open(f)to open each YAML file. - Uses
yaml.safe_load_all()to parse all YAML documents within each file. - Uses
list()to force all documents to be parsed. - Uses a list comprehension to apply the validation to every YAML file.
- Uses
print()to display a success message after all files are parsed successfully.
The use of safe_load_all() is important because anchors.yaml contains multiple YAML documents separated by ---.
Check for Illegal Tab Characters
YAML indentation should use spaces rather than tabs.
The repository also checks for tab characters:
grep -n $'\t' *.yaml || echo 'No illegal tab characters found!'
Breaking down the command:
| Part | Meaning |
|---|---|
grep |
Searches files for a specified pattern. |
-n |
Displays the line number where a match is found. |
$'\t' |
Represents a tab character in Bash. |
*.yaml |
Targets all .yaml files in the current directory. |
| ` | |
{% raw %}echo
|
Prints text to the terminal. |
If no tabs are detected, the command prints:
No illegal tab characters found!
These checks provide basic validation for both YAML syntax and indentation consistency.
Git and Repository Management
The project was maintained using Git and published to GitHub.
Git was used to track changes, create commits, maintain the main branch, and synchronize the repository with GitHub.
The final repository includes:
yaml-learning-lab/
├── docs/
│ └── lessons.md
├── screenshots/
├── README.md
├── anchors.yaml
├── lesson1.yaml
├── lesson2.yaml
├── lesson3.yaml
├── lesson4.yaml
├── lesson5.yaml
├── lesson6.yaml
├── lesson7.yaml
├── multiline.yaml
├── student-profile.yaml
└── workflow.yaml
The complete implementation, documentation, YAML files, and supporting evidence are available in the repository:
View the SKILL.SCH YAML Learning Lab on GitHub
Why YAML Matters in Cloud and DevOps
YAML is more than a configuration format. It is an important component of modern engineering workflows.
The concepts demonstrated in this repository appear in technologies such as:
- GitHub Actions
- Kubernetes
- Docker Compose
- Ansible
- Azure DevOps
- Infrastructure as Code tools
- Application configuration systems
- Cloud automation platforms
The same fundamental ideas—mappings, sequences, nesting, data types, multiline values, and reusable configuration—appear repeatedly across these technologies.
Understanding YAML therefore makes it easier to read, write, troubleshoot, and maintain configuration-driven systems.
Key Takeaways
The YAML Learning Lab demonstrates how YAML progresses from simple key-value pairs to structured configuration used in real-world DevOps environments.
The repository covers:
- YAML syntax and structure
- Mappings and nested mappings
- Sequences and lists of objects
- Data types
- Comments and quoted strings
- Literal and folded multiline strings
- Anchors, aliases, and merge keys
- Multi-document YAML streams
- GitHub Actions workflow configuration
- YAML validation using Python and PyYAML
- Git-based project management
The project also demonstrates an important engineering principle:
Configuration should be readable, structured, reusable, and validated before it becomes part of an automation workflow.
Summary
The YAML Learning Lab provides a practical technical reference for YAML and its role in cloud engineering and DevOps.
From basic mappings and sequences to anchors, multiline strings, GitHub Actions, and automated validation, the repository brings together core YAML patterns required for working with configuration-driven tooling.
More importantly, the project demonstrates YAML in context—not simply as a file format, but as a foundational component of modern cloud, DevOps, automation, and CI/CD workflows.
For the complete implementation, configuration files, technical documentation, and supporting evidence:
🔗 YAML Learning Lab — GitHub Repository
Author
Rahimah Sulayman
Cloud & DevOps Engineer | Data Analyst














Top comments (2)
YAML looks simple, but indentation is doing a lot of work behind the scenes. This lab is a great reminder that small syntax details can have a big impact in automation and DevOps workflows.
What I particularly like about YAML is how quickly simple key-value pairs can evolve into real-world configurations for CI/CD, Kubernetes, and cloud automation. Great practical reference!