LocalStack — AWS Cloud Service Emulator for Local Development & CI
Run S3, Lambda, DynamoDB, SQS, SNS, IAM, and 80+ other AWS services on your laptop or CI runner in a single Docker container.
What it is
LocalStack is a cloud service emulator that runs inside a single Docker container on your laptop or CI runner. It provides functional implementations of over 80 AWS services including S3, Lambda, DynamoDB, SQS, SNS, IAM, and more. Instead of deploying to AWS for every test, you point your SDK at LocalStack and iterate locally.
This tool is built for backend developers, DevOps engineers, and platform teams who need fast feedback loops without incurring AWS costs or waiting for cloud provisioning.
How it saves time or tokens
LocalStack eliminates the deploy-test-debug cycle against real AWS. A Lambda function that takes 2 minutes to deploy and test on AWS can be tested in seconds locally. CI pipelines run faster because they skip network round-trips to AWS endpoints. Teams also avoid surprise AWS bills from forgotten test resources.
For AI-assisted development, LocalStack lets coding agents test AWS integrations without needing real credentials or permissions, keeping the feedback loop tight.
How to use
- Install LocalStack via pip or Docker Compose.
- Start the container with
localstack startordocker-compose up. - Point your AWS SDK to the LocalStack endpoint (
http://localhost:4566). - Run your application or tests against the local endpoints.
# Start LocalStack with Docker
docker run --rm -it -p 4566:4566 localstack/localstack
# Create an S3 bucket locally
aws --endpoint-url=http://localhost:4566 s3 mb s3://my-test-bucket
# Put an object
aws --endpoint-url=http://localhost:4566 s3 cp test.txt s3://my-test-bucket/
# List buckets
aws --endpoint-url=http://localhost:4566 s3 ls
Example
A typical docker-compose.yml for LocalStack:
version: '3.8'
services:
localstack:
image: localstack/localstack
ports:
- '4566:4566'
environment:
- SERVICES=s3,lambda,dynamodb,sqs
- DEBUG=1
volumes:
- './localstack:/var/lib/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'
Then in your Python test:
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:4566')
s3.create_bucket(Bucket='test-bucket')
s3.put_object(Bucket='test-bucket', Key='hello.txt', Body=b'Hello')
response = s3.get_object(Bucket='test-bucket', Key='hello.txt')
print(response['Body'].read()) # b'Hello'
Related on TokRepo
- DevOps tools — More infrastructure and deployment tools
- Self-hosted solutions — Other tools you can run locally
Common pitfalls
- Not all AWS API behaviors are perfectly replicated. Some edge cases in IAM policies or advanced Lambda features may differ from production AWS.
- The free Community edition covers most services, but certain enterprise features like EKS and RDS require LocalStack Pro.
- Docker socket mounting is required for Lambda execution with container runtimes. Forgetting this causes silent failures.
- Large-scale load testing against LocalStack does not reflect real AWS latency or throttling behavior.
- Environment variable
SERVICESis optional in newer versions. LocalStack now lazily loads services on first request.
Frequently Asked Questions
LocalStack supports over 80 AWS services including S3, Lambda, DynamoDB, SQS, SNS, IAM, CloudFormation, API Gateway, Kinesis, and Step Functions. The Community edition covers core services. Pro adds EKS, RDS, ElastiCache, and others.
The Community edition is free and open-source under Apache 2.0. It covers most common AWS services. LocalStack Pro is a paid tier that adds advanced services, persistence, and team collaboration features.
Set the endpoint URL to http://localhost:4566 in your SDK client configuration. For the AWS CLI, use the --endpoint-url flag. For SDKs like boto3, pass endpoint_url parameter when creating a client. Credentials can be any dummy values.
Yes. LocalStack runs as a Docker container, making it straightforward to add to GitHub Actions, GitLab CI, Jenkins, or any Docker-capable CI system. This eliminates the need for real AWS credentials in CI and speeds up integration tests.
By default, data is ephemeral and lost when the container stops. You can mount a volume to /var/lib/localstack for persistence. LocalStack Pro also offers a snapshot and restore feature for saving and loading state.
Citations (3)
- LocalStack GitHub— LocalStack emulates 80+ AWS services locally
- LocalStack Documentation— Docker-based cloud emulator for development and CI
- AWS SDK Documentation— AWS SDK endpoint configuration for local testing
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.