DevOps engineers perform a variety of tasks that require drawing upon different skill sets, such as networking, software development and systems administration. With such an array of tasks, it can be difficult to understand which programming languages are the most beneficial to learn as a new DevOps engineer or when looking to shift careers into a more automation-focused role.
Let's outline some of the most useful programming languages and tools for DevOps engineers or anyone pursuing software automation skills.
CI/CD and programming languages
One of the most common and important responsibilities of being a DevOps engineer is to design, implement and maintain CI/CD pipelines.
CI/CD pipelines are vital to the success of any software development project. They automate the build, test and deployment processes that can be orchestrated to run on every commit. Every project can benefit from CI/CD. Even the simplest pipeline that runs a project's tests will help ensure a project is always well tested and new code doesn't introduce regressions.
When designing a CI/CD pipeline, start with the tasks developers already perform manually, such as testing, building or deployments. From there, think about code quality, security and performance. A project might benefit from code linting or another code quality check.
IT admins have other options as well, such as to perform automated security scans with tools like OWASP Zed Attack Proxy (ZAP) or run performance tests with Apache JMeter. Both tools are open source and provide command-line interfaces set up as part of a pipeline. CI/CD pipelines are often written in a markup language, with YAML being the most common language.
Within YAML, CI/CD pipelines often also will contain Bash (Bourne Again Shell), as a Linux machine often runs the build. Bash is a popular shell program that is available on most Linux machines. Learning Bash and understanding how to write scripts, or even call other programs in Bash, translates to unlimited control of CI/CD servers and the automation of time-consuming, error-prone manual tasks.
While Bash mainly focuses on running other programs and automating command-line programs like OWASP ZAP, object-oriented programming languages focus more on solving problems and performing computations. DevOps engineers should understand object-oriented programming languages as well as shell programs like Bash.
With object-oriented languages, it's easier to process objects, such as a list of names, or to build fully functional programs by using the programming language's included libraries. DevOps engineers don't often write application code like developers do, but the ability to understand and make changes in any programming language is a huge asset.
For a first programming language, choose a language like Python or Ruby. Both languages have a fairly simple syntax, which is more similar to pseudocode than a complex programming language like C. DevOps engineers can use Python and Ruby for scripting different automated tasks, and can sometimes simplify a task by using open source third-party libraries or libraries the programming language provides.
A Python script to search through a file for a match to a regular expression and then build a list of matches is easier to understand than the Bash equivalent, which must reference other shell programs like sed or awk to perform the same task.
Infrastructure as code
Every DevOps toolbox should also have an infrastructure-as-code tool like Terraform, Pulumi or AWS Cloud Development Kit. These tools store a project's cloud resources in version control, which tracks changes and applies updates automatically via a CI/CD pipeline.
Moving from manual cloud resource configuration to an infrastructure-as-code tool simplifies resource management. When cloud resources are defined in code, updates to those resources are as simple as running a few commands, rather than applying manual updates through a web browser.
Practice, practice, practice
The best way to improve skills with any language is to use the language practically. Just like learning a spoken language, practice the programming language you intend to learn.
For example, create problems or projects that interest you using the language of your choice. The more you apply a language, the more you'll find libraries used often or common patterns that work best with that language. As you learn, you'll find the most efficient, cleanest and most readable ways to write the code.
With a knowledge of Bash, at least one object-oriented programming language and an infrastructure-as-code tool, a DevOps engineer can automate manual tasks efficiently in a way that is maintainable in the future. Bash offers the ultimate control of Linux servers, in the most native way, while an object-oriented programming language enables the creation of more complex processing, like longer-running scripts to create users. Adding a working knowledge of an infrastructure-as-code tool creates a well-rounded skill set, which enables DevOps engineers to follow best practices like storing cloud resource configurations in version control and using automation to manage those resources.