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:
The easiest way to get started is to install via npm.
npm install --save-dev serverless-offline-localstack
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.
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
service: myService
plugins:
- serverless-offline-localstack
custom:
serverlessOfflineLocalstack:
kinesis:
enabled: true
intervalMillis: 5000
endpointFile: path/to/file.json
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);
For full documentation, see https://github.com/localstack/localstack
The easiest way to get started with Localstack is to install it via Python's pip.
pip install localstack
There are multiple ways to run Localstack.
If Localstack is installed via pip
localstack start --docker
If Localstack is installed via pip
localstack start
An optional debug flag is supported via serverless.yml that will enable additional debug logs.
custom:
serverlessOfflineLocalstack:
debug: true