‫So YAML is what we use
‫all across the US for many types.
‫Also for CloudFormation.
‫And so CloudFormation supports YAML and JSON.
‫And these are basically some scripting languages
‫or data languages that you can use for CloudFormation.
‫And to be honest, I'll be very, very honest with you,
‫JSON is absolutely absolutely horrible for CloudFormation.
‫It is unreadable, it is unwriteable.
‫And YAML is so great in so many ways,
‫and this is what the language will be used
‫at the exam to show you some CloudFormation templates
‫and this is what I've been using so far.
‫So let's learn a little bit about it.
‫Even though we've been touched with it so many times,
‫now is the time, I think, to formalize how is YAML.
‫And so this is a YAML file.
‫And so YAML file has a lot of key and values
‫and they're called key value pairs,
‫and to me, they're very readable objects.
‫Okay, on the left hand side, we can just look at it
‫and make sense if I asked you, what's the invoice number?
‫You don't need to be a genius to tell me
‫that the invoice number is 34843, and so this is great.
‫I tell you what is the date, you can also tell me the dates.
‫If I ask you, hey, what are the quantities
‫of the product we've ordered?
‫You can look at product and then you can look
‫within the product, there's a list of quantity
‫and we have four and one.
‫So you get the idea, right?
‫With YAML, we're able to have key value pairs
‫at top level, but also nested objects.
‫It has a support for arrays, so if we look at products,
‫you can see here that there's a little minus sign
‫and that means array, so the product is an array
‫of SKU, quantity, description, et cetera.
‫And then we can look at, for example, bill-to,
‫within it, there's a nested object called given
‫Chris, family, Dumars, and then the address
‫also has a nested object within it,
‫which is called lines, city, post state, and postal.
‫If we look at also lines, we can see that there
‫is a multiline string support,
‫so we have a small vertical bar right here,
‫and this is called a multiline string,
‫so we can easily add multiline string through YAML,
‫and we can also include comments,
‫although they're not showing on this page.
‫So YAML to me is a great way of reading and writing stuff.
‫Obviously some YAML files can be quite complicated,
‫but overall we get the idea.
‫If we have a look at the CloudFormation we had,
‫let's just look at a simple one.
‫We can see this one that we had a YAML file.
‫The first top level key was Resources,
‫then there is a second nested object within
‫called MyInstance, which has more nested stuff within it,
‫such as Type and Properties,
‫and Properties was again nested as key value pairs.
‫If we look at the other one, we can see we had
‫the Parameters top level, the Resources top level,
‫more nested stuff, and if we look at SecurityGroups,
‫because there's a little minus sign right here,
‫it was a list, so we have a list of SecurityGroups
‫that we've defined right here.
‫The first SecurityGroup and the second SecurityGroup.
‫So we can navigate through this,
‫and really understand that it looks like
‫we can read this YAML template,
‫just using the small concepts we learned from before.
‫I encourage you to go online and learn
‫a little bit more about YAML,
‫and even practice converting JSON documents to YAML.
‫But overall, it is something that I think is quite easy
‫to read, and what you really should understand
‫is that you can nest objects separated by column.
‫You get the key and the value,
‫and using the minus sign, you get to assign a list.
‫So that's it for YAML.
‫I hope this makes more sense to you now,
‫and I will see you in the next lecture.