The YAML Learning Lab is a hands-on project that demonstrates the fundamentals of YAML through practical exercises. It covers key concepts such as key-value pairs, lists, nested structures, data types, comments, multi-line text, anchors, aliases, and GitHub Actions workflows. This project also demonstrates the use of Git for version control and serves as a practical portfolio of YAML skills used in Cloud and DevOps.
mkdir -p yaml-learning-lab && cd yaml-learning-labConcept: Shows how YAML stores simple information using key-value pairs.
cat > lesson1.yaml << 'EOF'
name: Samuel
role: Cloud Engineer
country: Nigeria
EOFRun:
cat lesson1.yamlname: samuel
role: Cloud Engineer
country: NigeriaConcept: Introduces YAML nesting by grouping related information under a parent key.
cat > lesson2.yaml << 'EOF'
person:
name: Samuel
role: Cloud Engineer
EOFRun:
cat lesson2.yamlperson:
name: Samuel
role: Cloud Engineerpersonis the parent key.nameandroleare nested keys underperson.- YAML uses spacing to show relationships between data.
Concept: Demonstrates how YAML groups multiple related properties under a single parent key.
cat > lesson3.yaml << 'EOF'
person:
name: Samuel
age: infant
country: Nigeria
EOFRun:
cat lesson3.yamlperson:
name: Samuel
age: infant
country: Nigeriapersonis the parent key.name,age, andcountryare child keys grouped underperson.- The spacing shows that these properties all belong to the
personsection. - This structure is commonly used in configuration files to organize related data.
The screenshot below shows the successful verification of the first three YAML lessons using the cat command in the VS Code terminal.
Concept: Shows how YAML stores multiple values in a list using hyphens (-).
cat > lesson4.yaml << 'EOF'
skills:
- Azure
- Docker
- Kubernetes
- Git
EOFRun:
cat lesson4.yamlskills:
- Azure
- Docker
- Kubernetes
- Gitskillsis the main key.- Each item starting with
-is a list item. - YAML uses hyphens (
-) to represent multiple values under the same key. - Lists are commonly used to store items such as skills, tools, services, or servers.
Concept: Demonstrates how YAML stores multiple grouped records inside a single list.
cat > lesson5.yaml << 'EOF'
employees:
- name: Samuel
role: Cloud Engineer
- name: Grace
role: DevOps Engineer
- name: Daniel
role: Solution Architect
EOFRun:
cat lesson5.yamlemployees:
- name: Samuel
role: Cloud Engineer
- name: Grace
role: DevOps Engineer
- name: Daniel
role: Solution Architectemployeesis the main key.- Each
-starts a new employee record. - Every employee has two related pieces of information:
nameandrole. - This format is useful when storing information about multiple people, servers, or applications in a single YAML file.
Verification of Lessons 4 and 5 in the VS Code Terminal
Concept: Demonstrates how YAML stores different types of data in a single configuration file.
cat > lesson6.yaml << 'EOF'
person:
name: Samuel
age: infant
salary:30,000000
active: true
verified: false
phone: null
address:
city: Port-harcourt
country: Nigeria
EOFRun:
cat lesson6.yamlperson:
name: Samuel
age: infant
salary:30,000000
active: true
verified: false
phone: null
address:
city: Port-harcourt
country: Nigeria- YAML supports different data types, making it useful for application and cloud configuration files.
Concept: Demonstrates how YAML uses comments to add notes and quotation marks to preserve text exactly as written.
cat > lesson7.yaml << 'EOF'
# Employee Information Configuration
city: Port harcourt
message: "Welcome: Cloud Engineers!"
EOFRun:
cat lesson7.yaml# Employee Information Configuration
city: Lagos
message: "Welcome: Cloud Engineers!"- The line starting with
#is a comment. It is ignored by YAML but helps explain the file. citystores a text value.messageis enclosed in quotation marks to keep the text exactly as written.- Comments make YAML files easier to understand, especially when working with larger configuration files.
Verification of Lessons 6 and 7 in the VS Code Terminal
Concept: Demonstrates how YAML reuses common values with anchors and aliases, and how multiple YAML documents can be stored in a single file.
cat > anchors.yaml << 'EOF'
defaults: &default
country: Nigeria
role: Student
student1:
<<: *default
name: Samuel
student2:
<<: *default
name: Grace
---
name: Third Document Stream
EOFRun:
cat anchors.yamldefaults: &default
country: Nigeria
role: Student
student1:
<<: *default
name: Samuel
student2:
<<: *default
name: Grace
---
name: Third Document Stream&defaultcreates an anchor, which saves a group of values for reuse.*defaultis an alias that reuses the values stored in the anchor.<<:copies the values from the anchor into another section.student1andstudent2automatically inherit thecountryandrolevalues fromdefaults.---marks the beginning of a new YAML document within the same file.- This approach helps reduce repetition and makes YAML files easier to maintain.
Verification of Lesson 8 (YAML Anchors, Aliases, and Multiple Documents) in the VS Code Terminal
Concept: Demonstrates the basic structure of a GitHub Actions workflow used to automate tasks such as building, testing, and deploying applications.
cat > workflow.yaml << 'EOF'
name: Build Project
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Building project..."
EOFRun:
cat workflow.yamlname: Build Project
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Building project..."namegives the workflow a descriptive name.onspecifies when the workflow should run. In this example, it runs whenever code is pushed to the repository.jobscontains the tasks the workflow will perform.buildis the name of the job.runs-onspecifies the operating system used to run the job. Here, it uses the latest Ubuntu runner provided by GitHub.stepsis a list of actions the job performs, one after another.uses: actions/checkout@v4downloads your repository's code so the workflow can access it.run: echo "Building project..."executes a command in the runner and prints "Building project..." to the workflow log.- This is the foundation of a GitHub Actions workflow and is commonly used to automate software builds, tests, deployments, and other DevOps tasks.
Verification of Lesson 9 (GitHub Actions Workflow) in the VS Code Terminal
Concept: Demonstrates how YAML stores text across multiple lines using the literal (|) and folded (>) styles.
cat > multiline.yaml << 'EOF'
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.
EOFRun:
cat multiline.yamlbio_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.The pipe symbol (|) tells YAML to keep the text exactly as it is written, including line breaks.
bio_literal: |
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.When read by an application, the text remains:
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.
The greater-than symbol (>) tells YAML to combine multiple lines into a single paragraph.
bio_folded: >
I enjoy learning Azure.
I build cloud solutions.
I teach DevOps.When read by an application, it becomes:
I enjoy learning Azure. I build cloud solutions. I teach DevOps.
- Use
|when you want to preserve line breaks. - Use
>when you want multiple lines to be treated as one paragraph. - These styles are commonly used in Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Ansible playbooks, and application configuration files.
Verification of Lesson 10 (Multi-line Text) in the VS Code Terminal
Concept: Demonstrates how YAML organizes application settings into logical sections, making configuration files easy to read and manage.
cat > app-config.yaml << 'EOF'
application:
name: SKILL.SCH
version: 1.0
environment:
name: Development
database:
server: sql01
port: 1433
logging:
level: Information
EOFRun:
cat app-config.yamlapplication:
name: SKILL.SCH
version: 1.0
environment:
name: Development
database:
server: sql01
port: 1433
logging:
level: Information-
applicationgroups information about the application.namespecifies the application's name.versionspecifies the current version.
-
environmentidentifies where the application is running.Developmentmeans the application is in a development environment. Other common environments includeTesting,Staging, andProduction.
-
databasestores the database connection details.serverspecifies the database server name.portspecifies the communication port.1433is the default port for Microsoft SQL Server.
-
loggingcontrols how the application records events.Informationmeans the application logs general information about its operation.
-
The file is divided into sections, making it easier to locate and update configuration settings without affecting other parts of the application.
-
This type of YAML file is commonly used in cloud applications, web applications, APIs, Docker containers, Kubernetes deployments, and DevOps projects to separate configuration from application code.
Verification of Lesson 10 (Application Configuration) in the VS Code Terminal
Concept: Combines the YAML concepts learned in previous lessons into one complete configuration file.
cat > student-profile.yaml << 'EOF'
default_profile: &default
role: Student
country: Nigeria
active: true
name: Samuel
role: Cloud Engineer
country: Nigeria
city: port-harcourt
skills:
- Azure
- Docker
- Kubernetes
hobbies:
- Coding
- Reading
address:
street: Gra
city: Port-harcourt
country: Nigeria
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.
user1:
<<: *default
name: Grace
user2:
<<: *default
name: Daniel
EOFRun:
cat student-profile.yamldefault_profile: &default
role: Student
country: Nigeria
active: true
name: Samuel
role: Cloud Engineer
country: Nigeria
city: Port-harcourt
skills:
- Azure
- Docker
- Kubernetes
hobbies:
- Coding
- Reading
address:
street: Gra
city: Port-harcourt
country: Nigeria
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.
user1:
<<: *default
name: Grace
user2:
<<: *default
name: DanielVerification of Lesson 12 (Complete YAML Student Profile) in the VS Code Terminal
- Basic key-value pairs
- Grouped data (mappings)
- Lists (sequences)
- Nested structures
- YAML data types
- Strings (text)
- Integers (whole numbers)
- Floats (decimal numbers)
- Booleans (
true/false) - Null values (
null)
- Comments
- Quoted strings
- Multi-line text (
|and>) - Anchors (
&) - Aliases (
*) - Merge keys (
<<:) - Multiple YAML documents (
---) - GitHub Actions workflow structure
- Application configuration files
# 1. Initialize repository & add files
git init
git add .
# 2. Create commit
git commit -m "Complete YAML learning lab and student profile challenge"
# 3. Rename branch & push to remote
git branch -M main
git remote add origin <YOUR-GITHUB-REPO-URL>
git push -u origin mainThe YAML Learning Lab provided a practical introduction to YAML through hands-on exercises and real-world examples. By completing each lesson, I gained confidence in creating, organizing, and validating YAML files while understanding their importance in Cloud and DevOps workflows.
Throughout this project, I learned how to:
- Create basic key-value pairs.
- Organize data using mappings and nested structures.
- Work with lists and grouped records.
- Use different YAML data types.
- Add comments and quoted strings.
- Write multi-line text using the
|and>operators. - Reuse configuration with anchors and aliases.
- Understand the structure of GitHub Actions workflow files.
- Validate YAML files using Python.
- Use Git for version control and publish a project to GitHub.
This project strengthened my understanding of YAML and its practical applications in tools such as GitHub Actions, Docker Compose, Kubernetes, Ansible, and other Cloud and DevOps technologies.







