npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-offline-localstack

v0.0.3

Published

A serverless plugin to redirected AWS requests to a running Localstack instance.

Downloads

3,131

Readme

serverless-offline-localstack

Serverless Plugin to support running against Localstack.

This plugin allows any requests to AWS to be redirected to a running Localstack instance. It also supports a poller to consume messages off of a Kinesis stream.

WARNING: This plugin is very much a WIP

Pre-requisites:

Installation

The easiest way to get started is to install via npm.

npm install --save-dev serverless-offline-localstack

Configuring Serverless

There are two ways to configure the plugin, via a JSON file or via serverless.yml. There are two supported methods for configuring the endpoints, globally via the "host" property, or individually. These properties may be mixed, allowing for global override support while also override specific endpoints.

A "host" or individual endpoints must be configured or this plugin will be deactivated.

Configuring endpoints via serverless.yml

service: myService

plugins:
  - serverless-offline-localstack

custom:
  serverlessOfflineLocalstack:
    host: http://localhost
    kinesis:
      enabled: true
      intervalMillis: 5000
    endpoints:
      S3: http://localhost:4572
      DynamoDB: http://localhost:4570
      CloudFormation: http://localhost:4581
      Elasticsearch: http://localhost:4571
      ES: http://localhost:4578
      SNS: http://localhost:4575
      SQS: http://localhost:4576
      Lambda: http://localhost:4574
      Kinesis: http://localhost:4568

Configuring endpoints via JSON

service: myService

plugins:
  - serverless-offline-localstack

custom:
  serverlessOfflineLocalstack:
    kinesis:
      enabled: true
      intervalMillis: 5000
    endpointFile: path/to/file.json

Configuring the AWS SDK

To configure the AWS SDK with these endpoints, use the following as soon as possible in your entry point

const AWS = require('aws-sdk');
const ServerlessOfflineLocalstack = require('serverless-offline-localstack');
ServerlessOfflineLocalstack.configureAWS(AWS);

Localstack

For full documentation, see https://github.com/localstack/localstack

Installing via PIP

The easiest way to get started with Localstack is to install it via Python's pip.

pip install localstack

Running Localstack

There are multiple ways to run Localstack.

Starting Localstack via Docker

If Localstack is installed via pip

localstack start --docker

Starting Localstack without Docker

If Localstack is installed via pip

localstack start

Optional Debug Flag

An optional debug flag is supported via serverless.yml that will enable additional debug logs.

custom:
  serverlessOfflineLocalstack:
    debug: true

The following projects were used as a guideline and their license should be followed as well:

  • https://github.com/temyers/serverless-localstack
  • https://github.com/DopplerLabs/serverless-plugin-offline-kinesis-events