Earnin Nets a 5x Increase in Speed and Efficiency with HashiCorp and AWS

Executive Summary

Earnin needed infrastructure-as-code-tooling to help keep up with the evolution of and demand for apps that enable its community to access wages before payday. So, it turned to HashiCorp and adopted Terraform, an open-source tool that automates the provisioning of Amazon Web Services (AWS) infrastructure. After the number of managed resources dramatically increased, Earnin needed additional automation. In 2020, it implemented Terraform Enterprise. Terraform Enterprise has significantly reduced the manual effort required to apply plans, thereby accelerating infrastructure provisioning by five times and enabling easier management of thousands of resources.

Challenge: Paying it Forward from the Cloud Requires Efficient Management and Automation

Earnin enables its community to access earned wages through a mobile app that runs on iOS and Android and has more than ten million downloads. Amazon Elastic Compute Cloud (EC2) hosts the back-end of the solution. Earnin’s cloud operations team helps product engineers with infrastructure provisioning in AWS, establishes patterns and practices, ensures security controls are in place, and implements standards across the cloud environments. After the cloud operations team was established, its team members realized that efficiently managing over 15,000 resources while being inundated with pull requests required more than time and talent. It required optimal infrastructure-as-code tooling.

“We have stats on the GitHub repos — the original GitHub repo for open source and the one for Terraform Enterprise. And we've seen over a five times increase in the speed for merging pull requests.” 

- Joe Brinkman, Engineering Manager, Cloud Operations, Earnin

Solution: An Open-Source Door to Enterprise-Sized Infrastructure-As-Code

Earnin adopted Terraform in 2018. Terraform helped the cloud ops team manage resources and infrastructure, set up disaster recovery, and establish processes for code review in GitHub, provisioning, and more. In 2020, Earnin implemented Terraform Enterprise to increase speed, eliminate manual pull request reviews, and increase automation. It also established policies to enforce naming conventions, validation of required resource tags, and security controls using HashiCorp’s Sentinel policy framework. The main AWS services used were Amazon EC2, Amazon Elastic Kubernetes Service (EKS), and Amazon Relational Database Service (Amazon RDS). “Standing up the production instance was organic with HashiCorp Terraform Enterprise. We didn’t have to do a huge cutover right away. Instead, we were able to just start developing new infrastructure in Enterprise,” said Joe Brinkman, Engineering Manager, Cloud Operations at Earnin. 

The Quick Payoff: Change Tracking and Versioning, Reusability, and Centralized Configuration for 60% of Resources

The company quickly benefited from the deployment of Terraform Enterprise. A few key benefits early on included change tracking and versioning in a GitHub repository, improved disaster recovery ability, reusability using core Terraform modules, and centralized environment configuration. Because of these early wins, Terraform Enterprise now manages almost 60 percent of Earnin’s resources. The Earnin cloud operations team also maintains best practices for Terraform configuration and a suite of 50 Terraform modules that act as building blocks.

“I've gone to the Terraform source code many times to figure out an issue or to understand how something works. So it's really helpful that the Terraform core and providers are open-source.”

- Joe Brinkman, Engineering Manager, Cloud Operations, Earnin

Unique Applications: Multi-Environment Targeting Logic and Integration Tests

Earnin saves more time by using Terraform in unique ways to reduce the complexity of dev-to-production scenarios and to improve testing. To avoid drift between environments, each of its core Terraform modules requires a list of target environment names (for example, dev, prod) that indicate where to create resources. The cloud ops team can promote the configuration tested in lower environments by simply updating a single variable, ensuring that the same resources will be provisioned in production environments. To improve testing, Earnin’s Terraform modules have integration tests that run when module pull requests are submitted. The tests use the Terratest framework and create real resources in a test environment. The assertions check that the resources are created successfully and that Terraform plan outputs match what is expected. These tests have dramatically reduced the number of bugs introduced into Earnin’s modules.

Lending Cloud Ops a Hand: Automating Manual Processes Speeds Up Provisioning by 400%

Before implementing Terraform Enterprise, a significant amount of cloud ops team processes were manual. They would test plans, fix issues, pull up the command-line interface (CLI), authenticate with AWS for remote state access, and apply changes—all by hand. Terraform Enterprise automated all these often repetitive and tedious processes. In addition, the Earnin cloud ops team can write Terraform configurations for Terraform Enterprise with just a few lines of code and provision workspaces in minutes, and it has visibility into all source code. As a result, provisioning and other operations processes are now 5 times faster, representing a 400% rate of acceleration. “With Terraform Enterprise, I just click the button and it does all the legwork for me,” said Brinkman. 


About Earnin

Earnin’s mission is to build products for a more equitable financial system and a better life. Built for the unique needs of those living paycheck to paycheck, Earnin is designed to free people from the traditional payment cycle and help them take control of their money, starting from when they earn it.

About HashiCorp

HashiCorp specializes in multi-cloud infrastructure automation software. The HashiCorp software suite enables organizations to adopt consistent workflows to provision, secure, connect, and run any infrastructure for any application.

Published September 2021