Skip to content

Instantly share code, notes, and snippets.

@fazlearefin
Created November 12, 2024 12:33
Show Gist options
  • Save fazlearefin/7982e3e3fb4f9093f99094ea39bb96da to your computer and use it in GitHub Desktop.
Save fazlearefin/7982e3e3fb4f9093f99094ea39bb96da to your computer and use it in GitHub Desktop.
AWS Localstack Docker Compose
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack:3-amd64 # TODO: change this if necessary
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway, bound to localhost only
environment:
- DEBUG=${DEBUG:-0}
# Add secure credentials
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-LSACCESSKEY123}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-LSSECRETKEY123}
# Restrict resource usage
- MAX_CONTAINER_THREADS=100
- LS_LOG=warning
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock:ro" # Read-only access to docker socket
security_opt:
- no-new-privileges:true
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
interval: 30s
timeout: 5s
retries: 3
networks:
- localstack_network
networks:
localstack_network:
driver: bridge
driver_opts:
encrypted: "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment