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

Okba Boularaoui
2 min readJun 25, 2023

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:

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!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response