• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language Makefile
  • Created over 6 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sample projects to demonstrate advanced LocalStack features

LocalStack Pro Samples

This repository contains sample projects that can be deployed on your local machine using LocalStack Pro.

Each example in the repository is prefixed with the name of the AWS service being used. For example, the elb-load-balancing directory contains examples that demonstrate how to use the Elastic Load Balancing service with LocalStack. Please refer to the sub directories for more details and instructions on how to start the samples.

Prerequisites

Configuration

Some of the samples require LocalStack Pro features. Please make sure to properly configure the LOCALSTACK_API_KEY environment variable. You can find your API key in the LocalStack Pro dashboard and you can refer to our API key documentation for more details.

Outline

Sample Name Description
Serverless Websockets API Gateway V2 websocket APIs deployed via the Serverless framework
RDS Database Queries Running queries locally against an RDS database
Neptune Graph Database Running queries locally against a Neptune Graph database
Lambda Event Filtering Lambda event source filtering with DynamoDB and SQS
Glacier & S3 select queries Using Glacier API and running S3 Select queries locally
Cloudwatch Metrics alarm Triggering a Cloudwatch metrics alarm based on a failing Lambda
EC2 with Docker backend Running EC2 instances with Docker backend
QLDB ledger queries Running queries locally against a QLDB ledger
Cognito with JWT Running Cognito authentication and user pools locally
Transfer API with S3 Using the Transfer API to upload files to S3
Codecommit with Git repository Using the Codecommit API to create and push to a Git repository
Lambda Mounting and Debugging Debugging Lambda functions locally
IAM Policy Enforcement Enforcement of IAM policies when working with local cloud APIs
Lambda Hot Reloading Hot reloading Lambda functions locally
IoT Basics Usage of IoT APIs locally
REST API using Chalice Deploying a REST API using the Chalice framework
ECS ECR Container application Pushing Docker images to ECR and running them locally on ECS
Athena queries over S3 Running Athena queries over S3 files locally
Terraform resources Deploying various AWS resources via Terraform
Lambda Function URLs Invoking Lambda functions via HTTP(s) URLs
Sagemaker inference Creating & invoking a Sagemaker endpoint locally with MNIST dataset
MSK with Glue Schema Registry Use of MSK, Glue Schema Registry, Glue ETL, and RDS
AppSync GraphQL Deploying a GraphQL API using AppSync
Lambda XRay tracing Using Lambda XRay tracing locally
Mediastore Uploads Using MediaStore API locally
Serverless Lambda Layers Using Lambda layers locally deployed via the Serverless framework
Java Notification App Notification app using AWS Java SDK, SNS, SQS, SES, deployed via CloudFormation
Lambda Container images Deploying Lambda functions as container images
Glue crawler with RedShift Glue Crawler to populate the Glue metadata store with the table schema of RedShift database tables
API Gateway custom domain Using API Gateway v2 endpoints using custom domain names, deployed via the Serverless framework
CDK resources Deploying various AWS resources via CDK
Glue for ETL jobs Using Glue API to run local ETL jobs
Message Queue broker Using MQ API to run local message queue brokers
ELB Load Balancing Using ELBv2 Application Load Balancers locally, deployed via the Serverless framework
Reproducible ML Train, save and evaluate a scikit-learn machine learning model using AWS Lambda and S3
Lambda PHP/Bref CDK App Running PHP/Bref Lambda handler locally, deployed via AWS CDK

Checking out a single sample

To check out a single sample, you can use the following commands:

mkdir localstack-samples && cd localstack-samples
git init
git remote add origin -f [email protected]:localstack/localstack-pro-samples.git
git config core.sparseCheckout true
echo <LOCALSTACK_SAMPLE_DIRECTORY_NAME> >> .git/info/sparse-checkout
git pull origin master

The above commands use sparse-checkout to only pull the sample you are interested in. You can find the name of the sample directory in the table above.

Developer Notes

Makefiles for samples

All samples should have a Makefile to unify the execution of the otherwise heterogeneous samples. It needs to fulfill two criteria:

  • The sample should be executable independently, since it can be checked out on its own (see Checking out a single sample).
  • It should contain a test-ci target to be executed automatically within the CI pipeline. This step needs to take care of all infrastructure tasks (starting/stopping/logs/etc) in addition to any sample commands executed.

