Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 1.44 KB

aws_route53.md

File metadata and controls

80 lines (57 loc) · 1.44 KB

gocloud DNS - AWS

Configure AWS credentials.

Create amazoncloudconfig.json in your HOME/.gocloud directory as follows:

{
  "AWSAccessKeyID": "xxxxxxxxxxxx",
  "AWSSecretKey": "xxxxxxxxxxxx"
}

You can also set the credentials as environment variables:

export AWSAccessKeyID =  "xxxxxxxxxxxx"
export AWSSecretKey = "xxxxxxxxxxxx"

Initialize library

import "github.com/cloudlibz/gocloud/gocloud"

amazoncloud, _ := gocloud.CloudProvider(gocloud.Amazonprovider)

Create DNS

  createdns := map[string]interface{}{
		"name":             "rootmonk.me",
		"hostedZoneConfig": "hostedZoneConfig",
	}

 resp, err := awsdns.CreateDns(createdns)

 response := resp.(map[string]interface{})
 fmt.Println(response["body"])

Delete DNS

 deletedns := map[string]string{
		"ID": "ZOD7SUP0ZGGQQ",
	}

 resp, err := awsdns.DeleteDns(deletedns)

 response := resp.(map[string]interface{})
 fmt.Println(response["body"])

List DNS

 listdns := map[string]interface{}{
		"marker":   "",
		"maxItems": 2,
	}

  resp, err := awsdns.ListDns(listdns)

 response := resp.(map[string]interface{})
 fmt.Println(response["body"])

List ResourcednsRecordSets

 listResourcednsRecordSets := map[string]interface{}{
	"zone": "ZBNX5TIW033J2",
  }

 resp, err := awsdns.ListResourceDnsRecordSets(listResourcednsRecordSets)

 response := resp.(map[string]interface{})
 fmt.Println(response["body"])