Skip to content

mooreniemi/aws-micro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-micro

An extremely simple demo project showing an APIGateway -> Lambda -> SNS -> Lambda -> RDS pipeline, largely following this tutorial on AWS.

Microservice frameworks often use brokers to achieve async communication between microservices. On AWS, we can use SNS as our broker. In this demo, a client can POST a message to our API. A lambda function (snsProducer) then publishes a message on a topic (keyed by an ARN) on SNS. Another lambda (snsConsumer) is subscribed to the topic, and pulls the message off to be saved into a relational database.

arch

                  API Gateway
                     +
                     |  VPC
client               | +-------------------------------------------------------+
+----------------+   | | +--------------+  +--------------+  +---------------+ |
|                |   | | |snsProducer   |  |snsConsumer   |  |RDS            | |
|                |   | | |              |  |              |  |               | |
|          +--------------->            |  |              |  |               | |
|                |   | | |        +     |  |      ^    +------------>        | |
|         <---------------+       |     |  |      |       |  |               | |
|                |   | | |        |     |  |      |    <-----------+         | |
|                |   | | |        |     |  |      |       |  |               | |
|                |   | | |        |     |  |      |       |  |               | |
+----------------+   | | +--------------+  +--------------+  +---------------+ |
                     | +-------------------------------------------------------+
                     |   +--------------------------------+
                     +   |SNS     |               |       |
                         |        v               +       |
                         |                                |
                         |                                |
                         +--------------------------------+

setup

Stuff you want to customize from my setup is consolidated into awsConstants.js.

Stuff we'll need to setup on AWS:

Stuff we'll need to setup locally:

  • awscli
  • aws credentials via aws --configure using credentials from user setup
  • node-lambda
  • npm install in snsConsumer and snsProducer directories
  • RDS credentials (environment vars) and SNS topic ARN (awsConstants.js)

usage

To hit the endpoint, you can use ./snsProducer/bin/test.sh from the project root.

About

:bowtie: simple demo of apigateway -> lambda -> sns -> lambda -> rds pipeline

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published