Created
December 30, 2014 13:40
-
-
Save ian-kent/0a53b779a60543dd816e to your computer and use it in GitHub Desktop.
elasticache.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/crowdmob/goamz/aws" | |
"github.com/crowdmob/goamz/elasticache" | |
) | |
func main() { | |
auth, err := aws.EnvAuth() | |
if err != nil { | |
log.Fatalf("Error getting AWS env auth: %s\n", err) | |
} | |
ec := elasticache.New(auth, aws.EUWest) | |
cc, err := ec.DescribeReplicationGroup("chdocapi-test-ge") | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("ReplicationGroup: %+v\n", cc) | |
log.Printf("NodeGroups: %+v\n", cc.NodeGroups) | |
for _, ngm := range cc.NodeGroups[0].NodeGroupMembers { | |
log.Printf("NodeGroupMember: %+v\n", ngm) | |
log.Printf("ReadEndpoint: %+v\n", ngm.ReadEndpoint) | |
} | |
ep, err := cc.GetPrimaryNode() | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Printf("%+v\n", ep) | |
fmt.Printf("Host: %s\nPort: %d\n", ep.Address, ep.Port) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment