Working with custom hostnames - AWS Transfer Family

Working with custom hostnames

Your server host name is the hostname that your users enter in their clients when they connect to your server. You can use a custom domain that you have registered for your server hostname when you work with AWS Transfer Family. For example, you might use a custom hostname like mysftpserver.mysubdomain.domain.com.

To redirect traffic from your registered custom domain to your server endpoint, you can use Amazon Route 53 or any Domain Name System (DNS) provider. Route 53 is the DNS service that AWS Transfer Family natively supports.

On the console, you can choose one of these options for setting up a custom hostname:

  • Amazon Route 53 DNS alias – if the hostname that you want to use is registered with Route 53. You can then enter the hostname.

  • Other DNS – if the hostname that you want to use is registered with another DNS provider. You can then enter the hostname.

  • None – to use the server's endpoint and not use a custom hostname.

You set this option when you create a new server or edit the configuration of an existing server. For more information about creating a new server, see Step 2: Create an SFTP-enabled server. For more information about editing the configuration of an existing server, see Edit server details.

For more details about using your own domain for the server hostname and how AWS Transfer Family uses Route 53, see the following sections.

Use Amazon Route 53 as your DNS provider

When you create a server, you can use Amazon Route 53 as your DNS provider. Before you use a domain with Route 53, you register the domain. For more information, see How Domain Registration Works in the Amazon Route 53 Developer Guide.

When you use Route 53 to provide DNS routing to your server, AWS Transfer Family uses the custom hostname that you entered to extract its hosted zone. When AWS Transfer Family extracts a hosted zone, three things can happen:

  1. If you're new to Route 53 and don't have a hosted zone, AWS Transfer Family adds a new hosted zone and a CNAME record. The value of this CNAME record is the endpoint hostname for your server. A CNAME is an alternate domain name.

  2. If you have a hosted zone in Route 53 without any CNAME records, AWS Transfer Family adds a CNAME record to the hosted zone.

  3. If the service detects that a CNAME record already exists in the hosted zone, you see an error indicating that a CNAME record already exists. In this case, change the value of the CNAME record to the hostname of your server.

    Note

    If this step is part of a server creation workflow, your server is successfully created and your custom hostname is set to None.

For more information about hosted zones in Route 53, see Hosted Zone in the Amazon Route 53 Developer Guide.

Use other DNS providers

When you create a server, you can also use DNS providers other than Amazon Route 53. If you use an alternate DNS provider, make sure that traffic from your domain is directed to your server endpoint.

To do so, set your domain to the endpoint hostname for the server. An endpoint hostname looks like this in the console:

serverid.server.transfer.region.amazonaws.com

Custom hostnames for non-console created servers

When you create a server using AWS Cloud Development Kit (CDK) or through the CLI, you must add tags if you want that server to have a custom hostname. When you create a Transfer Family server by using the console, the tagging is done automatically.

Note

You also need to create a DNS record to redirect traffic from your domain to your server endpoint.

To add the necessary tags, you need to add 2 keys, one for aws:transfer:customHostname, and one for aws:transfer:rout53HostedZoneId.

"Tags": [ { "Key": "aws:transfer:route53HostedZoneId", "Value": "/hostedzone/HOSTED-ZONE-ID" }, { "Key": "aws:transfer:customHostname", "Value": "abc.example.com" } ]

where HOSTED-ZONE-ID is your hosted zone ID, and abc.example.com is the custom hostname that you want to use.

Note

Your public, hosted zones and their IDs are available on Amazon Route 53.

Sign in to the AWS Management Console and open the Route 53 console at https://console.aws.amazon.com/route53/.

To add these tags, you can use the console or issue a CLI command.

Console

To add Key-Value pair tags for a custom hostname

  1. Open the AWS Transfer Family console at https://console.aws.amazon.com/transfer/.

  2. In the Tags section, select Manage tags.

  3. On the Manage tags screen, select Add tag.

  4. Enter your key and value for the hosted zone ID and click Save. Repeat this step to add the key and value for the custom hostname.

API

To add the key-value pairs using the API, issue the following commands:

aws transfer tag-resource --arn "server-ARN:server/server-ID" --tags Key="aws:transfer:route53HostedZoneId,Value=/hostedzone/HOSTED-ZONE-ID" aws transfer tag-resource --arn "server-ARN:server/server-ID" --tags Key="aws:transfer:customHostname",Value="abc.example.com"