A typical Makefile looks like this:

export AWS_ACCESS_KEY_ID ?= test
export AWS_SECRET_ACCESS_KEY ?= test
export AWS_DEFAULT_REGION=us-east-1
SHELL := /bin/bash

usage:       ## Show this help
        @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

install:     ## Install dependencies
        @which localstack || pip install localstack
        @which awslocal || pip install awscli-local
        ## install whatever else you need, like node modules, python packages, etc.
        @test -e node_modules || npm install
        @test -e .venv || (python3 -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt)

run:         ## Run the actual sample steps/commands. This assumes LocalStack is up and running.
        ./run.sh

start:       ## Start LocalStack in detached mode
        localstack start -d

stop:        ## Stop the Running LocalStack container
        @echo
        localstack stop

ready:       ## Make sure the LocalStack container is up
        @echo Waiting on the LocalStack container...
        @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)

logs:        ## Save the logs in a separate file, since the LS container will only contain the logs of the last sample run.
        @localstack logs > logs.txt

test-ci:     ## Execute the necessary targets in the correct order for an automatic execution. 
        make start install ready run; return_code=`echo $$?`;\
        make logs; make stop; exit $$return_code;

.PHONY: usage install run start stop ready logs test-ci

More Repositories

1

localstack

💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
Python
53,666
star
2

awscli-local

💲 "awslocal" - Thin wrapper around the "aws" command line interface for use with LocalStack
Python
1,047
star
3

serverless-localstack

⚡ Serverless plugin for running against LocalStack
JavaScript
515
star
4

aws-cdk-local

Thin wrapper script for using the AWS CDK CLI with LocalStack
JavaScript
261
star
5

terraform-local

Terraform CLI wrapper to deploy your Terraform applications directly to LocalStack
Python
181
star
6

localstack-python-client

🐍 A lightweight Python client for LocalStack
Python
174
star
7

localstack-java-utils

☕ Java utilities and JUnit integration for LocalStack
Java
75
star
8

pulumi-local

Thin wrapper script to use Pulumi with LocalStack
Python
71
star
9

plux

A dynamic code loading framework for building pluggable Python distributions
Python
71
star
10

localstack-terraform-samples

Repository with terraform samples for LocalStack
HCL
66
star
11

localstack-demo

Simple demo application deployed using LocalStack
Makefile
61
star
12

docs

The LocalStack documentation 📖
HTML
60
star
13

helm-charts

Helm Charts for LocalStack
Smarty
57
star
14

aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Python
52
star
15

localstack-docker-extension

Simple Docker Extension to control and manage your LocalStack instance
TypeScript
39
star
16

localstack-extensions

🧩 Extend and customize LocalStack with LocalStack Extensions (beta)
Python
35
star
17

awesome-localstack

A curated list of LocalStack integrations, tools, frameworks, and platforms.
27
star
18

setup-localstack

Sets up LocalStack CLI in your GitHub Actions workflow ☁️
25
star
19

localstack-terraform-test

Utilities to run Terraform tests against LocalStack
Python
24
star
20

chalice-local

Small wrapper script to use AWS Chalice with LocalStack
Python
21
star
21

verdin

A Tinybird SDK for Python 🐦
Python
21
star
22

amplify-js-local

Simple wrapper script to allow using the Amplify JS SDK with LocalStack
JavaScript
19
star
23

serverless-python-rest-api-with-dynamodb

Serverless CRUD service exposing a REST HTTP interface integrated with LocalStack
Python
18
star
24

cockpit

LocalStack Cockpit Desktop application
17
star
25

localstack-on-k8s

Sample repository that illustrates running LocalStack on Kubernetes
Python
16
star
26

localstack-desktop

The official LocalStack Desktop Application
16
star
27

localstack-workshop

Repository with code samples for the LocalStack workshop
JavaScript
14
star
28

localstack.github.io

LocalStack website
HTML
12
star
29

localstack-cli

The LocalStack CLI packaged using pyinstaller
Makefile
12
star
30

localstack-vscode-extension

LocalStack VSCode Extension: Deploy Lambda functions to LocalStack
TypeScript
12
star
31

azure-cli-local

[unmaintained] Simple wrapper script to use Azure CLI with LocalStack
Python
11
star
32

