When you need to test a cloud service provider, you usually need to create an account and enter your payment details to start using it. It usually costs you money, right? But what if they were a solution that helps you to emulate public cloud such as Amazon? Yes, there are and we’ll have a look at them today.
A free tool called LocalStack is a cloud service emulator that you can install locally on your Laptop/desktop computer. LocalStack runs in a single container. If you just want to test some complex CDK applications or Terraform configurations, or just beginning to learn about AWS services, LocalStack helps speed up and simplify your testing and development workflow. LocalStack supports a growing number of AWS services, like AWS Lambda, S3, Dynamodb, Kinesis, SQS, SNS, and many more.
We were testing the solution within a Windows environment, but you can easily use Linux or MAC computers as well.
The LocalStack solution has also paid versions where you obviously get more functions and more features. You can have a look at the page here if you’re looking for more robust functionality.
The advantages of going local
As you might imagine, one of the first aspects of cloud is always cost. You can possibly enable your engineering teams to use LocalStack and provide them with a complete, localized AWS environment where they can build, test, profile and debug infrastructure and code ahead of deployment to the cloud, to the production.
You can set up each of your software engineers to be fully independent with local development and testing tooling via LocalStack. This will really speed up the app development process and streamlines the test before production workflow.
With LocalStack, you will implement test doubles of your AWS services with LocalStack. LocalStack supports:
- running applications without connecting to AWS.
- avoiding the complexity of AWS configuration and focusing on development.
- running tests in your CI/CD pipeline.
- configuring and testing error scenarios.
- No access requirements
- No infrastructure management overhead
- No disruption for others
- Developping Offline
- Single button – Start and Stop your LocalStack instance with a single start/stop button
- Check the status – allows you to see the current status of your LocalStack instance
- Tray – Easily accessible via a tray icon
- Easy Setup – during the setup and Initialization, the system checks to see if your setup is correct and if you have all the required components in place.
LocalStack Cockpit Installation and check of your environment
- Easy Help – There are easy-to-find quick links to the developers’ website, documentation, and Web App.
- Logs – check the logs within an overview window within the app
The Requirements to run LocalStack
You’ll need a machine that runs Docker. In my case, I tried my Windows environment and quickly realized that I need to install Docker. This wasn’t without some difficulties because Docker for Windows has some requirements too. And as I’ve been running all this in a VM within my VMware Workstation, this added some other complexities.
But in the end all was good. Here is what you need to do to successfully run Docker for Windows:
- Get Docker for Windows from this link.
- Double-click InstallDocker.msi to run the installer, then just follow the Install Wizard and accept the license. You’ll need to authorize the installer. Click Finish to launch Docker.
If Docker for Windows does not start, you most likely need to install and configure Windows Subsystem for Linux (WSL) first.
01. Start PowerShell as an admin and run the following to enable WSL:
<em>dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart</em>
02. Then, you’ll need to enable the Virtual Machine feature.
<em>dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart</em>
Restart the system (VM or Physical machine).
03. Download and install WSL 2 Update
Download the WSL2 Linux kernel update package for x64 machines and install it.
04. Set the default version of WSL as WSL 2 via this command:
<em>>wsl --set-default-version 2</em>
After these 4 steps, you can start Docker for Windows.
Docker for Windows running on the desktop
Once your environment is validated (docker is running), you can start the LocalStack installer. The system goes on and checks the Docker running, then check the LocalStack Docker Image, LocalStack CLI and LocalStack Runtime.
LocalStack Cockpit Setup
When all these checks succeed, the environment is ready and only then you can start the system by pressing the START button. The default config is started. On the right, you have the INFO tab together with SERVICES and LOGS tabs for further information.
If you want to halt the environment and change a variable or config, use the STOP button. See the running environment in the picture below.
LocalStack Cockpit Started
We won’t go further in this short review as it is outside the scope of this introductory post about LocalStack and its outside of our knowledge within this field.
It is possible to run LocalStack with some other options too. From the product page we found out that you can run LocalStack through the following options:
Further reads and wrap up
You can have a look at the GitHub page where you’ll find some insights.
You can Install the AWS CLI.
The homepage of LocalStack is here.
As I mentioned at the beginning of this post, the local environment with LocalStack allows developers to develop, debug and test AWS applications locally instead of using bandwidth and public cloud resources. It is not a replacement for AWS, but allows you to test things locally before pushing them into Amazon AWS for real.
The cost savings are real as you’re only playing with things running locally. It may be also a time-consuming experience when you want to kick off an automated build each time you trial and error to make your code work in the cloud.