NodeJS Based Serverless on AWS
Author: Tran Tuan Quy
Date: Aug 17, 2019
About Me
-
Full Stack JavaScript Developer
-
I have worked for Pyramid Consulting, NAU Studio
-
Now I am here at Fram^
Contact Me
-
Twitter: #tuanquynet
-
Github: https://github.com/tuanquynet/
-
Gmail: tuanquynet
Which Architecture?
Monolithic Architecture
Microservice Architecture
Serverless Architecture
Serverless App Architecture
serverless !== no server
Serverless Computing
Serverless computing (or serverless for short), is an execution model where the cloud provider (AWS, Azure, or Google Cloud) is responsible for executing a piece of code by dynamically allocating the resources. And only charging for the amount of resources used to run the code.
Serverless on AWS
Cold Start and Hot Start
Scale By Request
Lambda Instance
Event
Lambda Instance
Lambda Instance
Lambda Instance
Event
Event
Event
Charge by Execution Time
Lambda Instance
Event
Lambda Instance
Lambda Instance
Lambda Instance
Event
Event
Event
$
$
$
$
How to trigger lambda execution
How to log/monitor lambda?
CloudWatch Logs
CloudWatch Metric
CloudWatch Alarm
Framework
Runtime on AWS
Configuring Memory & Timeout
Configuring Concurrency
Configuring Env Variables
Configuring Network & Security
Configuring Execution Role
Configuring Inline Policy
Pros and Cons
Pros:
-
Pay for execution time
-
Reduce cost of DevOps
-
Faster Release
-
Easy to scale
Cons
-
Reduce overall control
-
Testing locally is tricky
-
Interactive debug is difficult
-
Vendor lock-in
-
Security risk
Best Practices
-
Don't use to UI deployment
-
Handle timeout by ourselves
-
Close DB connection whenever you no longer use
-
Apply VPC to protect lambda from outside access
-
Use inline policy with only mandatory permissions.
Questions
Reference Document
Questions
Thank You!
nodejs-based-serverless-on-aws
By Quy Tran
nodejs-based-serverless-on-aws
- 1,058