Skip to content
 
 

Repository files navigation

LocalStack Pro Samples

License: Apache 2.0 LocalStack Pro AWS CI

This repository contains sample applications demonstrating LocalStack Pro features for AWS service emulation. Each sample showcases real-world AWS patterns that can be developed and tested locally using LocalStack.

Prerequisites

Required Tools

  • Docker - Container runtime for LocalStack
  • AWS CLI - AWS command line interface
  • awslocal - LocalStack wrapper for AWS CLI
  • jq - JSON processor for parsing outputs

Infrastructure as Code

Development Tools

Samples

Sample Language IaC Methods Tests Notes
lambda-function-urls python scripts, terraform, cloudformation, cdk tests
lambda-function-urls javascript scripts, terraform, cloudformation, cdk tests
stepfunctions-lambda python scripts, terraform, cloudformation, cdk tests
web-app-dynamodb python scripts, terraform, cloudformation, cdk tests
lambda-s3-http python scripts, terraform, cloudformation, cdk tests
lambda-cloudfront python scripts, terraform, cloudformation, cdk tests
web-app-rds python scripts, terraform, cloudformation, cdk tests
apigw-custom-domain python scripts, terraform, cloudformation, cdk tests
ecs-ecr-app python scripts, terraform, cloudformation, cdk tests
lambda-container-image python scripts, terraform, cloudformation, cdk tests
apigw-websockets javascript scripts, terraform, cloudformation, cdk tests
lambda-layers javascript scripts, terraform, cloudformation, cdk tests
lambda-event-filtering javascript scripts, terraform, cloudformation, cdk tests
lambda-xray python scripts, terraform, cloudformation, cdk tests
codecommit-git-repo python scripts, terraform tests CloudFormation/CDK unsupported
iot-basics python scripts, terraform, cloudformation, cdk tests 1 test skipped (MQTT endpoint)
athena-s3-queries python scripts, terraform, cloudformation, cdk tests Requires Hadoop download
mq-broker python scripts, terraform, cloudformation, cdk tests Requires JDK/ActiveMQ download
transfer-ftp-s3 python scripts tests Terraform/CloudFormation/CDK unsupported
glacier-s3-select python scripts tests Terraform/CloudFormation/CDK unsupported
rds-db-queries python scripts tests Requires PostgreSQL download
rds-failover-test python scripts tests Terraform/CloudFormation/CDK unsupported
neptune-graph-db python scripts tests Requires Java/TinkerGraph download
iam-policy-enforcement python scripts tests Requires ENFORCE_IAM=1
ec2-docker-instances python scripts tests Requires EC2_VM_MANAGER=docker
cloudwatch-metrics-aws python scripts tests Email requires SMTP
cognito-jwt python scripts tests Email verification requires SMTP
chalice-rest-api python scripts tests Requires chalice-local
elb-load-balancing javascript scripts tests ALB with Lambda targets

Sample Structure

Each sample follows a consistent organization:

samples/{sample-name}/
├── {language}/                 # python, javascript, etc.
│   ├── README.md              # Sample documentation
│   ├── scripts/               # Deployment and test scripts
│   │   ├── deploy.sh          # Primary deployment script
│   │   ├── validate.sh        # Resource validation
│   │   └── test.sh            # Functional tests
│   ├── terraform/             # Terraform configuration (optional)
│   │   ├── main.tf
│   │   ├── providers.tf
│   │   ├── variables.tf
│   │   └── outputs.tf
│   ├── sam/                   # SAM template (optional)
│   │   └── template.yaml
│   └── src/                   # Application source code

Local Testing

Quick Start

  1. Start LocalStack Pro:
export LOCALSTACK_AUTH_TOKEN=your-auth-token
docker run -d --name localstack \
  -p 4566:4566 \
  -e LOCALSTACK_AUTH_TOKEN \
  -v /var/run/docker.sock:/var/run/docker.sock \
  localstack/localstack-pro
  1. Run all tests:
./run-samples.sh
  1. Run a specific sample:
./run-samples.sh SHARD=1 SPLITS=5

Using Make

make install    # Install dependencies
make test       # Run all tests
make logs       # Show LocalStack logs

Troubleshooting

Line Ending Issues

If scripts fail with \r errors on Windows/WSL:

git config core.autocrlf false
git checkout -- .

LocalStack Connection

Verify LocalStack is running:

curl http://localhost:4566/_localstack/health

Configuration

See docs/LOCALSTACK.md for detailed LocalStack configuration options.

Documentation

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-sample
  3. Make your changes following the sample structure conventions
  4. Test locally with LocalStack
  5. Submit a pull request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Support

About

Sample projects to demonstrate advanced LocalStack features

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages