Custom hostname

Setting up a custom hostname for the s3ftp service is as simple as defining a DNS CNAME.

To provide a custom hostname for your s3ftp service, you must own an internet domain and have DNS delegation setup for your domain. You can register and configure DNS using AWS Route53. If you use a different DNS provider you will have to research how to define a CNAME record in your DNS domain.

The following steps will describe how to setup a custom hostname using AWS Route53. This assumes the DNS zone for your custom hostname is hosted in Route53 in the same account as your s3ftp stack.

Create an AWS Route53 Alias record

  1. If your DNS is hosted in AWS Route53 in the same account as your s3ftp stack, navigate to the Route53 Hosted Zones page and locate your zone. We need the Hosted zone ID which is displayed on this page in the right hand column. Copy the Hosted zone ID value.

  2. Next, navigate to the AWS Cloudformation console, select the s3ftp stack you deployed earlier and then click the Update button.

  3. You should see the following Update stack screen. Use the current template and click Next. cloudformation update

  4. You will progress to the Specify stack details page where cloudformation stack parameters can be updated. specify stack details

  5. On the parameters page, scroll down and enter values in the Route53HostedZoneId and CustomHostname fields. Our example adds Click Next.
    update zoneid and custom hostname

  6. Click through the Configure stack options page.

  7. On the Review stack page, check your zoneid and hostname parameters are correct. Then scroll to the bottom of the page, click the checkbox to acknowledge that AIM resources may be created and finally click Update stack.

  8. The stack should take a few minutes before moving to an UPDATE_COMPLETE state. You should now have a new Route53 DNS record pointing to your s3ftp service.

Confirm DNS resolution

Now in a terminal you can confirm that DNS resolution is working as expected. Change the hostname to your custom hostname.

Using dig

% dig +short

Or using nslookup

% nslookup

Non-authoritative answer:

If you get an error from either of the above commands and cannot resolve your custom hostname, you may have a DNS delegation problem. Check the authorative DNS name servers defined within your Domain Name registrar. Ensure that your Route53 DNS servers are defined as the authorative DNS servers for your domain.

Connect to your sftp server using custom hostname

Now that your DNS record is setup, you should be able to connect to your sftp server using your custom domain name.

% sftp -i ~/.ssh/hermione
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:lsmaz5dFSxkSpBSutLIkIpeE4QrDltQci+BSVfVzQMw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
All activities performed on this device are logged and monitored.
Connected to
sftp> ls -l
-rw-r--r--    0 10000    10000    10485760 Feb 12 06:44 spellbook.dat

For other DNS providers

If you use a different DNS provider other than AWS Route53, you will need to determine the steps to add a CNAME record to your domain.

In all cases you will need to know the s3ftp service hostname to point your CNAME at.

In the AWS Cloudformation console where you deployed the stack, select the s3ftp stack and the navigate to the Outputs tab.

Grab the value of the SftpHostname cloudformation output. With this value you should fairly easily be able to create a DNS CNAME record in your own domain to point to the s3ftp service.