GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - localstack-samples/localstack-pro-samples: Sample projects to demonstrate advanced LocalStack features

BranchesTags
Open more actions menu

Latest commit

 

History

288 Commits
288 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
apigw-custom-domain
apigw-custom-domain
 
 
appsync-graphql-api
appsync-graphql-api
 
 
athena-s3-queries
athena-s3-queries
 
 
cdk-resources
cdk-resources
 
 
chalice-rest-api
chalice-rest-api
 
 
cloudwatch-metrics-aws
cloudwatch-metrics-aws
 
 
codecommit-git-repo
codecommit-git-repo
 
 
cognito-jwt
cognito-jwt
 
 
ec2-docker-instances
ec2-docker-instances
 
 
ecs-ecr-container-app
ecs-ecr-container-app
 
 
elb-load-balancing
elb-load-balancing
 
 
emr-serverless-python-dependencies
emr-serverless-python-dependencies
 
 
emr-serverless-sample
emr-serverless-sample
 
 
emr-serverless-spark
emr-serverless-spark
 
 
glacier-s3-select
glacier-s3-select
 
 
glue-etl-jobs
glue-etl-jobs
 
 
glue-msk-schema-registry
glue-msk-schema-registry
 
 
glue-redshift-crawler
glue-redshift-crawler
 
 
iam-policy-enforcement
iam-policy-enforcement
 
 
iot-basics
iot-basics
 
 
java-notification-app
java-notification-app
 
 
lambda-container-image
lambda-container-image
 
 
lambda-debugging-sam-java
lambda-debugging-sam-java
 
 
lambda-debugging-sam-javascript
lambda-debugging-sam-javascript
 
 
lambda-debugging-sam-python
lambda-debugging-sam-python
 
 
lambda-debugging-sam-typescript
lambda-debugging-sam-typescript
 
 
lambda-event-filtering
lambda-event-filtering
 
 
lambda-function-urls-javascript
lambda-function-urls-javascript
 
 
lambda-function-urls-python
lambda-function-urls-python
 
 
lambda-hot-reloading
lambda-hot-reloading
 
 
lambda-php-bref-cdk-app
lambda-php-bref-cdk-app
 
 
lambda-xray
lambda-xray
 
 
mq-broker
mq-broker
 
 
multi-account-multi-region-s3-access
multi-account-multi-region-s3-access
 
 
neptune-graph-db
neptune-graph-db
 
 
rds-db-queries
rds-db-queries
 
 
rds-failover-test
rds-failover-test
 
 
reproducible-ml
reproducible-ml
 
 
route53-dns-failover
route53-dns-failover
 
 
sagemaker-inference
sagemaker-inference
 
 
sample-archive
sample-archive
 
 
serverless-lambda-layers
serverless-lambda-layers
 
 
serverless-websockets
serverless-websockets
 
 
stepfunctions-lambda
stepfunctions-lambda
 
 
terraform-resources
terraform-resources
 
 
testcontainers-java-sample
testcontainers-java-sample
 
 
transfer-ftp-s3
transfer-ftp-s3
 
 
.gitignore
.gitignore
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
assert
assert
 
 
make-for-each.sh
make-for-each.sh
 
 

Repository files navigation

LocalStack Pro Samples

Run tests for all samples

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

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

  • Docker
  • awslocal CLI
  • Serverless
  • Terraform
  • make & jq

Configuration

All samples require a valid LocalStack for AWS license. Your license provides a LOCALSTACK_AUTH_TOKEN to activate LocalStack. Set it before running any sample:

export LOCALSTACK_AUTH_TOKEN=<your-auth-token>

Alternatively, use the LocalStack CLI to persist the token:

localstack auth set-token <your-auth-token>

You can find your Auth Token on the LocalStack Web Application.

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
RDS Failover Test Running a failover test against an RDS global cluster
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
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 Debugging SAM Java Debugging Java Lambda functions using AWS SAM
Lambda Debugging SAM JavaScript Debugging JavaScript Lambda functions using AWS SAM
Lambda Debugging SAM Python Debugging Python Lambda functions using AWS SAM
Lambda Debugging SAM TypeScript Debugging TypeScript Lambda functions using AWS SAM
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 (JavaScript) Invoking Lambda functions via HTTP(S) URLs using JavaScript
Lambda Function URLs (Python) Invoking Lambda functions via HTTP(S) URLs using Python
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
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
Step Functions with Lambda Orchestrating Lambda functions using AWS Step Functions
Multi-Account S3 Access Accessing S3 resources across different AWS accounts and regions
Route53 DNS Failover Route53 DNS failover based on health checks
EMR Serverless Sample Running EMR Serverless jobs locally
EMR Serverless Spark Running Java Spark jobs on EMR Serverless
EMR Serverless Python Dependencies Adding Python dependencies to EMR Serverless PySpark jobs
Testcontainers Java Sample Using LocalStack Testcontainers with RDS in Java

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
        @test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Get your auth token at https://localstack.cloud/pricing."; exit 1)
        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

About

Sample projects to demonstrate advanced LocalStack features

Topics

awshacktoberfestinfrastructure-as-codelocalstacksamples

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

195 stars

Watchers

16 watching

Forks

64 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.