Installing LocalStack (To Simulate AWS) using Docker Desktop for Windows
Ideal for AWS-like local testing, especially for AWS SDK-based code
Step-by-step guide to install LocalStack for AWS emulation, allowing testing AWS services locally, including S3, RDS, Lambda, and many others.
Step 1: Install Docker (if not yet installed)
Install Docker Desktop for Windows, if it’s not already installed
Step 2: Start Docker Desktop
Start Docker Desktop and ensure it’s running before proceeding.
Step 3: Install LocalStack
Using CLI command
docker pull localstack/localstack
Step 4: Start LocalStack
docker run -d --name localstack -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack
The -p
flags map ports for accessing various LocalStack services.
Step 5: Wait for few minutes ⌛
It is now installed and ready to be configured 😊
Step 6 (optional): Verify its running
Verify LocalStack is running on http://localhost:4566
. Use the browser and developer tools using F12
Step 7: Configure AWS CLI to Use LocalStack
To interact with LocalStack using the AWS CLI, configure it to use LocalStack’s endpoints.
Run the following command to set up a new AWS profile for LocalStack.
useme@DESKTOP-XXXXXX:~$ aws configure --profile localstack
Provide the values (for example)
AWS Access Key ID [None]: test
AWS Secret Access Key [None]: test
Default region name [None]: us-east-1
Default output format [None]: json
Step 8: Running the preferred services
To run S3 — for example — override Endpoints in CLI Commands.
You need to specify LocalStack’s endpoint URL for each AWS service. For example, to run S3 (Simple Storage Service) and to create an S3 bucket:
aws --endpoint-url=http://localhost:4566 s3 mb s3://my-bucket --profile localstack
and the response should be:
make_bucket: my-bucket
Or to run SQS (Simple Queue Service):
aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name my-queue --profile localstack
and the response should be:
{
"QueueUrl": "http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/my-queue"
}
Step 9: Test the health of services
To verify the services are running and healthy, access http://localhost:4566/_localstack/health using the browser
and the response should be:
Services are ready to be used 😊
Many tools and kits available to manage and use the services, examples in the following steps.
Step 10 (optional): Exploring S3
You can, for example, use S3 Browser tool to browse and manage S3 buckets:
- Download it from their website S3 Browser,
- Install it
- Configure it to use the LocalStack
and the result 😊
Done.