• Stars
    star
    243
  • Rank 162,420 (Top 4 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

Thin wrapper script for using the AWS CDK CLI with LocalStack

Integration Tests

AWS Cloud Development Kit (CDK) for LocalStack

This project provides a thin wrapper script cdklocal for using the AWS CDK library against local APIs provided by LocalStack.

Note: This project replaces the old (deprecated) repo which was a fork of the AWS CDK repo. Instead of forking the repo and applying changes, we now simply provide a simple wrapper script cdklocal which applies runtime patching. The advantage of the new approach is that you should be able to use arbitrary CDK versions under the cover.

Quick Installation

The cdklocal command line is published as an npm library:

$ npm install -g aws-cdk-local aws-cdk
...
$ cdklocal --version
1.65.5

Note: Starting with version 1.65.2, the dependency aws-cdk needs to be installed manually (to decouple the two libraries, and allow using arbitrary versions of aws-cdk under the covers).

(Note: Depending on your local setup, you may or may not have to use the global npm installation flag -g above.)

Configurations

The following environment variables can be configured:

  • AWS_ENDPOINT_URL: The endpoint URL to connect to (combination of USE_SSL/LOCALSTACK_HOSTNAME/EDGE_PORT below)
  • EDGE_PORT (deprecated): Port under which LocalStack edge service is accessible (default: 4566)
  • LOCALSTACK_HOSTNAME (deprecated): Target host under which LocalStack edge service is accessible (default: localhost)
  • USE_SSL (deprecated): Whether to use SSL to connect to the LocalStack endpoint, i.e., connect via HTTPS.
  • LAMBDA_MOUNT_CODE: Whether to use local Lambda code mounting (via setting __local__ S3 bucket name). Note: may require CDK version <2.14.0 to be fully functional.
  • BUCKET_MARKER_LOCAL: Magic S3 bucket name for Lambda mount and hot reloading (default: __local__, will default to hot-reload in a future release)

Deploying a Sample App

The CDK command line ships with a sample app generator to run a quick test for getting started:

$ mkdir /tmp/test; cd /tmp/test
$ cdklocal init sample-app --language=javascript
...

Make sure that LocalStack is installed and started up with the required services:

$ SERVICES=serverless,sqs,sns localstack start

Then deploy the sample app against the local APIs via the cdklocal command line:

$ cdklocal deploy
...
Do you wish to deploy these changes (y/n)? y
...
Stack ARN:
arn:aws:cloudformation:us-east-1:000000000000:stack/TestStack/e3debc0a-311e-4968-8230-ed78f89cb614

Once the deployment is done, you can inspect the created resources via the awslocal command line:

$ awslocal sns list-topics
{
    "Topics": [
        {
            "TopicArn": "arn:aws:sns:us-east-1:000000000000:TestStack-TestTopic339EC197-79F43WWCCS4Z"
        }
    ]
}

Change Log

  • 2.18.0: Add support for AWS_ENDPOINT_URL, USE_SSL, and BUCKET_MARKER_LOCAL configurations
  • 2.17.0: Fix IPv4 fallback check to prevent IPv6 connection issue with localhost on macOS
  • 2.16.0: Add check to prevent IPv6 connection issue with localhost on MacOS
  • 2.15.0: Fix issue with undefined BUCKET_NAME_OUTPUT variable; add CI build and eslint config
  • 2.14.0: Add switches in patches to accommodate new esbuild packaging mechanism in CDK v2.14.0+
  • 1.65.7: Add switch that checks for asset existence before symlinking assets; fix parsing fetched template body for JSON/YAML formats; add missing dependency to "diff" package
  • 1.65.6: Create symlinks to Lambda assets to enable persistent code mounting of Lambdas on "cdklocal synth"
  • 1.65.5: Add support for LAMBDA_MOUNT_CODE config to enable local Lambda code mounting
  • 1.65.4: Add support for large stacks by patching bucketUrl for ToolkitInfo
  • 1.65.2: Patch missing getPromise() in forceCredentialRetrieval; remove aws-cdk from npm dependencies
  • 1.65.1: Override BucketURL to use path style addressing
  • 1.65.0: Initial release

License

The AWS CDK is distributed under the Apache License, Version 2.0.

More Repositories

1

localstack

πŸ’» A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
Python
51,683
star
2

awscli-local

πŸ’² "awslocal" - Thin wrapper around the "aws" command line interface for use with LocalStack
Python
1,012
star
3

serverless-localstack

⚑ Serverless plugin for running against LocalStack
JavaScript
508
star
4

localstack-python-client

🐍 A lightweight Python client for LocalStack
Python
171
star
5

terraform-local

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

localstack-pro-samples

Sample projects to demonstrate advanced LocalStack features
Makefile
153
star
7

localstack-java-utils

β˜• Java utilities and JUnit integration for LocalStack
Java
77
star
8

plux

A dynamic code loading framework for building pluggable Python distributions
Python
69
star
9

pulumi-local

Thin wrapper script to use Pulumi with LocalStack
Python
68
star
10

localstack-terraform-samples

Repository with terraform samples for LocalStack
HCL
66
star
11

localstack-demo

Simple demo application deployed using LocalStack
Makefile
57
star
12

helm-charts

Helm Charts for LocalStack
Smarty
49
star
13

docs

The LocalStack documentation πŸ“–
HTML
48
star
14

aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Python
41
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
31
star
17

localstack-terraform-test

Utilities to run Terraform tests against LocalStack
Python
24
star
18

chalice-local

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

verdin

A Tinybird SDK for Python 🐦
Python
20
star
20

awesome-localstack

A curated list of LocalStack integrations, tools, frameworks, and platforms.
20
star
21

setup-localstack

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

amplify-js-local

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

cockpit

LocalStack Cockpit Desktop application
18
star
24

serverless-python-rest-api-with-dynamodb

Serverless CRUD service exposing a REST HTTP interface integrated with LocalStack
Python
16
star
25

localstack-on-k8s

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

localstack-desktop

The official LocalStack Desktop Application
14
star
27

localstack-workshop

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

localstack.github.io

LocalStack website
HTML
12
star
29

localstack-vscode-extension

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

localstack-cli

The LocalStack CLI packaged using pyinstaller
Makefile
10
star
31

azure-cli-local

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

presentations

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

localstack-github-actions-login

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

rolo

A Python framework for building HTTP-based server applications
Python
9
star
35

localstack-aws-sdk-examples

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

cloud-pods

Sample repository illustrating Cloud Pods for LocalStack
JavaScript
7
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

serverless-api-ecs-apigateway-sample

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

localstack-moto-test-coverage

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

ci-plugin-circleci

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

localstack-plugin-loader

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

architect-local

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

mnist-sagemaker

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

awslamba-go-runtime

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

.github

Community health files for the @localstack organization
5
star
47

localstack-pulumi-samples

Sample Pulumi projects to demonstrate LocalStack features
Python
4
star
48

localstack-stripe

Use the Stripe API in LocalStack
Python
4
star
49

local-surf

πŸ„ LocalSurf - a browser plugin to redirect AWS service calls to LocalStack
JavaScript
4
star
50

amplify-localstack

Amplify Plugin to deploy resources into Localstack
JavaScript
4
star
51

appsync-utils

Implementation of AppSync JavaScript utilities
JavaScript
4
star
52

tinybird-workflow-push

Push Github Workflow data to tinybird
TypeScript
4
star
53

devops-barcelona-2022

LocalStack @ DevOps Bareclona 2022
Python
3
star
54

branding

Repository with various LocalStack branding assets
3
star
55

localstack-docker-debug

Python
3
star
56

homebrew-tap

Ruby
3
star
57

pre-commit-hooks

Pre commit hooks for LocalStack repositories
Python
3
star
58

localstack-snapshot

Extracted snapshot testing library for LocalStack
Python
3
star
59

serverless-image-resizer

Serverless Image Resizer demo app for LocalStack
Python
2
star
60

localstack-python-utils

Localstack utility for tests
Python
2
star
61

lambda-runtime-init

Go
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

localstack-dev-spaces

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

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
66

localstack-blog.github.io

LocalStack blog
HTML
1
star
67

loan-broker-stepfunctions-lambda-app

TypeScript
1
star
68

shipyard-localstack-flask

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

troubleshooting-issues

Repository of samples to reproduce localstack issues
Python
1
star
70

meta

Tooling to manage repos in the localstack org
1
star
71

reinvent-challenge

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

azure-functions-local

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