YAML Essentials

Course

Intro Video

Photo of Elle Krout

Elle Krout

Content Team Lead in Content

Elle is a Course Author at Linux Academy and Cloud Assessments with a focus on DevOps and Linux. She's a SaltStack Certified Engineer, and particularly enjoys working with configuration management. Prior to working as a Course Author, she was Linux Academy's technical writer for two years, producing and editing written content; before that, she worked in cloud hosting and infrastructure. Outside of tech, she likes cats, video games, and writing fiction.

Length

01:20:19

Difficulty

Beginner

Videos

13

Hands-on Labs

1

Course Details

YAML Essentials gives even the absolute YAML beginner the skills they need to craft documents using this popular data serialization language. Used across a variety of programs and languages for a vast array of reasons, YAML is a popular choice for data storage, configuration files, configurations management, and more. This course explores how to write a properly structured YAML file in both the human-readable block style and the JSON-compatible flow style.

Syllabus

YAML Essentials

Welcome!

About the Course

00:01:33

Lesson Description:

Are you ready to learn some YAML? In this introductory video, we'll cover what this course is about and how we'll be breaking down YAML as we learn.

About the Training Architect

00:00:52

Lesson Description:

Meet the training architect teaching this course in this short video!

YAML Overview

What is YAML?

00:06:21

Lesson Description:

In What Is YAML?, we'll discuss the most basic of YAML question – is YAML (yet) another markup language? What is it commonly used for? Where did it come from? We'll also discuss why YAML is great for humans and the seven core goals of YAML.

Syntax

00:03:36

Lesson Description:

Have you ever wondered where YAML stood in the tabs versus spaces debate? In this lesson, we'll take a look at the most basic syntax conventions that make up a YAML document and learn how to parse a YAML document even if we aren't sure how to write one yet. Finally, we'll take a look at the character encodings that YAML supports and how to ensure our YAML is compatible with JSON.

YAML Styles

00:02:21

Lesson Description:

You're probably familiar with the block-style YAML that often resembles a clean, human-readable list. But did you know YAML can also work as an extension of JSON? YAML offers both "block" and "flow" styles for those who want a more easy-to-read YAML file as well as those who want to be more computer-friendly, JSON-style setup.

YAML Breakdown

Mappings

00:05:47

Lesson Description:

Mappings are also known as hash maps or associative arrays and allow us to assign a value to a key that we also define. Mappings are one of the key elements of YAML, and we can tell something is a map by it's key: value structure – note the colon-space combination that marks it as a mapping. We also take a look at how to use flow style mappings.

Sequences

00:05:37

Lesson Description:

Sequences are also known as arrays and lists, and allow us to provide an inventory of data using a dash-and-space combination that marks it a sequence. Sequences can also be combined with mappings to create "sequences of mappings," "mappings of sequences," and even "mappings of mappings" and "sequences and sequences." In this lesson, we take a look at how to create a sequence in both block and flow styles, as well as review some common mistakes when writing them.

Scalars

00:06:20

Lesson Description:

Now that we know how sequences and mappings work, we can take a look at how we add data to them by learning about scalars – the individual bits that make up a key or value, as well as some basic tricks to manipulate these values both on the processing end and for the sake of human viewability.

Structures

00:04:38

Lesson Description:

We now have a basic YAML file! But did you know YAML can contain more than one directive (or document) in a single file? In this lesson, we'll take a look at the triple-dash structure that signals the beginning of a directive, as well as the triple-dot ending signal we can include at the end.

Comments

00:03:14

Lesson Description:

Those familiar with other languages are probably wondering where the comments are right about now – but don't worry, that's what this lesson is for! We'll learn that YAML works like a lot of other languages, using the octothorpe for comments, and how to add inline and on-line comments. We'll also go through some common commenting mistakes.

Tags

00:04:40

Lesson Description:

Tags provide us with three functions: The ability to assign a universal resource indicator, the ability to assign local tags to that indicator, and the ability to change how the YAML parser reads certain scalars when processing the YAML itself. We first take a look at how to assign a URI using the %TAG header, then we assign some local tags with !, before finally learning how to use the !! indicator to change the data type of a scalar. Default data types: seq - Sequencemap - Mapstr - Stringint - Integerfloat - Floating-point decimalnull - Nullbinary - Binary codeomap - Ordered mapset - Unordered set

Anchors

00:04:00

Lesson Description:

Anchors allow us to reuse data across a YAML file. Have a list or scalar that needs to be referenced again and again? With an anchor, we can use the & prefix to assign some data a name, then use the * with that name to call it repeatedly throughout the file, making updating large files a quick and easy process.

Hands-on Labs are real live environments that put you in a real scenario to practice what you have learned without any other extra charge or account to manage.

00:30:00

Conclusion

Final Thoughts and Next Steps

00:01:06

Lesson Description:

Congratulations on completing YAML Essentials! Now that your YAML skills are up to par, why not check out one of our many courses where you can try them out?