LocalStack
This page provides an introduction to LocalStack.
Overview
LocalStack is complete, localized AWS environment where developers can build, test, profile and debug infrastructure and code ahead of deployment to the cloud.
Install LocalStack
# pull localstack image
docker pull localstack/localstack
# or install using brew
brew install localstack/tap/localstack-cli
Start LocalStack
# you can start localstack using localstack command
localstack start -d
# or you can use docker command
docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack
Check LocalStack Status
localstack status
# o/p:
# ┌─────────────────┬───────────────────────────────────────────────────────┐
# │ Runtime version │ 3.8.2.dev86 │
# │ Docker image │ tag: latest, id: 42ba78de23d4, 📆 2024-11-06T12:39:20 │
# │ Runtime status │ ✔ running (name: "localstack-main", IP: 172.17.0.2) │
# └─────────────────┴───────────────────────────────────────────────────────┘
Create S3 Bucket in LocalStack
aws --endpoint-url=http://localhost:4566 s3 mb s3://my-bucket
# o/p:
# make_bucket: my-bucket
List S3 Bucket in LocalStack
aws --endpoint-url=http://localhost:4566 s3 ls
# o/p:
# 2024-10-01 20:45:08 my-bucket
Stop LocalStack
localstack stop
# o/p:
# container stopped: localstack-main