go serverless with aws lambda and apex
TRANSCRIPT
GO SERVERLESSEdoardo Paolo Scalafiotti - Dev @ Sainsbury’s
The GIG : Gathering of International Gophers - Paris 10/2016
About me
● Go, NodeJS● SPAs, WebComponents● Material Design● Serverless Architecture● Microservices● Machine Learning● IoT Prototyping
TL;DRFaaS is about running back end code without
managing your own server systems or your own server applications on an ephemeral container
● Reduced operational cost● Good for prototyping● Good with irregular, high spike traffic that
cannot be handled by auto-scaling● Promotes best coding practises
Apex lets you build, deploy, and manage AWS Lambda functions with ease. It has support for
GoLang and Terraform.
import (
"encoding/json"
"github.com/apex/go-apex"
)
type Message struct {
Hello string `json:"hello"`
}
// Example of a Lambda function handling arbitrary JSON input.
func main() {
apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
return &Message{"world"}, nil
})
}