hemerajs / aither

An example microservice system in Node.js using Hemera and best of today.
GNU General Public License v3.0
119 stars 26 forks source link

Hemera in AWS Lambda #4

Closed blanchma closed 6 years ago

blanchma commented 6 years ago

Is possible to implement a Hemera microservice inside an AWS Lambda?

StarpTech commented 6 years ago

Hi @blanchma it should work and the nats connection can be reused on further requests but have in mind that as soon as a lambda container get cold or you deploy a change the container is reinitialized. Here is an overview of best practices. It's really important to deploy your NATS cluster inside a VPC to ensure reliability and security.

Creates a base NATS server, VPC and security groups. https://github.com/nats-io/deploy/tree/master/server/aws

Here you can see an example of how it looks like to reuse a db connection with pq http://blog.rowanudell.com/database-connections-in-lambda/

StarpTech commented 6 years ago

Closing due to inactivity.