Dev Nightmares: LocalStack Guide
Step 1: The Docker-Compose File
Create a folder, open a terminal, and create [Link] with this content:
version: '3.8'
services:
localstack:
container_name: localstack_main
image: localstack/localstack:latest
ports:
- '[Link]:4566:4566'
- '[Link]:4510-4559:4510-4559'
environment:
- DEBUG=1
- DOCKER_HOST=unix:///var/run/[Link]
volumes:
- '${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack'
- '/var/run/[Link]:/var/run/[Link]'
Step 2: Spin It Up!
Ensure Docker is running and execute:
docker-compose up -d
LocalStack will be available at [Link]
Step 3: Configure Fake Credentials
Run 'aws configure' with these dummy values:
- AWS Access Key ID: test
- AWS Secret Access Key: test
- Default region name: us-east-1
- Default output format: json
Step 4: How to Use It
Dev Nightmares: LocalStack Guide
1. AWS CLI: Use --endpoint-url=[Link]
Example: aws s3 mb s3://my-local-bucket --endpoint-url=[Link]
2. [Link]:
const s3 = new AWS.S3({ endpoint: '[Link] s3ForcePathStyle: true, region: 'us-east-1' });
3. Python (Boto3):
s3 = [Link]('s3', endpoint_url='[Link]
Pro-Tip
Install 'awslocal' via pip to automatically handle endpoint URLs: pip install awscli-local
Usage example: awslocal s3 ls