AWS Route53

This Driver generates a new subdomain for a domain that is managed in a Route53 Hosted Zone.

Property Description
Resource type dns
Account type aws

Inputs

Values

Name Type Description
domain string The domain under which to specify the subdomain. For example, staging.example.com
hosted_zone_id string The AWS hosted zone for the domain.
template string [Optional] A Go Template which should render to a valid DNS subdomain.

Secrets

None

Notes

This Driver adds records to a Route53 Hosted Zone pointing at the Load Balancer for the relevant cluster.

If template is not specified, a random string made up of 3 domain words will be used as the subdomain.

This Driver can be used with environments running on different clusters.

AWS credentials

As Route53 is a service of AWS, AWS credentials are required to use the service.

Example

Use the humanitec/dns-aws-route53 Driver to provision a new subdomain under staging.route53-hosted-domain.com for an app called route53-dns-example-app.

This example assumes that an AWS Cloud Account has been defined called aws-example-account.

Then the following dynamic Resource Definition should be added. Apply the following modifications as needed:

  • Adjust the criteria to the Matching Criteria to fit your setup.
  • Decide whether you need to co-provision an ingress resource as shown, and remove the provision section if not. See Routes for a discussion on how the networking Resource Types work together.

cat <<EOF > dynamic-dns-route53.yaml
apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: dynamic-dns-route53
entity:
  driver_account: aws-example-account
  driver_type: humanitec/dns-aws-route53
  name: "Dynamic DNS via Route53"
  type: dns
  driver_inputs:
    values:
      domain: staging.route53-hosted-domain.com
      hosted_zone_id: HKAV28SSA
  criteria:
    - app_id: route53-dns-example-app
  provision:
    ingress:
      is_dependent: false
EOF

humctl create -f dynamic-dns-route53.yaml

curl https://api.humanitec.io/orgs/my-org/resources/defs \
  -X POST \
  -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
  -H "Content-Type: application/json" \
  --data-binary '{
  "id": "dynamic-dns-route53",
  "name": "Dynamic DNS via Route53",
  "type": "dns",
  "driver_account": "aws-example-account",
  "driver_type": "humanitec/dns-aws-route53",
  "driver_inputs": {
    "values": {
      "domain": "staging.route53-hosted-domain.com",
      "hosted_zone_id": "HKAV28SSA"
    }
  },
  "criteria": [
    {
      "app_id": "route53-dns-example-app"
    }
  ],
  "provision": {
    "ingress": {
      "is_dependent": false
    }
  }
}'

Use this Resource Definition for the Humanitec Terraform Provider:

resource "humanitec_resource_definition" "dns-route53" {
  id             = "dynamic-dns-route53"
  name           = "Dynamic DNS via Route53"
  type           = "dns"
  driver_account = "aws-example-account"
  driver_type    = "humanitec/dns-aws-route53"

  driver_inputs = {
    values_string = jsonencode({
      "domain": "staging.route53-hosted-domain.com",
      "hosted_zone_id": "HKAV28SSA"
    })
  }

  provision = {
    ingress = {
      is_dependent = false
    }
  }
}

resource "humanitec_resource_definition_criteria" "dns-route53" {
  resource_definition_id = humanitec_resource_definition.dns-route53.id
  app_id                 = "route53-dns-example-app"
}
Top