Simplify Cloud Development with LocalStack: Installation, Alias Setup, and S3 Bucket Walkthrough

LocalStack has become an invaluable tool for developers seeking to replicate and test cloud-based environments locally. In this guide, we’ll walk you through the simple process of installing LocalStack, setting up an alias for easy communication, and provide examples of creating and listing S3 buckets. Let’s get started!
Installing LocalStack:
- Visit the official LocalStack GitHub repository (https://github.com/localstack/localstack) for installation instructions.
- Or install it from the official website (https://docs.localstack.cloud/getting-started/installation/)
- Follow the provided steps for your operating system (Windows, macOS, or Linux).
- Ensure that any required dependencies, such as Docker, are installed.
- Run localstack with command:
localstack start
Setting Up the Alias:
- Open your command-line interface (CLI) or terminal.
- Open the
.bashrc
or.bash_profile
file in a text editor - Add the following line at the end of the file:
alias awslocal='aws --endpoint-url=http://localhost:4566'
- This alias redirects AWS CLI commands to the LocalStack endpoint, allowing you to interact with LocalStack services.
- Restart your terminal or just type
source ~/.bashrc
.
NOTE: if you are not using
bash
just google how to create an alias.
Now you can use the alias awslocal
as a command to interact with localstack.
BONUS: Creating and Listing S3 Buckets:
- To create an S3 bucket using LocalStack, execute the following command:
awslocal s3api create-bucket --bucket my-bucket --region us-east-1
- Replace “my-bucket” with your desired bucket name.
- Adjust the region parameter based on your preferred region.

- To list all S3 buckets created within LocalStack, run the following command:
awslocal s3api list-buckets
- This command will display a list of all available S3 buckets within LocalStack.
Conclusion: With LocalStack installed, an alias configured, and example provided for creating and listing S3 buckets, you’re well-equipped to streamline your local development and testing processes. Make the most of LocalStack’s capabilities and leverage its power to enhance your cloud-based application development. Happy coding!