amazingly simple serverless go
TRANSCRIPT
Amazingly Simple Serverless GoSeptember 2017 Golang Meetup Yun Zhi Lin, Microservices Architect
1
2
3
Why Go + Serverless
(Gopher) Event Driven Architecture
Demo and Examples
Why SLS GolangWhy
People want Golang!
But got .Net Core instead
Why Serverless Framework?
The most versatile out of all golang enabled serverless libraries
Framework Provider Languages Golang Shim Infrastructure
Apex AWS Node
Golang
Node Partial
GoSparta AWS Golang Node Partial
Serverless
Framework
AWS
Azure
Openwhisk
Kubeless
Python
Node
Java
.Net
Python Full
- Dev friendly
YML
- Ops friendly CF
Secret Sauce – EAWSY Shim
Eawsy’s Shim is 2nd
fastest way to run AWS Lambda from cold starts
(Gopher)Event Driven Architecture
Life prior to Microservices and Gophers
Mobile Backend
Frontend
Life after Event Driven Microservices, with Gophers!
2 Docker Go MicroServices + 14 Go Lambdas
SSO SCVJAMstack JAMstack
Demo & Examples
Kinesis Event Source
Go code serverless.yml
func DataLogger(
evt *kinesisstreamsevt.Event)(
interface{}, error) {
rs := evt.Records
for r := range rs {
log.Println(r)
}
return evt.String(), nil
}
functions:
logger:
handler:
handler.DataLogger
events:
- stream:
${env:AWS_KINESIS_ARN}
Go Net with API Gateway
Go code serverless.yml
functions:
crud:
handler: handler.Handler
events:
- http:
path: todos
method: post
cors: true
- http:
path: todos
method: get
cors: true
- http:
path: todos/{id}
method: get
cors: true
func setUpMux() *mux.Router {
r := mux.NewRouter()
r.HandleFunc("/todos", create)
.Methods(http.MethodPost)
r.HandleFunc("/todos", list)
.Methods(http.MethodGet)
r.HandleFunc("/todos/{id}", read)
.Methods(http.MethodGet)
…
return r
}
Demo
Credits and Road Map
This library would not be possible without the help of:
• @cristm from HereMaps
• Serverless.com and Eawsy.com
• @flemay from amaysim for the awesome logo
Coming soon:
• dynamodb example with localstack
• Event Gateway and FDK
• Azure integration