Sitemap
Cloudnloud Tech Community

cloud training

๐’€๐‘จ๐‘ด๐‘ณ SIMPLIFIED โ€” ๐‘ฐ๐’๐’•๐’†๐’“๐’—๐’Š๐’†๐’˜ ๐‘ฎ๐’–๐’Š๐’…๐’†

--

Press enter or click to view image in full size

In this blog letโ€™s explore YAML

โœ…Important of YAML

Yamal file is used to represent data, in this case configuration data

Ansible play books, Cloud Formation, aws, azure resources, Kubernetes etc are written in yaml.

Same data has been represented in xml / Jason / Yamal, here is the Quick comparison of how simple Yamal is to understand

Press enter or click to view image in full size
Source: Kodekloud

โœ…Close look at YAML:

In Yaml data is taken to the simplest form ( key: value pair )

Key and value separated by colon ( : )

There is a space after colon ( : ) differentiating key and value

Source: Kodekloud

โœ…Representing Array / lists in yaml:

source: kodekloud

We are listing fruits and vegetable with a colon ( ; ) followed by enter & dash ( โ€” )at the front.

The dash indicates itโ€™s an element of the array ex: for fruits= orange, apple, banana

Its ordered collection of data, so the properties should be defined in order.

Get Ajay-bjโ€™s stories inย yourย inbox

Join Medium for free to get updates fromย thisย writer.

โœ…Representing Dictionary in yaml:

source: kodekloud

Dictionary is the set of properties grouped together under an item.

ex: here we have grouped nutritional information of banana and crapes.

Blank space should be given before each item in dictionary.

Unordered collection of data, so properties can be defined in any order

โœ…Importance of space & indentation in YAML:

Press enter or click to view image in full size
source: kodekloud

Like in python we have to maintain indentation by providing space in YAML

From above image we can see Fat & carbs came under calories due to space(indentation)

Number of spaces before each property is key in yaml, so we have to be carful in spacing to represent the data.

โœ…Mixing list & dictionary in YAML:

Press enter or click to view image in full size
source: kodekloud

Here we take 3 car and represent respective information in list & dictionary

We have 3 similar cars but different color- so we can make color as list/array in dash (-)

Then inside each list we group items and feed to it as dictionary (model, prize, transition).

๐ŸšจFollow me on Medium & LinkedIn Ajay Bj

https://www.linkedin.com/in/ajay-bj/ for interesting information and Quick Learnings. ๐Ÿšจ

Letโ€™s keep the conversation going! Your engagement through learning ๐Ÿ‘and comments โœ๏ธ helps build a vibrant community of like-minded individuals.

--

--

Ajay-bj
Ajay-bj

Written by Ajay-bj

Passionate in DevOps Cloud, always wanted to stay up to date with the latest industry trends .