Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
serverless - send email and update status
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Anna Su
March 22, 2019
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
serverless - send email and update status
2019/3/22
@ branch8 公司內部技術分享
Anna Su
March 22, 2019
More Decks by Anna Su
See All by Anna Su
從 Styled System 看下一代 CSS 技術
annasu
2
2.4k
We need a better UI component library - Styled System
annasu
0
6.4k
What’s FullStory?
annasu
0
200
PWA 應用與價值
annasu
0
110
初探 DevOps 的世界
annasu
0
350
Why Redux-Observable?
annasu
0
120
PWA 與 Service Worker
annasu
0
99
2016 PIXNET HACKATHON Lightning talk - 做網站不是只有一個人的事
annasu
0
99
Other Decks in Technology
See All in Technology
AI時代のエンジニアの情報発信〜個人の発信を組織の力に変える〜
ryo_kawamata
0
6.5k
慶應義塾大学 AI実践05 論文執筆の仕組み化
keio_smilab
PRO
3
3.1k
これだけは抑えておきたい!後悔しない re:Invent の過ごし方 / AWS re:Invent 2026 prestudy
kinunori
2
640
生き様としてのSRE
hokkai7go
1
150
リアクションエンジニア ― 小さなリアクションから、話しかけやすい組織をつくる ―
ryuguyana
1
100
SLOを阻む不安
sraku2159
0
200
Don't write the architecture only in the prompt.
neohsu
0
290
Oracle Database Security 詳細解説
oracle4engineer
PRO
1
200
あなたのDartコードは丸見えかもしれない ~reFlutterで暴くFlutterアプリの中身と多層防御~
zozotech
PRO
0
730
20261031_IoTLT_vol140_kitazaki_v1.pdf
kitazaki
0
150
(swiftc) NonCopyableとライフタイム修飾子
teamhimeh
0
160
OneLakeをデータソースにした AI Search(Foundry IQ)の ライフサイクル管理
ryuseiiida
0
220
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.5k
[SF Ruby Conf 2025] Rails X
palkan
3
1.5k
Why Our Code Smells
bkeepers
PRO
340
58k
Accessibility Awareness
sabderemane
1
280
Fireside Chat
paigeccino
43
4.1k
The Curious Case for Waylosing
cassininazir
1
600
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
910
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
550
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
600
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Transcript
Serverless Anna Su Send Email and update status
Why not VM 即使 server 沒有收到任何 request ,還是會被收取費⽤用 必須設定與持續管理理 Server
需要經常更更新 Server,避免安全性問題 當我們使⽤用量量變⼤大時,需要管理理 server 的 scaling up 如果使⽤用量量變低時,也需要 scaling down
Why Serverless ⾃自動擴展 依照使⽤用量量付費 開發速度更更快 零管理理
You don’t have to think about those servers. You just
focus on code.
What’s Serverless Serverless is an execution model where the cloud
provider is responsible for executing a piece of code by dynamically allocating the resources.
What’s Serverless The code is typically run inside stateless containers.
Can be triggered by a variety of events including http requests, database events, monitoring alerts, file uploads, scheduled events, etc
How Serverless Works @aws Upload your code to AWS Lambda
Set up your code to trigger from other AWS services, HTTP endpoints, or in-app activity Lambda runs your code only when triggered, using only the compute resources needed Pay just for the compute time you use
Install Serverless npm install -g serverless
Deploy a Node.js function to AWS Lambda
sls
sls create -t aws-nodejs
brew install awscli
aws configure
module.exports.hello = async (event) => { return { statusCode: 200,
body: JSON.stringify({ message: 'Go Serverless v1.0! Your function executed successfully!', input: event, }), }; }; handler.js
service: aws-nodejs-demo provider: name: aws runtime: nodejs8.10 functions: hello: handler:
handler.hello events: - http: path: / method: get serverless.yml
sls deploy
Serverless Project for Email
HASURA SendGrid AWS Lambda Using
HASURA build GraphQL apps backed by Postgres
HASURA Event trigger
SendGrid email service trusted by developers and marketers
AWS Lambda run code without thinking about servers
Send Email HASURA event trigger webhook Serverless AWS Lambda
Update Email Status notification webhook Serverless AWS Lambda
Email Flow HASURA Realtime Serverless Send email HASURA Event SendGrid
Event Notification SendGrid Serverless Update email
Send Email Flow HASURA Realtime Serverless Send email HASURA Event
SendGrid
Create HASURA Table
Creating an event-trigger to listen to a database change on
Postgres
Create Serverless (Send Email) const sgMail = require('@sendgrid/mail'); module.exports.run =
async event => { try { let { table: { name: table_name, schema }, event: { data: { new: { to, from, subject, content: html, id }, }, }, } = JSON.parse(event.body); sgMail.setApiKey(process.env.SENDGRID_API_KEY);
SendGrid Settings
AWS Lambda Settings
Update Email Status Flow HASURA Realtime Serverless Send email HASURA
Event SendGrid Event Notification SendGrid Serverless Update email
Create Serverless (Update Email) const axios = require('axios'); module.exports.run =
async event => { try { const body = JSON.parse(event.body); const { id, event: status, schema, table_name } = body[body.length - 1]; await axios({ method: 'post', headers: { 'x-hasura-admin-secret': process.env.HASURA_SECRET, }, url: process.env.HASURA_URL, data: { variables: {
AWS Lambda Settings
SendGrid Settings
provider: functions: sendEmailFromHasura: handler: sendEmailFromHasura.run events: - http: path: send-email-from-hasura
method: post updateHasuraEmailStatus: handler: updateHasuraEmailStatus.run events: - http: path: update-hasura-email-status method: post plugins: - serverless-plugin-monorepo serverless.yml
sls deploy
AWS Lambda function
Reference https://serverless.com/ https://aws.amazon.com/tw/lambda/ Develop a Serveerless Backend using Node.js on
AWS Lambda What is Serverless ? Serverless overview What is Serverless Architecture? https://www.flaticon.com
Thanks Anna Su