Archive · AWS

LocalStack: AWS Services on Your Laptop

Run LocalStack in Docker and use the AWS CLI against it with awslocal.

1 min read

  • LocalStack 4.0
  • awslocal
  • Docker 27

LocalStack emulates many AWS APIs locally, so you can test S3, SQS, SNS, DynamoDB, Lambda and more without an account or cost.

docker-compose.yml:

services:
  localstack:
    image: localstack/localstack:4.0
    ports: ["127.0.0.1:4566:4566"]
    environment:
      SERVICES: s3,sqs,sns,dynamodb,lambda
    volumes:
      - ./volume:/var/lib/localstack
      - /var/run/docker.sock:/var/run/docker.sock
docker compose up -d
pip install awscli-local
awslocal s3 mb s3://test-bucket
awslocal sqs create-queue --queue-name jobs
awslocal dynamodb list-tables

Applications point at the endpoint with AWS_ENDPOINT_URL=http://localhost:4566 and any dummy credentials (test / test).

Be aware of limits: LocalStack is for development and tests, not a faithful copy of IAM enforcement, networking or performance. Some services and features are only in the paid tiers, so check the coverage page before depending on one. Pin the image tag for repeatable builds.