localstack
💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
Top Related Projects
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
A tool for mocking HTTP services
MinIO is a high-performance, S3 compatible object store, open sourced under GNU AGPLv3 license.
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Quick Overview
LocalStack is an open-source cloud development platform that provides a fully functional local AWS cloud stack. It allows developers to test their cloud-based applications and services locally, without the need for a real AWS account or infrastructure.
Pros
- Local Development Environment: LocalStack provides a complete local environment for developing and testing cloud-based applications, including support for various AWS services.
- Cost-Effective: Using LocalStack eliminates the need for a real AWS account, which can be costly, especially during the development and testing phases.
- Faster Iteration: LocalStack enables faster development and testing cycles, as developers can quickly spin up and tear down cloud resources without the overhead of a real cloud environment.
- Portability: LocalStack is a cross-platform solution, allowing developers to work on their preferred operating system (Windows, macOS, or Linux).
Cons
- Limited Service Support: While LocalStack supports a wide range of AWS services, it may not have complete parity with the actual AWS services, which can lead to compatibility issues.
- Performance Limitations: LocalStack is a local development environment, and its performance may not be on par with a real cloud environment, especially for resource-intensive applications.
- Potential Drift from AWS: As LocalStack is a separate implementation of AWS services, there may be differences in behavior or functionality compared to the actual AWS services, which can lead to unexpected issues during deployment.
- Dependency on Maintainers: LocalStack is an open-source project, and its continued development and support depend on the efforts of the maintainers and the community.
Getting Started
To get started with LocalStack, follow these steps:
- Install Docker on your machine, as LocalStack runs within a Docker container.
- Install the LocalStack CLI using pip:
pip install localstack
- Start the LocalStack environment:
localstack start
- Interact with the LocalStack services using the AWS CLI or your preferred AWS SDK. For example, to create an S3 bucket:
aws --endpoint-url=http://localhost:4566 s3 mb s3://my-bucket
- Explore the available services and their functionality by visiting the LocalStack web UI at
http://localhost:8080
.
Competitor Comparisons
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
Pros of Testcontainers
- Supports a wide range of databases and services beyond AWS
- Provides more flexibility in configuring and customizing containers
- Integrates well with various testing frameworks and build tools
Cons of Testcontainers
- Requires more setup and configuration for each service
- May have higher resource usage due to running full containers
- Less focused on AWS services compared to LocalStack
Code Comparison
LocalStack:
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:4566')
s3.create_bucket(Bucket='my-bucket')
Testcontainers:
@Container
public LocalStackContainer localstack = new LocalStackContainer()
.withServices(LocalStackContainer.Service.S3);
AmazonS3 s3 = AmazonS3ClientBuilder
.standard()
.withEndpointConfiguration(localstack.getEndpointConfiguration(LocalStackContainer.Service.S3))
.withCredentials(localstack.getDefaultCredentialsProvider())
.build();
Summary
LocalStack focuses on emulating AWS services locally, making it ideal for AWS-centric development and testing. Testcontainers offers a broader range of services and greater flexibility but requires more setup. LocalStack provides a simpler setup for AWS services, while Testcontainers offers more customization options and supports a wider variety of technologies beyond AWS.
A tool for mocking HTTP services
Pros of WireMock
- More flexible and customizable for general HTTP mocking scenarios
- Easier to set up and use for simple API mocking tasks
- Supports a wider range of protocols and services beyond AWS
Cons of WireMock
- Lacks specific AWS service emulation capabilities
- Requires more manual configuration for complex scenarios
- May not be as suitable for testing AWS-specific applications
Code Comparison
WireMock:
stubFor(get(urlEqualTo("/api/resource"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody("{\"message\": \"Hello, World!\"}")));
LocalStack:
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:4566')
s3.create_bucket(Bucket='my-bucket')
s3.put_object(Bucket='my-bucket', Key='file.txt', Body='Hello, World!')
WireMock focuses on general HTTP request/response mocking, while LocalStack provides AWS service emulation. WireMock is more suitable for generic API mocking, whereas LocalStack is specifically designed for AWS service testing and development. Choose WireMock for broader API mocking needs and LocalStack for AWS-centric development and testing environments.
MinIO is a high-performance, S3 compatible object store, open sourced under GNU AGPLv3 license.
Pros of Minio
- Focused specifically on object storage, providing a more specialized and optimized solution
- Supports high-performance distributed deployments for large-scale production use
- Offers a comprehensive set of features for data protection, including encryption and erasure coding
Cons of Minio
- Limited to S3-compatible object storage, while LocalStack emulates a broader range of AWS services
- May require more setup and configuration for users seeking a quick local development environment
- Less suitable for testing complex AWS service interactions that go beyond object storage
Code Comparison
Minio (Go):
mc := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
_, err := mc.PutObject(bucketName, objectName, reader, objectSize, minio.PutObjectOptions{})
LocalStack (Python):
s3 = boto3.client('s3', endpoint_url='http://localhost:4566')
s3.put_object(Bucket=bucket_name, Key=object_name, Body=data)
Both examples demonstrate object upload, but Minio uses its own SDK while LocalStack leverages the standard AWS SDK, showcasing the difference in approach between a specialized object storage solution and a more general AWS service emulator.
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Pros of AWS SAM CLI
- Official AWS tool, ensuring compatibility and up-to-date features
- Seamless integration with AWS services and deployment workflows
- Supports local testing and debugging of Lambda functions
Cons of AWS SAM CLI
- Limited to serverless applications and doesn't emulate all AWS services
- Requires AWS account and credentials for some features
- May not fully replicate cloud environment behavior
Code Comparison
LocalStack example:
import boto3
s3 = boto3.client('s3', endpoint_url='http://localhost:4566')
s3.create_bucket(Bucket='my-bucket')
AWS SAM CLI example:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs14.x
LocalStack provides a more comprehensive local AWS environment, supporting various services beyond serverless applications. It's ideal for testing complex AWS infrastructures without incurring costs. AWS SAM CLI, on the other hand, is specifically designed for serverless application development and offers a more streamlined experience for Lambda-based projects. While LocalStack uses standard AWS SDK calls, AWS SAM CLI relies on SAM templates for defining resources.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
:zap: We are thrilled to announce the release of LocalStack 4.1 :zap:
LocalStack is a cloud software development framework to develop and test your AWS applications locally.
Overview â¢
Install â¢
Quickstart â¢
Run â¢
Usage â¢
Releases â¢
Contributing
ð Docs â¢
ð» Pro version â¢
âï¸ LocalStack coverage
Overview
LocalStack is a cloud service emulator that runs in a single container on your laptop or in your CI environment. With LocalStack, you can run your AWS applications or Lambdas entirely on your local machine without connecting to a remote cloud provider! Whether you are testing complex CDK applications or Terraform configurations, or just beginning to learn about AWS services, LocalStack helps speed up and simplify your testing and development workflow.
LocalStack supports a growing number of AWS services, like AWS Lambda, S3, DynamoDB, Kinesis, SQS, SNS, and many more! The Pro version of LocalStack supports additional APIs and advanced features. You can find a comprehensive list of supported APIs on our âï¸ Feature Coverage page.
LocalStack also provides additional features to make your life as a cloud developer easier! Check out LocalStack's User Guides for more information.
Install
The quickest way to get started with LocalStack is by using the LocalStack CLI. It enables you to start and manage the LocalStack Docker container directly through your command line. Ensure that your machine has a functional docker
environment installed before proceeding.
Brew (macOS or Linux with Homebrew)
Install the LocalStack CLI through our official LocalStack Brew Tap:
brew install localstack/tap/localstack-cli
Binary download (macOS, Linux, Windows)
If Brew is not installed on your machine, you can download the pre-built LocalStack CLI binary directly:
- Visit localstack/localstack-cli and download the latest release for your platform.
- Extract the downloaded archive to a directory included in your
PATH
variable:- For macOS/Linux, use the command:
sudo tar xvzf ~/Downloads/localstack-cli-*-darwin-*-onefile.tar.gz -C /usr/local/bin
- For macOS/Linux, use the command:
PyPI (macOS, Linux, Windows)
LocalStack is developed using Python. To install the LocalStack CLI using pip
, run the following command:
python3 -m pip install localstack
The localstack-cli
installation enables you to run the Docker image containing the LocalStack runtime. To interact with the local AWS services, you need to install the awslocal
CLI separately. For installation guidelines, refer to the awslocal
documentation.
Important: Do not use
sudo
or run asroot
user. LocalStack must be installed and started entirely under a local non-root user. If you have problems with permissions in macOS High Sierra, install withpip install --user localstack
Quickstart
Start LocalStack inside a Docker container by running:
% localstack start -d
__ _______ __ __
/ / ____ _________ _/ / ___// /_____ ______/ /__
/ / / __ \/ ___/ __ `/ /\__ \/ __/ __ `/ ___/ //_/
/ /___/ /_/ / /__/ /_/ / /___/ / /_/ /_/ / /__/ ,<
/_____/\____/\___/\__,_/_//____/\__/\__,_/\___/_/|_|
- LocalStack CLI: 4.1.0
- Profile: default
- App: https://app.localstack.cloud
[12:00:19] starting LocalStack in Docker mode ð³ localstack.py:512
preparing environment bootstrap.py:1321
configuring container bootstrap.py:1329
starting container bootstrap.py:1339
[12:00:20] detaching bootstrap.py:1343
You can query the status of respective services on LocalStack by running:
% localstack status services
ââââââââââââââââââââââââââââ³ââââââââââââââ
â Service â Status â
â¡âââââââââââââââââââââââââââââââââââââââââ©
â acm â â available â
â apigateway â â available â
â cloudformation â â available â
â cloudwatch â â available â
â config â â available â
â dynamodb â â available â
...
To use SQS, a fully managed distributed message queuing service, on LocalStack, run:
% awslocal sqs create-queue --queue-name sample-queue
{
"QueueUrl": "http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/sample-queue"
}
Learn more about LocalStack AWS services and using them with LocalStack's awslocal
CLI.
Running
You can run LocalStack through the following options:
Usage
To start using LocalStack, check out our documentation.
- LocalStack Configuration
- LocalStack in CI
- LocalStack Integrations
- LocalStack Tools
- Understanding LocalStack
- Frequently Asked Questions
To use LocalStack with a graphical user interface, you can use the following UI clients:
Releases
Please refer to GitHub releases to see the complete list of changes for each release. For extended release notes, please refer to the changelog.
Contributing
If you are interested in contributing to LocalStack:
- Start by reading our contributing guide.
- Check out our development environment setup guide.
- Navigate our codebase and open issues.
We are thankful for all the contributions and feedback we receive.
Get in touch
Get in touch with the LocalStack Team to report ð issues, upvote ð feature requests, ðð½ ask support questions, or ð£ï¸ discuss local cloud development:
Contributors
We are thankful to all the people who have contributed to this project.
Backers
We are also grateful to all our backers who have donated to the project. You can become a backer on Open Collective.
Sponsors
You can also support this project by becoming a sponsor on Open Collective. Your logo will show up here along with a link to your website.
License
Copyright (c) 2017-2024 LocalStack maintainers and contributors.
Copyright (c) 2016 Atlassian and others.
This version of LocalStack is released under the Apache License, Version 2.0 (see LICENSE). By downloading and using this software you agree to the End-User License Agreement (EULA).
Top Related Projects
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
A tool for mocking HTTP services
MinIO is a high-performance, S3 compatible object store, open sourced under GNU AGPLv3 license.
CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot