Skip to content

An implementation of grpc-go.Resolver using AWS Cloud Map.

License

Notifications You must be signed in to change notification settings

ab180/grpc-cloudmap-resolver

Repository files navigation

AWS Cloud Map Resolver for grpc-go

Go Reference

grpc-cloudmap-resolver is an implementation of grpc-go.Resolver using AWS Cloud Map.

Installation

go get github.com/ab180/grpc-cloudmap-resolver

Example

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
}

About

An implementation of grpc-go.Resolver using AWS Cloud Map.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages