Developing for AWS Locally with LocalStack, Docker, and Commandeer
by Alex Tamoykin
This article goes over using Docker, LocalStack, and Commandeer to help Software Developers develop in the cloud more efficiently. After going through this article, you’ll have the right tools set up for cloud development on your machine.
Why Cloud Development Is Popular Today
Today, most of the software development happens in the cloud. Cloud providers developed different services solving each general-purpose problem. With AWS having close to 32% market share, most of the applications are developed on top of AWS cloud services. Starting from running a Ubuntu instance in the cloud using EC2 to storing files with S3, your cloud provider has the building blocks. You don’t need to reinvent the wheel so you can speed up your development process by utilizing already existing solutions.
Drawbacks of Cloud Development
That being said, developing against an AWS account is a complicated endeavor. You need to have a cloud provider account to develop and test your applications. Which comes at some monetary cost. And in some large organizations, you may not have direct access to cloud resources at all. Another issue with cloud development is that it involves some amount of setup on your local machine so you can develop against the cloud.
Making Cloud Development Easier with LocalStack and Commandeer
That’s where local development with LocalStack comes in. You can run LocalStack locally and it’ll mimic your AWS services without you having to have a real AWS account. In addition to it, Commandeer is a desktop app simplifying your local setup allowing you to manage your cloud tools using a desktop UI as opposed to running some complicated terminal commands.
Let’s Get Down To It
First thing first, let’s install Docker on our Ubuntu machine. Follow the instructions using the repository method here to install it. After the installation is complete, you'll need to follow these instructions to add the Docker user to the group. Which will allow you to run docker without using sudo.
Once Docker is installed, you can install Commandeer by downloading it directly from the site.
Open Commandeer, Navigate to LocalStack menu, click Start all services. Commandeer pulls the LocalStack docker image under the hood. Once the image is pulled, it’ll start all of the LocalStack services. Feel free to do another scan to make sure all of the services are started.
Switch to the local account
At the top dropdown, switch to ‘local’ account. Once you switch to it, all AWS requests will start hitting LocalStack as opposed to the real AWS API. At this point, anything you do with AWS in Commandeer will start happening locally.
Create S3 Bucket
Creating a bucket is very simple. You can create a bucket in a variety of different ways. The simplest way is creating a bucket in Commandeer. Navigate to S3 under the AWS section in the side navigation pane. Then click the create bucket button, enter the bucket name, and click save. Here is a link to the Create S3 Bucket with Commandeer tutorial going into more detail about bucket creation. If you feel more adventurous, you can create it using Ansible by following Create S3 Bucket with Ansible tutorial.
S3 folders can be added using Commandeer UI. Click on the bucket you just created either in the table view or inside the side navigation. Then click the Add Folder button. Enter the folder name and click save. Feel free to repeat the process if you would like to create multiple folders. Folders can be nested, if you would like to create another folder inside the newly created folder, just choose the new folder from the side navigation panel and repeat the process.
Adding files is quite straightforward, just choose a folder or a bucket you would like to add the files in. Then drag and drop the files you would like to add into the drag and drop area. You can also click on the upload file button and choose the files from your computer. Commandeer supports adding multiple files all at once.
As you can see, developing against the cloud with LocalStack is very straightforward. Especially combined with the tools like Docker and Commandeer, you can stand up your local AWS environment and write your application against it.
Being able to develop locally is crucial in today’s world of cloud development. Once you have your local environment set up, you’ll be able to develop your features faster by having a quicker feedback cycle. In addition to it, debugging the issues on your local machine is a lot easier than debugging your code in the cloud which runs remotely.
We’re looking forward to seeing what you can build with it. So go ahead and build something great!
This article was contributed by Alex Tamoykin, creator of a forthcoming educational video on our SpringerLink video platform.