LocalStack AWS Development
Fully functional local AWS cloud stack for development and testing.
Overview
LocalStack is a fully functional local AWS cloud stack that emulates AWS services on your local machine, originally created by Atlassian engineers to solve the problem of expensive and slow AWS development cycles. It provides local implementations of services like S3, DynamoDB, Lambda, SQS, and API Gateway, allowing developers to test AWS applications without incurring cloud costs or dealing with network latency. LocalStack has become the de facto standard for AWS local development since its open-source release in 2017, supporting over 80 AWS services with high-fidelity emulation.
This stack combines LocalStack's core emulation engine with AWS CLI for command-line interactions and DynamoDB Admin for visual database management. LocalStack serves as the central hub on port 4566, handling all AWS service requests, while AWS CLI provides a pre-configured client for testing and automation scripts. DynamoDB Admin adds a web-based interface for inspecting and managing DynamoDB tables, creating a complete local AWS development environment that mirrors production workflows without requiring actual AWS resources.
This configuration is ideal for development teams building AWS-native applications, DevOps engineers creating infrastructure automation, and organizations wanting to reduce AWS development costs. The combination eliminates the need for separate AWS accounts for each developer, enables offline development, and provides faster feedback loops than cloud-based testing. Companies like Netflix, Airbnb, and thousands of startups use LocalStack to accelerate their AWS development cycles while maintaining production parity.
Key Features
- Complete AWS service emulation including S3 buckets, DynamoDB tables, Lambda functions, SQS queues, SNS topics, and API Gateway endpoints
- Docker-reuse Lambda executor for faster function invocation and reduced container overhead during testing
- Pre-configured AWS CLI container with test credentials and LocalStack endpoint configuration
- Visual DynamoDB table browser and editor through DynamoDB Admin web interface
- Persistent data storage maintaining S3 objects, DynamoDB data, and Lambda deployments across container restarts
- CloudWatch logs and metrics collection for monitoring local AWS service usage
- Secrets Manager and Systems Manager Parameter Store for testing secure configuration management
- Multi-service integration testing with services communicating through LocalStack's internal routing
Common Use Cases
- 1Serverless application development with Lambda functions triggering from S3 events or API Gateway requests
- 2E-commerce platforms testing order processing workflows with DynamoDB, SQS, and SNS integration
- 3Infrastructure as Code validation using Terraform or CloudFormation against LocalStack endpoints
- 4CI/CD pipeline integration testing without provisioning actual AWS resources
- 5Microservices development with API Gateway routing, Lambda backends, and DynamoDB persistence
- 6Data processing pipeline development using S3 for storage, Lambda for processing, and SQS for queueing
- 7AWS certification study labs for hands-on practice with AWS services without cost concerns
Prerequisites
- Docker Engine 20.10+ with at least 4GB RAM allocated for LocalStack service emulation
- 8GB system RAM minimum for running Lambda functions and multiple AWS services simultaneously
- Ports 4566, 4510-4559, and 8001 available for LocalStack services and DynamoDB Admin interface
- Basic AWS concepts knowledge including S3 buckets, DynamoDB tables, and Lambda functions
- Docker socket access (/var/run/docker.sock) for LocalStack's Lambda Docker executor
- Understanding of AWS CLI commands and endpoint URL configuration for local development
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 localstack: 3 image: localstack/localstack:latest4 ports: 5 - "4566:4566"6 - "4510-4559:4510-4559"7 environment: 8 - SERVICES=s3,sqs,sns,dynamodb,lambda,apigateway,cloudwatch,secretsmanager,ssm9 - DEBUG=110 - DATA_DIR=/var/lib/localstack/data11 - LAMBDA_EXECUTOR=docker-reuse12 - DOCKER_HOST=unix:///var/run/docker.sock13 volumes: 14 - localstack_data:/var/lib/localstack15 - /var/run/docker.sock:/var/run/docker.sock16 networks: 17 - localstack-net18 restart: unless-stopped1920 aws-cli: 21 image: amazon/aws-cli:latest22 environment: 23 - AWS_ACCESS_KEY_ID=test24 - AWS_SECRET_ACCESS_KEY=test25 - AWS_DEFAULT_REGION=us-east-126 entrypoint: /bin/sh27 command: -c "sleep infinity"28 depends_on: 29 - localstack30 networks: 31 - localstack-net3233 dynamodb-admin: 34 image: aaronshaf/dynamodb-admin:latest35 ports: 36 - "8001:8001"37 environment: 38 - DYNAMO_ENDPOINT=http://localstack:456639 - AWS_REGION=us-east-140 - AWS_ACCESS_KEY_ID=test41 - AWS_SECRET_ACCESS_KEY=test42 depends_on: 43 - localstack44 networks: 45 - localstack-net46 restart: unless-stopped4748volumes: 49 localstack_data: 5051networks: 52 localstack-net: 53 driver: bridge.env Template
.env
1# LocalStack Configuration2SERVICES=s3,sqs,sns,dynamodb,lambda3DEBUG=145# AWS CLI (for local development)6AWS_ACCESS_KEY_ID=test7AWS_SECRET_ACCESS_KEY=test8AWS_DEFAULT_REGION=us-east-1Usage Notes
- 1LocalStack at http://localhost:4566
- 2DynamoDB Admin UI at http://localhost:8001
- 3Use --endpoint-url=http://localhost:4566 with AWS CLI
- 4Supports S3, SQS, SNS, DynamoDB, Lambda, and more
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
localstack
localstack:
image: localstack/localstack:latest
ports:
- "4566:4566"
- 4510-4559:4510-4559
environment:
- SERVICES=s3,sqs,sns,dynamodb,lambda,apigateway,cloudwatch,secretsmanager,ssm
- DEBUG=1
- DATA_DIR=/var/lib/localstack/data
- LAMBDA_EXECUTOR=docker-reuse
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- localstack_data:/var/lib/localstack
- /var/run/docker.sock:/var/run/docker.sock
networks:
- localstack-net
restart: unless-stopped
aws-cli
aws-cli:
image: amazon/aws-cli:latest
environment:
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=test
- AWS_DEFAULT_REGION=us-east-1
entrypoint: /bin/sh
command: "-c \"sleep infinity\""
depends_on:
- localstack
networks:
- localstack-net
dynamodb-admin
dynamodb-admin:
image: aaronshaf/dynamodb-admin:latest
ports:
- "8001:8001"
environment:
- DYNAMO_ENDPOINT=http://localstack:4566
- AWS_REGION=us-east-1
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=test
depends_on:
- localstack
networks:
- localstack-net
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 localstack:5 image: localstack/localstack:latest6 ports:7 - "4566:4566"8 - "4510-4559:4510-4559"9 environment:10 - SERVICES=s3,sqs,sns,dynamodb,lambda,apigateway,cloudwatch,secretsmanager,ssm11 - DEBUG=112 - DATA_DIR=/var/lib/localstack/data13 - LAMBDA_EXECUTOR=docker-reuse14 - DOCKER_HOST=unix:///var/run/docker.sock15 volumes:16 - localstack_data:/var/lib/localstack17 - /var/run/docker.sock:/var/run/docker.sock18 networks:19 - localstack-net20 restart: unless-stopped2122 aws-cli:23 image: amazon/aws-cli:latest24 environment:25 - AWS_ACCESS_KEY_ID=test26 - AWS_SECRET_ACCESS_KEY=test27 - AWS_DEFAULT_REGION=us-east-128 entrypoint: /bin/sh29 command: -c "sleep infinity"30 depends_on:31 - localstack32 networks:33 - localstack-net3435 dynamodb-admin:36 image: aaronshaf/dynamodb-admin:latest37 ports:38 - "8001:8001"39 environment:40 - DYNAMO_ENDPOINT=http://localstack:456641 - AWS_REGION=us-east-142 - AWS_ACCESS_KEY_ID=test43 - AWS_SECRET_ACCESS_KEY=test44 depends_on:45 - localstack46 networks:47 - localstack-net48 restart: unless-stopped4950volumes:51 localstack_data:5253networks:54 localstack-net:55 driver: bridge56EOF5758# 2. Create the .env file59cat > .env << 'EOF'60# LocalStack Configuration61SERVICES=s3,sqs,sns,dynamodb,lambda62DEBUG=16364# AWS CLI (for local development)65AWS_ACCESS_KEY_ID=test66AWS_SECRET_ACCESS_KEY=test67AWS_DEFAULT_REGION=us-east-168EOF6970# 3. Start the services71docker compose up -d7273# 4. View logs74docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/localstack-aws/run | bashTroubleshooting
- Lambda functions failing with 'Cannot connect to Docker': Ensure Docker socket is properly mounted and Docker daemon is running with correct permissions
- DynamoDB Admin showing connection errors: Verify LocalStack is fully started by checking http://localhost:4566/health before accessing admin interface
- AWS CLI commands hanging or timing out: Add --cli-read-timeout=0 and --cli-connect-timeout=60 flags for LocalStack compatibility
- S3 bucket operations returning 500 errors: Restart LocalStack container as S3 service may need reinitialization, especially after Lambda deployments
- Port 4566 connection refused: Check if LocalStack container started successfully and all required services initialized by examining container logs
- Lambda functions not persisting between restarts: Ensure localstack_data volume is properly mounted and DATA_DIR environment variable is set correctly
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
localstackaws-clidynamodb-admin
Tags
#localstack#aws#s3#lambda#dynamodb#development
Category
Development ToolsAd Space
Shortcuts: C CopyF FavoriteD Download