Working with AWS services in real applications is amazing — until you realize how often you need to deploy even for the smallest change. While the cloud offers incredible scalability and flexibility, local development still feels like an afterthought in many serverless workflows.
Why this matters?
In smaller teams, this might not seem like a huge issue — you deploy, test, and move on. But as the team grows and the codebase gets more complex, the friction starts to add up. Waiting for CloudFormation to deploy changes or running integration tests against actual AWS infrastructure can slow down development significantly and make rapid iteration much harder.
How can this be solved?
Not long ago, I stumbled upon a podcast episode about LocalStack v4, and it got me curious. I'd heard of LocalStack before but never gave it a proper try — so I figured, why not?
A couple of commands later, I had my entire AWS CDK project running locally. Lambda, API Gateway, DynamoDB — all spun up on my machine, no cloud deploys needed. It was surprisingly smooth.
What really stood out was how little effort it took. I didn’t have to rewrite anything in my CDK code. LocalStack just worked. It felt like I finally had a proper local dev setup for the cloud — fast, easy to debug, and perfect for experimenting without worrying about breaking something in the real AWS environment.
How to setup your local environment in less than 5 minutes?
Before diving in, here’s a quick look at the tech stack I was using:
- Node.js with TypeScript
- AWS CDK for infrastructure-as-code
- A serverless architecture using Lambda, API Gateway, DynamoDB and IAM.
If that sounds familiar, you're in luck — getting this running locally with LocalStack was way easier than I expected.
Step 1:
- Install Local Stack
brew install localstack/tap/localstack-cli
Step 2:
- Login to the localstack account and export the token.
export LOCALSTACK_AUTH_TOKEN="<value>"
Step 3:
- Ensure it is correctly installed
localstack --version
Step 4:
- Start localstack
localstack start
Step 5:
- Install dependencies needed for CDK globally
npm install -g aws-cdk-local aws-cdk
Step 6:
- Verify installation
cdklocal --version
Step 7:
- Ensure that your CDK application is not using hardcoded AWS Account or Region. You should use the Environment Variables.
Step 8:
- Add the cdklocal scripts in package.json
"local-deploy": "cdklocal deploy --all",
"local-synth": "cdklocal synth",
"local-bootstrap": "cdklocal bootstrap"`
Step 9:
- Run
npm run local-synth
Step 10:
- Run
npm run local-bootstrap
Step 11:
- Run
npm run local-deploy
Step 12:
- Open localstack browser and check created resources: https://app.localstack.cloud/inst/default/resources
Step 13:
You can check the Cloudformation stacks and the resources created and start already testing the application.
You can literally test the API Gateway Endpoint as if it was deployed and see the Cloudwatch logs for that.
Important Note: The recommendation from LocalStack is to delete the stacks and re-create them instead of updating them.
Personal thoughts
Local development for AWS has always felt like something you just had to live without — but with tools like LocalStack, that's no longer the case. Whether you're working solo or in a larger team, being able to test and iterate quickly without deploying to the cloud is a game changer.
I was genuinely impressed by how smooth the experience was — and I’ll definitely be including LocalStack in more of my AWS workflows moving forward.
Give it a shot and let me know how it goes!
References:
- https://docs.localstack.cloud/getting-started/
- https://github.com/raileanualex/serverless-api [ Basic similar setup as reference ]
- https://www.youtube.com/watch?v=vVUBnXD6eto
Top comments (2)
Amazing guide! What are the potential challenges of replacing cloud deployment with local development tools like LocalStack?
Thank you! The possible challenges are related to the supported services by Localstack & whether your infrastructure is already created within this project. If you are importing and using lookups, the usecase might become more complex.