Custom Domains

Digger supports two ways of integrating with custom domains. The first way is a fully automatic domains integration. It works only if your domain is already registered on Route53.

The second method is to be used if your domain is not registered on Route53.

With Route 53

The example below will assign mydomain.usedigger.io to the infrastructure provisioned by cli-backend

{
    "target": "diggerhq/tf-module-bundler@master",
    "aws_region": "us-east-1",
    "version": "0.0.8",
    "id": "4cab02a0-8490-4701-88bd-2643ab5ce641",
    "hosted_zone_name": "usedigger.io"
    "blocks": [
        {
            "aws_app_identifier": "default_network-94c0e294",
            "name": "default_network",
            "type": "vpc"
        },
        {
            "aws_app_identifier": "clibackend-782c3eff",
            "name": "backend",
            "type": "container"
            "subdomain_name": "mydomain"
        },
        {
            "aws_app_identifier": "clidatabase-9f240757",
            "name": "clidatabase",
            "type": "resource"
        },
        {
            "aws_app_identifier": "cliredis-60189b88",
            "name": "cliredis",
            "type": "resource"
        }
    ],
    "created": 1673441858902
}

Without Route 53

If you have a domain registered outside of route53, you can follow these steps to integrate with Amazon Certificate Manager.

Ensure you are in the same region as your digger app (example us-east-1 if your app is in us-east-1)

Go to ACM section

click on Request a certificate

click Next and enter your domain name. If your domain is called [myexample.com](<http://myexample.com>) and you want something like [app.myexample.com](<http://app.myexample.com>) you can use either *.myexample.com or app.myexample.com depending on your preference

you will see that the certificate record is created with a status of “pending validation”

after you click into the certificate you can see that it asks you to validate your domain by copying the records into your domain. You can do so by copying the records over to your domain provider

Perform the validation and also take note of the ARN value for this ACM certificate. It will be needed in the next steps.

Now you can update your dgctl.json to the following:

{
    "target": "diggerhq/tf-module-bundler@master",
    "aws_region": "us-east-1",
    "version": "0.0.10",
    "id": "4cab02a0-8490-4701-88bd-2643ab5ce641",
    "hosted_zone_name": "uselemon.cloud",
    "blocks": [
        {
            "aws_app_identifier": "default_network-94c0e294",
            "name": "default_network",
            "type": "vpc"
        },
        {
            "aws_app_identifier": "clibackend-782c3eff",
            "name": "clibackend",
            "type": "container",
            "enable_https_listener": true,
            "lb_ssl_certificate_arn": "<<YOUR_ARN_VALUE"
        },
    ]
}

Finally run dgctl provision! After the command is done your will see your loadbalancer URL. The final step is to wire your domain to that URL. For examply myapp.myexample.com -> LB_URL . Wait for DNS propagation and then you are done!

Last updated