WHAT IS Yaml and how Yaml works

Introduction

in this Tutorial I will explain all about Yaml we will see what Yaml is used for and we’ll go through the syntax of how to write a valid Yaml file as you’ve seen in docker Kubernetes ، ansible Prometheus etc we will show example  configuration files all written in  Yaml  because it has become a pretty widely used format for writing configurations for many different DevOps tools and applications  that’s why when using these tools it’s important to understand the details of Yaml  syntax and its main concepts generally speaking Yaml  is a serialization language  just like XML and JSON serialization language basically means that applications written with different technologies languages etc which have different data structures can  transfer data to each other using a common agreed-on or a standard format and the most popular such formats are Yaml jason and xml and the name Yaml actually stands for Yaml ain’t markup language and you can create Yaml file with one of those two extensions they’re the same one of the main reasons of why Yamls popularity has increased so much over the past years is that it’s super human readable and intuitive which makes it a great fit for writing configuration files for all those recent DevOps tools like I mentioned docker kubernetes etc so to show you an example and also comparison between  Yaml XML and JSON formats let’s consider this example

JSON

XML

YAML

so this is how yaml file would look like it’s very straightforward it’s pretty clean this is the same data in XML format where you have this so-called text and then you have the JSON format and as you see in XML and JSON data structures are defined using special characters in XML you have so-called text with angle brackets in Jason you have curly brackets and in yellow you don’t have those special characters so how data structure is defined in Yaml is through line separations and spaces with indentations that’s why you can indent in space in XML and JSON as you wish but in Yaml 

you get validation error if you have one single space and data structure wrong which may be a little bit annoying but it makes Yaml format the cleanest most human readable format of all three so what are some of your most use cases to count few yaml format is used for duck composed files prometheus Kubernetes and many more tools okay so now that you know what Yaml is

Leave a Comment