Building a Local AWS Environment with LocalStack and Terraform
When working on development related to AWS, have you ever thought, "I wish I could do everything locally, including development and testing"? Even though AWS offers a free tier, setting up a development account can be a bit of a hassle. Plus, there’s always the risk of accidentally exceeding the free tier limits.
Back when I was just starting out (around 5-6 years ago), I set up an AWS account to learn and experiment. One day, I was shocked to discover a hefty bill had racked up. I had forgotten to close the account I used for learning, and various services kept running... A very expensive lesson learned.
Even if your company provides a shared development account, your actions might impact others, potentially leading to unintended charges.
In this article, I’ll introduce the steps to set up your local environment for testing AWS services using the following tools:
- Docker desktop
- LocalStack (a service that provides mock AWS environments)
- tarraform-local (a handy tool for running Terraform locally)
While it's possible to use aws-cli for setting things up, this article will focus on using Terraform to build AWS services. This setup could also be useful as a learning environment for Terraform.