profile picture Endowus Tech

Experimenting with ChatGPT for DevOps

April 07, 2023  ·  By Caoimhe Harvey  ·  Filed under chatgpt, devops

I had been working in the DevOps and Site Reliability space for roughly 5 years by the time that ChatGPT made it’s ground shattering debut to the world, and it truly revolutionized how we all think about work and technology. At Endowus, we strive to see how we can leverage modern technology to its fullest, and in this case, how ChatGPT can help DevOps engineers optimize parts of their workflow.

We had all heard the rumours of ChatGPT being able to write a complete application from scratch. With a healthy level of skepticism, I thought “it can’t really be that good”. So I decided to test it out and see for myself.

Initially, I started asking it to produce small scripts in Python and Bash, just to dip my toes in the OpenAI/ChatGPT waters.

ChatGPT writing an automated Python Script to perform memory checks on VMs.

The results were impressive to say the least! 🤯 Not only did it produce code with perfect syntax, but it also explained the code to me and listed assumptions!

At the time, I had been working on deploying Airflow to an EKS Cluster using Helm via Terraform. This setup took roughly 3–5 days to get all squared away and tested. Curious how ChatGPT would perform, I asked it to write a configuration for this. While it did produce the configuration, it wasn’t exactly what I was looking for or hoping for, in fact, it wasn’t really even that close.

Next, I turned to its OpenAI sibling, the Platform Playground, and asked it the same question:

OpenAI’s Platform Playground tool generating Terraform Code for Apache 
Airflow deployment via Helm.

The OpenAI Platform Playground tool was such a game changer! It produced much better code as it appears to have internet access where ChatGPT does not, and therefore can provide more well-rounded configuration.

The configuration seen here that was output by the Playground tool was similar to the one I had configured a few days prior manually, and it took this AI just a few seconds. This can help reduce manual overhead of typing out the various fields, effectively, what it produced was a template which I could then modify and use to deploy at a quicker rate.

I tried asking ChatGPT about specific infrastructure design and configuration options for setting up a theoretical metrics system, a notoriously painful area to set up and maintain. ChatGPT was able to give an answer in a matter of seconds that perfectly answered my questions and advised about best practice where hours of reading Thanos docs and different resources online couldn’t give a definite way forward.

Asking ChatGPT to summarize online documentation.

A few weeks later, I was troubleshooting and looking for a solution to an error that kept coming up in some logs for the task that I was working on. It occurred to me that maybe I could optimize this troubleshooting process by seeing if ChatGPT had a solid resolution:

Asking ChatGPT a technical infrastructure design question.

While ChatGPT didn’t provide much new information about how to troubleshoot or resolve the error from what I had already tried or found online, it can always help remind you to check something that you may have missed or forgotten. I’m sure with different errors it may give more detailed responses and may even provide the specific solution to a given error.

This opens the door for so many, especially more junior engineers, to hone their troubleshooting and triaging skills through ChatGPT. It may also change the entire flow for how we investigate various issues not only in CI/CD and Infrastructure, but even for debugging code.

These two tools combined, ChatGPT and OpenAI Playground, have truly allowed me to improve and optimize my workflow. They have unblocked me at various points over the last two months, either when I simply couldn’t find what I needed on Google or when I just needed a quick question answered.

Getting the most out of ChatGPT for your workflow

Giving ChatGPT an example of the type of output you want.

ChatGPT offers plenty of ways and opportunities for engineers to increase their productivity and help unblock themselves in ways that never existed before and can help optimize their workflow in certain aspects.

However, at the current version of ChatGPT, it is unlikely that DevOps Engineers or SRE’s are at risk for being replaced. While it’s an impressive tool, it’s important to know how best to use and leverage it for the outcome you wish to achieve.