AWS Cloud Map Resolver for grpc-go
grpc-cloudmap-resolver is an implementation
of grpc-go.Resolver
using AWS Cloud Map.
go get github.com/ab180/grpc-cloudmap-resolver
See godoc for more details.
package main
import (
"log"
"google.golang.org/grpc"
cloudmap "github.com/ab180/grpc-cloudmap-resolver"
)
func main() {
// register custom builder
// cloudmap.Register(
// cloudmap.WithSession(your_session),
// cloudmap.WithRefreshInterval(1 * time.Minute),
// )
conn, err := grpc.Dial(
cloudmap.BuildTarget("your-namespace", "your-service"),
grpc.WithInsecure(),
grpc.WithBlock(),
grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`),
)
if err != nil {
log.Fatal("cannot create a grpc client connection")
}
_ = conn
}