Skip to main content

Building a Local AWS Environment with LocalStack and Terraform

· 7 min read
Nico
Nico
Software Developer

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:

  1. Docker desktop
  2. LocalStack (a service that provides mock AWS environments)
  3. 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.

Terraform/tfenv Installation Instructions

· 4 min read
Nico
Nico
Software Developer

Infrastructure as Code (IaC) has become essential nowadays. Of course, there are various benefits, such as managing configurations through code, reducing the burden of manual setups, and mitigating the risks of human error. It seems that during external audits, there are cases where they check whether your infrastructure is managed using IaC as part of the review process. Perhaps auditors prefer to review infrastructure through code because it makes their job easier? (Though that's just speculation.)

If you're planning to build your application's infrastructure on the cloud, I strongly recommend using IaC unless you have a compelling reason not to. Besides the auditing aspect I mentioned earlier, if you manually build your infrastructure and then later decide, "I want to manage this with IaC after all," you'll need to be prepared for the challenges that come with that decision.

In this article, I'll provide installation instructions and a simple guide for those considering using Terraform.

Additionally, in real-world scenarios, it's common to specify a particular version of Terraform. I'll also introduce the installation steps for tfenv, a tool that allows you to easily switch between Terraform versions for different projects.

About the Author

· 2 min read
Nico
Nico
Software Developer

Nice to meet you

Hi there! I'm Nico, the author of this site. I've adopted an English name since I'm living abroad, and I find it quite useful. It serves as a nickname when writing a blog, and it’s handy when you need a player name in games.

Nico is also the operator of Bluedog. Let's keep in touch!