Serverless on AWS
Author: Tran Tuan Quy
Date: Aug 17, 2019
Updated: Feb 26, 2023
About Me
-
Full Stack JavaScript Developer
-
I have worked for Pyramid Consulting, NAU Studio
-
I have worked for Fram^
-
Now I am at Shopback
Contact Me
-
Twitter: #tuanquynet
-
Github: https://github.com/tuanquynet/
-
Gmail: tuanquynet
Infrastructure as a Service
(IaaS)
Platform as a Service
(PaaS)
Azure App Service
Container as a Services
(CaaS)
Azure Kubernetes Service
Function as a Service
(FaaS)
Software as a Service (SaaS)
-
gdrive, onedrive
-
github.com, gitlab.com, bitbucket.org
-
salesforce.com, bitrix24.com, zoho.com
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
Enhance Cold Start Using Provisioned Concurrency
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
Reuse exist lambda using AWS Serverless Application Repository
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
Demo
Bear in mind
Use the right tool for the right job
Reference Document
Questions
Thank You!
serverless-on-aws
By Quy Tran
serverless-on-aws
- 1,165