An open API service indexing awesome lists of open source software.

https://github.com/rgl/go-aws-route53-usage-example

This is an example Go application that lists all the DNS Zones hosted in AWS Route 53
https://github.com/rgl/go-aws-route53-usage-example

aws-route53 example go

Last synced: about 1 year ago
JSON representation

This is an example Go application that lists all the DNS Zones hosted in AWS Route 53

Awesome Lists containing this project

README

          

# About

This is an example Go application that lists all the DNS Zones hosted in [AWS Route 53](https://aws.amazon.com/route53/).

# Usage (on a Ubuntu Desktop)

Install the dependencies:

* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
* [Go](https://go.dev/dl/).

Set the AWS Account credentials using SSO:

```bash
# set the environment variables to use a specific profile.
# e.g. use the pattern ---
export AWS_PROFILE=example-dev-AdministratorAccess-123456
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_DEFAULT_REGION
# set the account credentials.
# see https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html#sso-configure-profile-token-auto-sso
aws configure sso
# dump the configured profile and sso-session.
cat ~/.aws/config
# show the user, user amazon resource name (arn), and the account id, of the
# profile set in the AWS_PROFILE environment variable.
aws sts get-caller-identity
```

Or, set the AWS Account credentials using an Access Key:

```bash
# set the account credentials.
# NB get these from your aws account iam console.
# see Managing access keys (console) at
# https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey
export AWS_ACCESS_KEY_ID='TODO'
export AWS_SECRET_ACCESS_KEY='TODO'
unset AWS_PROFILE
# set the default region.
export AWS_DEFAULT_REGION='eu-west-1'
# show the user, user amazon resource name (arn), and the account id.
aws sts get-caller-identity
```

Build:

```bash
go build
```

Use:

```bash
./go-aws-route53-usage-example
```

You should see something like:

```
zone=abc.example.com. nameservers=ns-1529.awsdns-63.org,ns-773.awsdns-32.net,ns-1797.awsdns-32.co.uk,ns-48.awsdns-06.com
```