Imagine if there is a way to learn AWS without ever needing an internet connection, learn to test your infrastructure locally, run AWS services on your machine? Well, there’s this thing called LocalStack in which allows you to run AWS in your machine. You can test out different services, learn how to connect each of it, test out how they can work together, and maybe testing out an application that uses a specific service that you cannot test locally. In this blog, I will guide you through on how to set it up and the things that you can do with it from helping you to master AWS to testing your AWS infrastructure locally. In short, LocalStack is a powerful open-source cloud service emulator that runs entirely within a single Docker Container. For clarity, it is not a “mock” server that simply emulates basic API calls. LocalStack provides a high-fidelity emulation of the AWS APIs. This means the code you write and the configurations you test locally will behave predictably when deployed to a real AWS environment. LocalStack gives you an isolated, risk-free environment to master three critical areas of AWS development: Getting your local AWS sandbox running is straightforward it just requires you to install the LocalStack CLI, AWS CLI, and Docker running. For Mac users, you can simply install it using homebrew For Non-Mac users, you can install it using Alternatively, you can check here how to install it natively in your os here. To check if it is already installed, try running Before you proceed running any commands, make sure that your Docker is already running. Run Check AWS Services that you can experiment with by running To check if you have AWS CLI installed simply run Next, setup an AWS Profile. Simply run this to set a profile This command will then ask you to input AWS Credentials but no need to worry as you can just put test value for AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY and make sure to provide a valid AWS_REGION like us-east-1 and you can format the output to json or the default. Lasty, before moving forward you need to set the endpoint url in your aws config file to have the http://localhost:4566 To use this newly created AWS Profile simply run this will be then set as your profile in your terminal session. To create a S3 Bucket you can run Create a test file that we are going to upload in our S3 Bucket. To upload the file we can run the command To check the contents of the S3 Bucket run LocalStack is more than just a testing tool. it’s the definitive sandbox for achieving AWS mastery. It removes the barriers of slow iteration and risk, giving you the freedom to build, break, and master core AWS services like S3 at lightning speed.
What is LocalStack Anyway?
Let’s Set It Up!
Installation
brew install localstack/tap/localstack-cli
pip
python3 -m pip install --upgrade localstack
localstack --version
in your terminal.Starting It Up
localstack start -d
this will setup the docker container and start it in detach mode. Basically bootsrap a docker instance in your machine.localstack status services
Configure AWS CLI
aws --version
aws configure --profile=localstack
export AWS_PROFILE=localstack
Let’s Create an Amazon S3 Bucket and Upload A File
aws s3 mb s3://test-bucket
. mb stands for make_bucket. Afterwards, you can check the buckets you have by running aws s3 ls
aws s3 cp message.txt s3://test-bucket
cp is copy and will copy the file to the s3 bucket.aws s3 ls s3://test-bucket
and to download the file you just uploaded simply run the command from before but reverse the order so that it knows that you will copy the file from the s3 bucket to your local.Conclusion
Achieve AWS Mastery with LocalStack
AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!
Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!
View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE coursesOur Community
~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.