presentations

Presentations, talks, and demos about LocalStack
HCL
10
star
33

rolo

A Python framework for building HTTP-based server applications
Python
10
star
34

localstack-github-actions-login

GitHub Action to log-in into your LocalStack account on your GitHub Actions runners
JavaScript
9
star
35

localstack-aws-sdk-examples

Test repo with sample apps & tests for various different languages/SDKs using LocalStack
Java
8
star
36

appsync-utils

Implementation of AppSync JavaScript utilities
JavaScript
8
star
37

localstack-artifacts

Miscellaneous build artifacts for the LocalStack platform
Java
7
star
38

serverless-streaming-data-pipeline

A serverless streaming data pipeline running on LocalStack
Python
7
star
39

cloud-pods

Sample repository illustrating Cloud Pods for LocalStack
JavaScript
7
star
40

local-surf

🏄 LocalSurf - a browser plugin to redirect AWS service calls to LocalStack
JavaScript
6
star
41

serverless-api-ecs-apigateway-sample

Serverless Container-based APIs with Amazon ECS and Amazon API Gateway deployed using LocalStack
HCL
6
star
42

localstack-moto-test-coverage

Repo to run moto integration tests against LocalStack for moto-fallback coverage
Python
6
star
43

ci-plugin-circleci

CircleCI Plugin (Orb) for easy configuration of LocalStack CI builds
Shell
5
star
44

localstack-plugin-loader

The dynamic code loading framework used in LocalStack
Python
5
star
45

architect-local

Architect CLI (arc.codes) for use with LocalStack
JavaScript
5
star
46

mnist-sagemaker

Demo to run the MNIST handwritten digit model on a locally running SageMaker endpoint
JavaScript
5
star
47

awslamba-go-runtime

Custom Golang runtime for the execution of AWS Lambdas
Go
5
star
48

.github

Community health files for the @localstack organization
5
star
49

localstack-pulumi-samples

Sample Pulumi projects to demonstrate LocalStack features
Python
4
star
50

localstack-stripe

Use the Stripe API in LocalStack
Python
4
star
51

amplify-localstack

Amplify Plugin to deploy resources into Localstack
JavaScript
4
star
52

snowflake-docs

Private repo for LocalStack's Snowflake emulator docs
HTML
4
star
53

homebrew-tap

Ruby
4
star
54

tinybird-workflow-push

Push Github Workflow data to tinybird
TypeScript
4
star
55

devops-barcelona-2022

LocalStack @ DevOps Bareclona 2022
Python
3
star
56

localstack-python-utils

Localstack utility for tests
Python
3
star
57

branding

Repository with various LocalStack branding assets
3
star
58

localstack-docker-debug

Python
3
star
59

pre-commit-hooks

Pre commit hooks for LocalStack repositories
Python
3
star
60

localstack-snapshot

Extracted snapshot testing library for LocalStack
Python
3
star
61

serverless-image-resizer

Serverless Image Resizer demo app for LocalStack
Python
2
star
62

cloud-pod-badge

2
star
63

appsync-graphql-api-sample

Proxy data from different resources such as DynamoDB tables & RDS databases using AppSync GraphQL APIs deployed using Serverless Framework on LocalStack
Shell
2
star
64

meta

Tooling to manage repos in the localstack org
2
star
65

localstack-dev-spaces

Sample repo for running LocalStack in Redhat Openshift Dev Spaces
Dockerfile
2
star
66

devcontainer-feature

LocalStack DevContainer Feature(s)
Shell
2
star
67

aws-java-sdk-v2-trust-certs-patch

A small java agent to patch the AWS Java SDK v2 to disable certificate name validation.
Java
1
star
68

localstack-blog.github.io

LocalStack blog
HTML
1
star
69

troubleshooting-issues

Repository of samples to reproduce localstack issues
Python
1
star
70

loan-broker-stepfunctions-lambda-app

TypeScript
1
star
71

shipyard-localstack-flask

a starter Flask project, integrated with Localstack and Shipyard
Python
1
star
72

reinvent-challenge

Repository for re:Invent "scavenger hunt" using LocalStack
Shell
1
star
73

azure-functions-local

Small wrapper script to use Azure Functions core tools with LocalStack
1
star