Skip to main content

When should you automate your work?

Repetition is the key to success in life, whether we're talking about exercising, doing crossword puzzles or other types of professional work, doing the same thing multiple times builds muscle memory. There certainly is a benefit to repeating the same task, whether you're trying to actually build muscles, or in the case of intellectual challenges, if you're trying to learn or improve your mental capacity. But there are tasks that don't really bring any benefit, they just take time. Those are mostly when you spend a lot of time to do menial tasks, things that don't really bring you any benefit. Whether you're doing IT tasks by clicking through UIs, typing commands in your computer, filling numbers in a spreadsheet, writing a report, or classifying papers, these tasks don't tend to bring you any benefit. This is when you should think about automating your work.

As someone with a tech background, automation is something I default to very quickly. The good thing about technology is that it allows you to automate much more easily than the analog world would. Regardless of the task you're trying to do, if it's doable on a computer, then it can be automated. And in my opinion, any task that has to be done more than two times should be automated. If you end up doing the same exact thing three times, it's highly likely that you're going to need to do it again in the future, so why not automate it? Automation brings several benefits: While the automation process often takes longer than doing the task once, any future task is going to be much faster, so you save a lot of time. Also, once a task is automated, the computer will run the automation flawlessly, so you avoid making mistakes or forgetting how certain things are done.

There are many tools out there that can be used for automation. One common misconception is that automation is only done by developers. It's true that tools like Jenkins and AWS Code Pipeline are mostly used to build software applications, test code and deploy them, in reality you could build a Jenkins pipeline that does pretty much anything you want. As long as you can type a command to accomplish your task, it can be automated. Most graphical user interfaces can also be automated. You could of course start with a batch or Python script, which is what I used to do, but now I build pipelines for everything. The benefit of building a pipeline instead of a script is that you can track execution much easier since you can divide your pipeline into specific tasks, and everything is centralized in one interface, whereas scripts tend to be left in various folders on various systems.

Here are two examples of tasks I've automated. The first use case is keeping track of costs for our AWS environments. Dendory Capital runs various cloud resources, and making sure the billing costs don't get out of hand is obviously important. We could task someone to manually go check the AWS console on a set time frame, but this can easily automated. Using the AWS CLI, I automated a simple pipeline that runs the following command once a day:

aws ce get-cost-and-usage --time-period Start={}-01,End={} --metrics BlendedCost --granularity MONTHLY".format(now.strftime("%Y-%m"),now.strftime("%Y-%m-%d"))

Another example is email parsing. This is a much more complex use case, but one that can also be successfully automated. Email is often seen as a dumping ground for communication that may or may not be important or related to existing projects. Like most of you, I receive a lot of email, most of it spam, but some of it useful and actionable. The Dendory Capital emails all go to a centralized server before being delivered to individual mailboxes, so it's easy to build an automation pipeline that triggers anytime a new email is received. The way to do this will vary based on your email solution, but we use a Postfix server so all the email received can be read as text files.

All the script does is scan each email for keywords, and if these keywords are found, various Python functions are triggered to do things like building reports, sending alerts or updating databases, based on the needs. There's an endless number of use cases that you may not initially consider for automation, but if it can be done on a computer, there's almost certainly a way to automate it.