Skip to content

Minimal example of running serverless-offline with SQS and SNS in local environment.

License

Notifications You must be signed in to change notification settings

kenyipp/serverless-sns-sqs-offline-example

Repository files navigation

Serverless SNS SQS offline Example

A Serverless application that demonstrate the flow of amazon SQS, SNS and lambda.

Architecture

Architecture

Setup

Instead of declare the AWS access key and secret in the serverless.yml, we use the default AWS profile for development and deployment to hide our keys. Fill in your own profile if you are not using the default profile.

We are using ElasticMQ, an in-memory message queue system, with serverless-offline-sqs plugin to simulate the local AWS SQS environment. We have provided a docker-compose file to establish the ElasticMQ service.

cd ./elasticMQ
docker-compose up -d

Development

npm install
NODE_ENV=development serverless offline start

Deploy

npm install
npm run deploy

Run

node script/invoke.js

ToDo List

  • Better Documentation
  • Replace the wildcard on iamRoleStatements in serverless.yml
  • Auth mechanism to prevent API dispose to public
  • Error handling, Amazon SQS Dead-Letter Queues
  • Test cases
  • CICD pipeline

Remark

There may be a bug on serverless-webpack that it isn't work to use webpack.DefinePlugin to declare the environment variable.

License

This software is released under the MIT license. See the license file for more details.

About

Minimal example of running serverless-offline with SQS and SNS in local environment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published