YAML is the most widely used data format or configuration format in the industry of the cloud providers, DevOps tools for a cloud practitioner, a tester, a DevOps professional, or a developer

 

YAML is a superset of JSON, you can declare anything, Everything that is possible using JSON can do with YAML.

 

YAML is a human-readable data serialization standard that can be used in conjunction with all the programming languages.

 

Acquiring proficiency in YAML is essential today, as numerous prominent programs, such as Kubernetes, Docker, GitHub Actions, Puppet, Chef, Ansible. All these products extensively utilise YAML to define configurations.

 

Likewise, all cloud providers such as GCP, Azure, and AWS utilise YAML for acceptance guidelines and to execute any automation.

 

 

Data Serialization

Data serialization is a process of converting data object present in complex data structure into a byte stream for storage transfer distribution purpose on a physical device.

 

Serialization

Serialization is is when reading data from databases and transferring it across the web for example like you have a front end application. Some commonly used serialization formats are JSON, YAML, XML.

 

 

YAML

  • YAML is data serialization format that stands for YAML markup language
  • YAML is written in simple English language 
  • YAML supports various data types like case, arrays, dictionary, list, scalars
  • it is a good support for most programming language like JavaScript, Python, Ruby, Java
  • YAML also support spaces and is case sensitive and space sensitive
  • has .yaml extension
  • tabs are not universally accepted

 

 

 

WHY YAML?

  • Substitution: YAML emerged as a substitute for XML and JSON due to the verbosity of both formats. Both XML and JSON are not human friendly, whereas with YAML we should be able to define the configurations or data by adhering to a straightforward grammar that is more user-friendly and less lengthy.
  • Human Readable and Hierarchical: YAML won't use curly braces tags, which we will use inside the XML and JSON. YAML requires everyone to write configurations or data indented. Following file indentation makes hierarchy clear.
  • Flexible Data Types: Other than human-readable, YAML supports other data kinds. YAML lets us define String, integer, float, boolean, date, timestamp, List Collection, dictionaries, Set data types. Regardless of data or configuration complexity, we should be able to quickly use YAML to represent your data and configurations.
  • Cross Platform: Same YAML can be deployed to a Linux, MAC or Windows cloud server,

 

 

User Case

  • Configuration Management: The DevOps ecosystem includes hundreds of tools including Ansible, Kubernetes, Docker, GitHub, actions, Terraform. All these products accept YAML instructions. YAML is made to be simple to read and write, so it is rather common for managing configurations.
  • Serialization: Although the primary objective of YAML is to be employed for data serialization. However, due to its intuitive nature and human-friendly interface, it became the preferred method of writing for all individuals. configuration files.
    • For example if we want to send User Model to another mobile application, then instead of sending entire Model as it (to save space and time), we better serialize it i.e. breaking entire info into pieces, and send to our receiver along with necessary information as how to assemble the Model again at his end. 
    • The benefit of this data serialisation is that sender can be built in Python. Java where as our receivers can be build on any other computer language like c# or PHP.
    • Regardless of how the applications are built, they should be able to communicate with each other with the help of data serialization concept.
  • Data Storage: Data storage is another area that will see YAML's usage, in addition to configuration management. Imagine a situation where you need a place to keep information about a person, a product, or any other part.

 

 


These PyYAML packages only parse YAML 1.1. Use the package to pass YAML files with version 1.2.as ruamel.yaml.

 

Common platform supported by YAML


Related Question