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.
- Host: GitHub
- URL: https://github.com/kenyipp/serverless-sns-sqs-offline-example
- Owner: kenyipp
- License: mit
- Created: 2020-02-12T17:44:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-08T14:09:45.000Z (over 3 years ago)
- Last Synced: 2025-04-06T14:11:18.681Z (about 1 year ago)
- Topics: amazon-lambda, amazon-sqs, elasticmq, lambda, serverless, serverless-offline, sns, sqs
- Language: JavaScript
- Size: 2.48 MB
- Stars: 17
- Watchers: 1
- Forks: 9
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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

## 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.