An open API service indexing awesome lists of open source software.

https://github.com/kenyipp/serverless-sns-sqs-offline-example

Minimal example of running serverless-offline with SQS and SNS in local environment.
https://github.com/kenyipp/serverless-sns-sqs-offline-example

amazon-lambda amazon-sqs elasticmq lambda serverless serverless-offline sns sqs

Last synced: 11 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Serverless SNS SQS offline Example

A [Serverless](https://serverless.com/) 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](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_profiles.html) 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](https://github.com/softwaremill/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.

```sh
cd ./elasticMQ
docker-compose up -d
```

### Development

```sh
npm install
NODE_ENV=development serverless offline start
```

### Deploy

```sh
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](https://github.com/serverless-heaven/serverless-webpack/issues/274).

## License

This software is released under the MIT license. See the [license file](LICENSE) for more details.