Hosting Golang Web services sanely

22 May 2017

Kai Hendry

How do you deploy Golang?

Behold the DevOps evolution

Function as a Service

A cloud service orchestrates the containers, secures them, provisions them, scales them.

Golang not supported on AWS Lambda :(

Enter: TJ Holowaychuk

Apex

A Golang Web service

package main

import (
    "fmt"
    "log"
    "net/http"
    "os"
)

func main() {
    addr := ":" + os.Getenv("PORT")
    http.HandleFunc("/", hello)
    log.Fatal(http.ListenAndServe(addr, nil))
}

func hello(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, "Hello World from Go")
}

Up golang- Examples

Assuming you have an AWS profile setup ..

Let's iterate with Gin

Gin - Live reload utility for Go web servers

Further examples

Other icing on the cake

To conclude

Welcome to the next generation

$ apex --env production metrics
total cost: $0.00
invocations: 1,431 ($0.00)
duration: 6m30.522s ($0.00)
throttles: 0
errors: 0
memory: 128

Thank you

22 May 2017