Jan 10, 2022
3 mins read
YAML or ‘Yet Another Markup Language’ is a human-readable data serialization language. It is designed in order to be both human-readable and also efficient for parsing.
The YAML specification was written in 2006 by David Preshing, the creator of PHP Markdown, who wanted a universal markup language that was easy for humans to read and write, but still allowed for significant information density and reasonable balancing of tradeoffs between the machine time required to process it and the machine time required to produce it.
These are 3 ways to create a new YAML File.
YAML is mostly used for the configuration files. So to avoid mistakes, find the right template for the YAML configuration for Kubernetes, Ansible or CircleCI.
Here is an example of the Kubernetes nginx configuration deployment file.
|
|
Use this YAML validator tool to validate the YAML
https://codebeautify.org/yaml-validator
Once file data are validated, save the file with the extension of .yaml. This section helps to create valid YAML file.
Open a YAML Formatter tool from the link below
https://codebeautify.org/yaml-beautifier
or
https://jsonformatter.org/yaml-parser
Copy and Paste the YAML Data which is mentioned in Option 1 in the Input tool of the online tool.
Download this file using the download icon mentioned on the Right input area. It will download the YAML file.
This https://codebeautify.org/yaml-beautifier already supports the YAML validation. This will create a New YAML file and will allow downloading.
Now if you already have a YAML document or file, you can upload it to this tool and modify or delete a few objects, an array of the YAML and download the updated and valid YAML file.
This tool also help to create a YAML from text file. Upload text file using the upload file button and YAML will be automatically validated and beautified.
Developer needs to work with data and files resides on the cloud servers and nowadays 95% of web and apps are hosted on AWS, Azure, Google Cloud or Digital Ocean.
Developer can use remote URL to save and edit the YAML files.
Here are few samples of the YAML URL. Now click on these YAML samples.
Once this link is open, use save as functionality of the browser and save. It will generate YAML file and save it on your device.
Using echo :
echo "apiVersion: apps/v1" > config.yml
Using touch :
touch config.yml
I hope this article helps you to understand basic ways to make or create valid YAML files and beautify them.
Sharing is caring!