Skip to content

Domain

Load Balanced Web Service

As mentioned in the Application Guide, you can configure the domain name of your app when running copilot app init. After deploying your Load Balanced Web Services, you should be able to access them publicly via

${SvcName}.${EnvName}.${AppName}.${DomainName}

For example:

https://kudo.test.coolapp.example.aws

Currently, you can only use aliases under the domain you specified when creating the application. Since we delegate responsibility for the subdomain to Route 53, the alias you specify must be in either one of these three hosted zone:

  • root: ${DomainName}
  • app: ${AppName}.${DomainName}
  • env: ${EnvName}.${AppName}.${DomainName}

We'll make this feature more powerful in the future by allowing you to import certificates and use any aliases!

Info

Both root and app hosted zone are in your app account, while the env hosted zones are in your env accounts.

How do I configure an alias for my service?

If you don't like the default domain name Copilot assigns to your service, setting an alias for your service is also very easy. You can add it directly to your manifest's alias section. The following snippet will set an alias to your service.

# in copilot/{service name}/manifest.yml
http:
  path: '/'
  alias: example.aws

Info

Using this feature requires your app version to be at least v1.0.0. You will be prompted to run app upgrade first if your app version does not meet the requirement.

What happens under the hood?

Under the hood, Copilot

  • creates a hosted zone in your app account for the new app subdomain ${AppName}.${DomainName}
  • creates another hosted zone in your env account for the new env subdomain ${EnvName}.${AppName}.${DomainName}
  • creates and validates an ACM certificate for the env subdomain
  • associates the certificate with your HTTPS listener and redirects HTTP traffic to HTTPS
  • creates an optional A record for your alias

What does it look like?

Request-Driven Web Service

You can also add a custom domain for your request-driven web service. Similar to Load Balanced Web Service, you can do so by modifying the alias field in your manifest:

# in copilot/{service name}/manifest.yml
http:
  path: '/'
  alias: web.example.aws

Likewise, your application should have been associated with the domain (e.g. example.aws) in order for your Request-Driven Web Service to use it.

Info

For now, we support only 1-level subdomain such as web.example.aws.

Environment-level domains (e.g. web.${envName}.${appName}.example.aws), application-level domains (e.g. web.${appName}.example.aws), or root domains (i.e. example.aws) are not supported yet. This also means that your subdomain shouldn't collide with your application name.

Under the hood, Copilot:

  • associates the domain with your app runner service
  • creates the domain record as well as the validation records in your root domain's hosted zone