

# Understanding DNS in Lightsail
DNS in Lightsail

People can access the web application on your Lightsail instance by browsing to the public internet protocol (IP) address of your instance, which could be an IPv4 or IPv6 address. However, IP addresses are complex and difficult for people to remember. Therefore, you should have people browse to an easy-to-remember domain name, like `example.com`, to access the web application on your instance. This is achieved through the Domain Name System (DNS), which functions as a directory that maps registered domain names to IP addresses.

To route traffic for your domain name to your Lightsail instance, you add an address (A) record that points your domain name to the static IPv4 address of your instance, or a AAAA record that points to the IPv6 address of your instance. If you registered a domain name using Lightsail, you can manage the DNS records from the DNS zone that was created when you registered the domain name. If your domain was registered through another registrar, you can manage the DNS records at the registrar or you can transfer management of your domain's DNS to Lightsail.

To make it easier to map your domain name to your Lightsail instance, we recommend that you transfer management of your domain's DNS records to Lightsail by creating a DNS zone. For more information, see [Create a DNS zone to manage your domain’s DNS records](lightsail-how-to-create-dns-entry.md). You can create up to six DNS zones in Lightsail. If you require more than six DNS zones, we recommend using Route 53 to manage the DNS of all your domains. You can use Route 53 to point your domain name to your Lightsail instance. For more information about managing DNS with Route 53, see [Use Amazon Route 53 to point a domain to an instance](amazon-lightsail-using-route-53-to-point-a-domain-to-an-instance.md).

## DNS terminology


So that you can manage DNS for your domain, there are terms you should be familiar with.

**Apex domain / root domain**  
An apex domain, also known as a root domain, is a domain that does not contain a subdomain part. An example of an apex domain is `example.com`. Whereas, subdomain examples are `www.example.com` and `blog.example.com`. These are subdomains because they contain the `www` and `blog` subdomain parts respectively.

**Domain Name System (DNS)**  
DNS routes easy-to-remember domain names, such as `example.com`, to the IP addresses of web servers.  
For more information, see [Domain Name System](https://en.wikipedia.org/wiki/Domain_Name_System) on *Wikipedia*.

**DNS record**  
A DNS record is a mapping parameter. It tells the DNS server which IP address or hostname a domain or subdomain is associated with.  
For more information, see [List of DNS record types](https://en.wikipedia.org/wiki/List_of_DNS_record_types) on *Wikipedia*.

**DNS zone**  
A DNS zone is a container that holds information about how you want to route traffic on the internet for a specific domain, such as `example.com`, and its subdomains, such as `blog.example.com`.  
For more information, see [DNS zone](https://en.wikipedia.org/wiki/DNS_zone) on *Wikipedia*.

**Domain name registrar**  
A domain name registrar, also known as a domain name provider, is a company or organization that manages the assignment of domain names. You can purchase a domain or manage an existing domain using Lightsail, Amazon Route 53 or any other domain name registrar.  
For more information, see [Domain name registrar](https://en.wikipedia.org/wiki/Domain_name_registrar) on *Wikipedia*.

**Name server**  
A name server routes traffic to your domain. In Lightsail, the name server is an AWS instance that runs a network service to help translate easy-to-remember domain names to IP addresses. Lightsail provides several AWS name server options (e.g., `ns-NN.awsdns-NN.com`) to route traffic to your domain. You can choose from among these AWS name servers when you change your domain using a domain registrar.  
For more information, see [Name server](https://en.wikipedia.org/wiki/Name_server) on *Wikipedia*.

**Subdomain**  
A subdomain is anything in the domain hierarchy, other than the root domain, that is part of the larger domain. For example, `blog` is the subdomain part of the `blog.example.com` subdomain.  
For more information, see [Subdomain](https://en.wikipedia.org/wiki/Subdomain) on *Wikipedia*.

**Time to live (TTL)**  
TTL dictates the lifespan of a DNS record on local resolving name servers; for example, a shorter time means less time to wait until the changes go into effect. TTL cannot be configured in the Lightsail DNS zone. Instead, all Lightsail DNS records default to a TTL of 60 seconds.  
For more information, see [Time to live](https://en.wikipedia.org/wiki/Time_to_live) on *Wikipedia*.

**Wildcard DNS record**  
A wildcard DNS record matches requests for non-existent domain names. A wildcard DNS record is specified by using the asterisk symbol (\$1) as the leftmost part of a domain name, such as `*.example.com` or `*example.com`.  
Lightsail DNS zones support wildcard records for name server domains (`*awsdns.com`) defined in a Name Server (NS) record.

## DNS record types supported in the Lightsail DNS zone


Address (A) record  
An A record maps a domain, such as `example.com`, or a subdomain, such as `blog.example.com`, to a web server’s IP address.  
For example, in the Lightsail DNS zone, you want to direct web traffic for `example.com` (the apex of the domain) to your instance. You would create an A record, enter an `@` symbol into the **Subdomain** text box, and enter the IP address of your web server into the **Resolves to address** text box.  
For more information about the A record, see [List of DNS record types](https://en.wikipedia.org/wiki/List_of_DNS_record_types) on *Wikipedia*.

AAAA record  
An AAAA record maps a domain, such as `example.com`, or a subdomain, such as `blog.example.com`, to a web server’s IPv6 address.  
For example, in the Lightsail DNS zone, you want to direct web traffic for `example.com` (the apex of the domain) to your instance over the IPv6 protocol. You would create an AAAA record, enter an `@` symbol into the **Subdomain** text box, and enter the IP address of your web server into the **Resolves to address** text box.  
For more information about the AAAA record, see the [Domain Name System for IPv6](https://en.wikipedia.org/wiki/IPv6_address#Domain_Name_System) on *Wikipedia*.  
Lightsail does not support static IPv6 addresses. If you delete your Lightsail resource and create a new resource, or if you disable and re-enable IPv6 on the same resource, you might need to update your AAAA record to reflect the latest IPv6 address for the resource.

Canonical name (CNAME) record  
A CNAME record maps an alias or subdomain, such as `blog.example.com`, to another domain or subdomain.  
For example, in the Lightsail DNS zone, you want to direct web traffic for `www.example.com` to `example.com`. You would create an alias CNAME record for `www` with a "resolves to" address of `example.com`.  
For more information, see [CNAME Record](https://en.wikipedia.org/wiki/CNAME_record) on *Wikipedia*.

Mail exchanger (MX) record  
An MX record maps a subdomain, such as `mail.example.com`, to an email server address with values for priority when multiple servers are defined.  
For example, in the Lightsail DNS zone you want to direct mail for `mail.example.com` to the `10 inbound-smtp.us-west-2.amazonaws.com` Amazon WorkMail server. You would create an MX record with a subdomain of `example.com`, a priority of `10`, and a "resolves to" address of `inbound-smtp.us-west-2.amazonaws.com`.  
For more information, see [MX Record](https://en.wikipedia.org/wiki/MX_record) on *Wikipedia*.

Name server (NS) record  
An NS record delegates a subdomain, such as `test.example.com`, to a name server, such as `ns-NN.awsdns-NN.com`.  
For more information, see [Name server](https://en.wikipedia.org/wiki/Name_server) on *Wikipedia*.

Service locator (SRV) record  
An SRV record maps a subdomain, such as `service.example.com`, to a service address with values for priority, weight, and port number. Telephony or instant messaging are a couple of the services typically associated with SRV records.  
For example, in the Lightsail DNS zone, you want to direct traffic for `service.example.com` to `1 10 5269 xmpp-server.example.com`. You would create an SRV record with a priority of `1`, a weight of `10`, a port number of `5269`, and a "maps to" address of `xmpp-server.example.com`.  
For more information, see [SRV Record](https://en.wikipedia.org/wiki/SRV_record) on *Wikipedia*.

Text (TXT) record  
A TXT record maps a subdomain to plaintext. You create TXT records to confirm ownership of your domain to a service provider.  
For example, in the Lightsail DNS zone, you want to respond with `23223a30-7f1d-4sx7-84fb-31bdes7csdbb` when the `_amazonchime.example.com` hostname is queried. You would create a TXT record with a subdomain value of `_amazonchime` and a "responds with" value of `23223a30-7f1d-4sx7-84fb-31bdes7csdbb`.  
For more information, see [TXT Record](https://en.wikipedia.org/wiki/TXT_record) on *Wikipedia*.

# Create a DNS zone to manage domain records for Lightsail instances
Create a DNS zone

To route traffic for a domain name, such as `example.com`, to an Amazon Lightsail instance, you add a record to the Domain Name System (DNS) of your domain. You can manage the DNS records of your domain using the registrar where you registered your domain, or you can manage them using Lightsail.

We recommend that you transfer management of your domain's DNS records to Lightsail. This allows you to efficiently administer your domain and compute resources together in one place—Lightsail. You can manage the DNS records of your domain using Lightsail by creating a Lightsail DNS zone. You can create up to six Lightsail DNS zones. If you require more than six DNS zones, because you manage more than six domain names, we recommend using Amazon Route 53 to manage the DNS of all of your domains. You can use Route 53 to route traffic for your domain to your Lightsail resources. For more information about managing DNS with Route 53, see [Use Amazon Route 53 to point a domain to an instance](amazon-lightsail-using-route-53-to-point-a-domain-to-an-instance.md).

This guide shows you how to create a Lightsail DNS zone for your domain, and how to transfer management of your domain's DNS records to Lightsail. After transferring management of your domain's DNS records to Lightsail, you will continue to manage renewals and billing for your domain at your domain's registrar.

**Important**  
Any changes you make to the DNS of your domain might require several hours to propagate through the internet's DNS. Because of this, you should keep the DNS records of your domain in place at your domain's current DNS hosting provider while the transfer of management to Lightsail propagates. This ensures that traffic for your domain continues to route to your resources uninterrupted while the transfer takes place.

## Step 1: Complete the prerequisites


Complete the following prerequisites if you haven’t already done so:

1. Register a domain name. Then, confirm that you have administrative access to edit the domain's name servers.

   If you need a registered domain name, you can register a domain using Lightsail. For more information, see [Domain registration](amazon-lightsail-domain-registration.md).

1. Confirm that the necessary DNS record types for your domain are supported by the Lightsail DNS zone. The Lightsail DNS zone currently supports address (A and AAAA), canonical name (CNAME), mail exchanger (MX), name server (NS), service locator (SRV), and text (TXT) record types. For NS records, you can use wildcard DNS record entries.

   If the DNS record types required for your domain are not supported by the Lightsail DNS zone, you might want to use Route 53 as your domain's DNS hosting provider because it supports a greater number of record types. For more information, see [Supported DNS Record Types](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html) and [Making Amazon Route 53 the DNS Service for an Existing Domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html) in the Amazon Route 53 Developer Guide.

1. Create a Lightsail instance to which you will point your domain. For more information, see [Create an instance](how-to-create-amazon-lightsail-instance-virtual-private-server-vps.md).

1. Create a static IP and attach it to your Lightsail instance. For more information, see [Create a static IP and attach it to an instance](lightsail-create-static-ip.md).

## Step 2: Create a DNS zone in the Lightsail console


Complete the following steps to create a DNS zone in Lightsail. When you create a DNS zone, you must specify the domain name that the DNS zone will apply to.

1. Sign in to the [Lightsail console](https://lightsail.aws.amazon.com/).

1. In the left navigation pane, choose **Domains & DNS**. Then choose **Create DNS zone**.

1. Choose one of the following options:
   + **Use a domain that is registered with Amazon Route 53**, to specify a domain that was registered with Amazon Route 53
   + **Use a domain from another registrar**, to specify a domain that was registered using another registrar

1. Select or enter your registered domain name, such as `example.com`.

   It isn’t necessary to include `www` when entering your domain name. You can add the `www` using an address (A) record as part of the [Step 3: Add records to the DNS zone](#lightail-add-records-to-the-dns-zone) section later in this guide.
**Note**  
Lightsail DNS zones are created in the Virginia (`us-east-1`) AWS Region. You will get a resource name conflict error ("some names are already in use") if you named a resource in that Region the same as the Lightsail DNS zone ( `example.com`) you want to create.  
To resolve the error, [create a snapshot of the resource](understanding-snapshots-in-amazon-lightsail.md). [Create a new resource from the snapshot](lightsail-how-to-create-instance-from-snapshot.md) and give it a new, unique name. Then, delete the original resource that is named the same as the domain for which you want to create a Lightsail DNS zone.

1. Choose **Create DNS zone**.

   You are redirected to the DNS zone **Assignments** page, where you can manage domain resource assignments. Use assignments to point a domain to your Lightsail resources, such as load balancers and instances.

## Step 3: Add records to the DNS zone


Complete the following steps to add records to your domain’s DNS zone. DNS records specify how internet traffic is routed for the domain. For example, you could route traffic for the apex of your domain, such as `example.com`, to one instance, and route traffic for a subdomain, such as `blog.example.com`, to a different instance.

1. From the DNS zone assignments page, choose the **DNS records** tab.

   Your DNS zones are listed in the **Domains & DNS** tab of the [Lightsail console](https://lightsail.aws.amazon.com/).
**Note**  
On the DNS zone **Assignments** page, you can add, remove, or change which Lightsail resource your domain points to. You can point domains at Lightsail instances, distributions, container services, load balancers, static IP addresses and more. On the **DNS records** page, you can add, edit, or delete your domain’s DNS records.

1. Choose one of the following record types:  
**Address (A) record**  
An A record maps a domain, such as `example.com`, or a subdomain, such as `blog.example.com`, to a web server’s or instance’s IPv4 address, such as `192.0.2.255`.  

   1. In the **Record name** text box, enter the target subdomain for the record, or enter an @ symbol to define the apex of your domain.

   1. In the **Resolves to** text box, enter the target IP address for the record, select your running instance, or configured load balancer. When you select a running instance, the public IP address of that instance is automatically added.

   1. Select **Is AWS resource alias** to route traffic to your Lightsail and AWS resources, such as a distribution or container service. You can also route traffic from one record in a DNS zone to another record.
**Note**  
We recommend that you attach a static IP to your Lightsail instance and then choose the static IP as the value that the record resolves to. For more information, see [Create a static IP](lightsail-create-static-ip.md).  
**AAAA record**  
An AAAA record maps a domain, such as `example.com`, or a subdomain, such as `blog.example.com`, to a web server’s or instance’s IPv6 address, such as `2001:0db8:85a3:0000:0000:8a2e:0370:7334`.  
Lightsail does not support static IPv6 addresses. If you delete your Lightsail resource and create a new resource, or if you disable and re–enable IPv6 on the same resource, you might need to update your AAAA record to reflect the latest IPv6 address for the resource.

   1. In the **Record name** text box, enter the target subdomain for the record, or enter an `@` symbol to define the apex of your domain.

   1. In the **Resolves to** text box, enter the target IPv6 address for the record, select your running instance, or configured load balancer. When you select a running instance, the public IPv6 address of that instance is automatically added.

   1. Select **Is AWS resource alias** to route traffic to your Lightsail and AWS resources, such as a distribution or container service. You can also route traffic from one record in a DNS zone to another record.  
**Canonical name (CNAME) record**  
A CNAME record maps an alias or subdomain, such as `www.example.com`, to another domain, such as `example.com`, or another subdomain, such as `blog.example.com`.  

   1. In the **Record name** text box, enter the subdomain for the record.

   1. In the **Route traffic to** text box, enter the target domain or subdomain for the record.  
**Mail exchanger (MX) record**  
An MX record maps a subdomain, such as `mail.example.com`, to an email server address with priority values when multiple servers are defined.  

   1. In the **Record name** text box, enter the subdomain for the record.

   1. In the **Priority** text box, enter the priority for the record. This is important when adding records for multiple servers.

   1. In the **Route traffic to** text box, enter the target domain or subdomain for the record.  
**Service locator (SRV) record**  
An SRV record maps a subdomain, such as `service.example.com`, to a service address with values for priority, weight, and port number. Telephony or instant messaging are a couple of the services typically associated with SRV records.  

   1. In the **Record name** text box, enter the subdomain for the record.

   1. In the **Priority** text box, enter the priority for the record.

   1. In the **Weight** text box, enter a relative weight for SRV records with the same priority.

   1. In the **Route traffic to** text box, enter the target domain or subdomain for the record.

   1. In the **Port** text box, enter the port number in which a connection to the service can be made.  
**Text (TXT) record**  
A TXT record maps a subdomain to plain text. You create TXT records to confirm ownership of your domain to a service provider.  

   1. In the **Record name** text box, enter the subdomain for the record.

   1. In the **Responds with** text box, enter the text response that is given when the subdomain is queried.
**Note**  
The input text doesn't need to be enclosed with quotes.

1. When you're done adding the record, choose the **Save** icon to save your changes.

   The record is added to the DNS zone. Repeat the above steps to add multiple records to your domain's DNS zone.
**Note**  
Time to live (TTL) for DNS records cannot be configured in the Lightsail DNS zone. Instead, all Lightsail DNS records default to a TTL of 60 seconds. For more information, see [Time to live](https://en.wikipedia.org/wiki/Time_to_live) on Wikipedia.

## Step 4: Change the name servers at your domain’s current DNS hosting provider


Complete the following steps to transfer management of your domain's DNS records to Lightsail. To do this, you sign in to the website of your domain’s current DNS hosting provider, and change your domain’s name servers to the Lightsail name servers.

**Important**  
If web traffic is currently being routed to your domain, make sure that all of the existing DNS records are present in the Lightsail DNS zone before changing the name servers at your domain’s current DNS hosting provider. This way, traffic continually flows uninterrupted after the transfer to the Lightsail DNS zone.

1. Write down the Lightsail name servers that are listed on your domain's DNS zone management page. The name servers are located on the **Domains** tab of your Lightsail DNS zone.  
![\[The DNS zone name servers in the Lightsail console.\]](http://docs.aws.amazon.com/lightsail/latest/userguide/images/amazon-lightsail-dns-zone-name-servers.png)

1. Sign in to your domain’s current DNS hosting provider’s website.

1. Find the page where you can edit your domain's name servers.

   For more information about locating this page, see the documentation from your domain’s current DNS hosting provider.

1. Enter the Lightsail name servers, and remove other name servers listed.

1. Save your changes.

   Allow time for the name server change to propagate through the internet's DNS, which might take several hours. After that is completed, internet traffic for your domain should begin routing through the Lightsail DNS zone.

## Next steps

+ [Edit a DNS zone](amazon-lightsail-edit-or-delete-a-dns-zone.md)
+ [Create a load balancer and attach instances to it](create-lightsail-load-balancer-and-attach-lightsail-instances.md)

# Edit a Lightsail DNS zone
Edit a DNS zone

Edit the DNS records in your domain's DNS zone. You can also delete your domain's DNS zone in Amazon Lightsail if you want to transfer management of your domain's DNS records to another DNS hosting provider or back to the registrar where you registered your domain. For more information, see [Delete a DNS zone in Lightsail](lightsail-delete-dns-zone.md)

**Note**  
Before you can edit records using the DNS editor in the Lightsail console, you must transfer management of your domain's DNS records to Lightsail. For more information, see [Create a DNS zone to manage your domain’s DNS records](lightsail-how-to-create-dns-entry.md).

## Edit DNS records


You can edit the DNS records for your domain's DNS zone at any time using the Lightsail console.

**To edit the DNS zone**

1. Sign in to the Lightsail console.

1. On the Lightsail console home page, In the left navigation pane, choose **Domains & DNS**.

1. Choose the name of the DNS zone you want to edit.

1. On the DNS zone **DNS records** page, choose the **Delete** icon next to the record you want to delete.

1. When you're done, choose the **Save** icon to save your changes.
**Note**  
Allow time for the DNS record changes to propagate through the internet's DNS, which may take several hours.

# Delete a DNS zone in Lightsail
Delete a DNS zone

In some cases, you might want to completely remove a DNS zone that you've set up in Amazon Lightsail to manage your domain's DNS records. Perhaps you want to transfer DNS management to a different provider or back to your domain registrar. Deleting a DNS zone is a straightforward process, but it's important to plan ahead to ensure your domain's traffic continues to route correctly. Let's go over the steps to delete a DNS zone in Lightsail.

**Important**  
If you plan to continue routing traffic through your domain, prepare a different DNS hosting provider before deleting your domain's DNS zone in Lightsail. Otherwise, all traffic to your website stops when you delete the Lightsail DNS zone. 

**To delete a DNS zone**

1. On the Lightsail console home page, In the left navigation pane, choose **Domains & DNS**.

1. Choose the name of the DNS zone you want to delete.

1. Choose the vertical ellipsis menu (⋮). Then, choose the **Delete** option.

1. Choose **Delete DNS zone** to confirm the deletion.

   The DNS zone is deleted from Lightsail.

# Learn how internet traffic is routed to your website in Lightsail
Internet traffic routing

All computers on the internet, including smart phones, laptops, and website servers, communicate with one another by using unique strings of characters. These strings, known as IP addresses, are in one of the following formats:
+ Internet Protocol version 4 (IPv4) format, such as 192.0.2.44
+ Internet Protocol version 6 (IPv6) format, such as 2001:DB8::/32

When you open a browser and go to a website, you don't have to remember and enter a long string of characters like that. Instead, you can enter a domain name like **example.com** and still end up in the right place. This is achieved through the Domain Name System (DNS), which functions as a directory that maps registered domain names to IP addresses.

**Contents**
+ [Overview of how you configure Lightsail to route internet traffic for your domain](#internet-traffic-routing)
+ [How traffic is routed for your domain](#lightsail-traffic-routing)
+ [Next steps](#internet-traffic-routing-next-steps)

## Overview of how you configure Lightsail to route internet traffic for your domain


This overview explains how to use Lightsail to register and configure a domain that routes internet traffic to your website or web application. 

1. Register your domain name. For an overview, see [Domain registration](amazon-lightsail-domain-registration.md).

1. After you register your domain name, Lightsail automatically creates a DNS zone that has the same name as the domain.

1. The Lightsail console allows you to easily assign a domain to a Lightsail resource, such as an instance or load balancer. You can also create DNS records in your DNS zone to route traffic to your resources. Each record includes information about how you want to route traffic for your domain, such as the following:

   **Name**

   The name of the record corresponds with the domain name (example.com) or subdomain name (www.example.com, retail.example.com). The name of every record in a DNS zone must end with the name of the DNS zone. For example, if the name of the DNS zone is example.com, all record names must end in example.com. 

   **Type**

   The record type usually depends on the type of resource that you want traffic to be routed to. For example, to route traffic to an email server, you specify **MX** for **Type**. To route traffic for your domain name to your Lightsail instance, you add an **A** record that points your domain name to the static IPv4 address of your instance, or a **AAAA** record that points to the IPv6 address of your instance.

1. **Target**

   The target is where you want traffic to be routed to. You can create alias records that route traffic to Lightsail instances, Lightsail container services, and other Lightsail resources. For more information, see [DNS](understanding-dns-in-amazon-lightsail.md).

## How traffic is routed for your domain


After you configure Lightsail to route your internet traffic to your resources, such as instances, load balancers, distributions, or container services, here’s what happens when someone requests content for **www.example.com**.

1. A user opens a web browser, enters **www.example.com** in the address bar, and presses **Enter**.

1. The request for **www.example.com** is routed to a DNS resolver, which is typically managed by the user's internet service provider (ISP). ISPs can be cable internet providers, DSL broadband providers, or corporate networks.

1. The DNS resolver for the ISP forwards the request for **www.example.com** to a DNS root name server. 

1. The DNS resolver forwards the request for **www.example.com** again, this time to one of the TLD name servers for **.com** domains. The name server for **.com** domains responds to the request with the names of the four name servers that are associated with the **example.com** domain. 

   The DNS resolver caches (stores) the four name servers. The next time someone browses to **example.com**, the resolver skips steps 3 and 4 because it already has the name servers for **example.com**. The name servers are typically cached for two days.

1. The DNS resolver chooses a name server and forwards the request for **www.example.com** to that name server.

1. The name server looks in the **example.com** DNS zone for the **www.example.com** record and gets the associated value, such as the IP address for a web server (192.0.2.44). Then, the name server returns the IP address to the DNS resolver.

1. The DNS resolver finally has the IP address that the user needs. The resolver returns that value to the web browser.

1. The web browser sends a request for **www.example.com** to the IP address that it got from the DNS resolver. This is where your content is, for example, a web server running on an Lightsail instance or container service that's configured as a website endpoint.

1. The web server or other resource at 192.0.2.44 returns the web-page for **www.example.com** to the web browser, and the web browser displays the page.

## Next steps

+ [DNS](understanding-dns-in-amazon-lightsail.md)
+ [Point your domain to an instance](amazon-lightsail-routing-to-instance.md)
+ [Point your domain to a load balancer](add-alias-record-for-lightsail-load-balancer.md)
+ [Point your domain to a distribution](amazon-lightsail-point-domain-to-distribution.md)

# Route domain traffic to a Lightsail instance
Point domain to an instance

You can use the DNS zone in Amazon Lightsail to point a registered domain name, like **example.com**, to your website running on a Lightsail instance, also known as a virtual private server (VPS). You can create up to six DNS zones in you Lightsail account. Not all DNS record types are supported. For more information about Lightsail DNS zones, see[ DNS](understanding-dns-in-amazon-lightsail.md).

If you expect to create more than six DNS zones or use DNS record types that aren’t supported in Lightsail, we recommend using an Amazon Route 53 hosted zone. With Route 53, you can manage the DNS for up to 500 domains. It also supports a greater variety of DNS record types. For more information, see [Working with hosted zones](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/hosted-zones-working-with.html) in the Amazon Route 53 Developer Guide.

This guide shows you how to edit the DNS records for a domain managed in Lightsail so that it points to your Lightsail instance. Allow up to 48 hours for any DNS zone changes to propagate through the internet's DNS.

**Prerequisites**

Complete the following prerequisites if you haven’t already done so:
+ Register a domain name using Lightsail. For more information, see [Register a new domain](amazon-lightsail-register-new-domain.md).
+ If you already registered a domain but you’re not using Lightsail to manage its records, then you must transfer management of the DNS records for your domain to Lightsail. For more information, see [Create a DNS zone to manage your domain’s DNS records](lightsail-how-to-create-dns-entry.md).
+ The default dynamic public IP address attached to your Lightsail instance changes every time you stop and restart the instance. Create a static IP and attach it to your instance to keep the public IP address from changing. In this guide, you create a DNS record in your domain’s DNS zone that resolves to the static IP address so you don’t have to update your domain’s DNS records every time you stop and restart your instance. For more information, see [Create a static IP and attach it to an instance](lightsail-create-static-ip.md).

  **Optional**–You can leave IPv6 enabled for your Lightsail instance. The IPV6 address persists when you stop and start your instance. For more information, see [Enable and disable IPv6](amazon-lightsail-enable-disable-ipv6.md).

**Assign a domain to a Lightsail instance**

Use one of the following methods to assign a domain to an instance in Lightsail:
+ [Instance domains tab](#instance-domains-tab)
+ [Static IP domains tab](#static-ip-domains-tab)
+ [DNS zone assignments tab](#dns-zone-assignments-tab)

## Instance domains tab


Complete the following procedure to assign your domain to a Lightsail instance in the instance **Domains & DNS** section of the Lightsail console.

**To assign your domain by using the instance **Domains** tab**

1. Sign in to the [Lightsail console](https://lightsail.aws.amazon.com/).

1. Choose the instance name that you want to assign the domain to.

1. Choose **Assign domain** in the **Domains** tab.

1. Select the domain that you want to assign to your Lightsail instance.

1. Verify that the routing information is correct, and then choose **Assign**.

**Optional**

To edit or remove your domain assignment from the instance, choose the edit icon or the waste bin icon next to the domain name.

## Static IP domains tab


Complete the following procedure to assign your domain to a Lightsail instance in the static IP **Domains & DNS** tab of the Lightsail console.

**To assign your domain by using the static IP **Domains** tab**

1. Sign in to the [Lightsail console](https://lightsail.aws.amazon.com/).

1. Choose the **Networking** tab.

1. Choose the static IP that you want to assign the domain to.

1. Choose **Assign domain** in the **Domains** tab.

1. Select the domain that you want to assign to your static IP.

1. Verify that the routing information is correct, and then choose **Assign**.

**Optional**

To edit or remove your domain assignment from the static IP, choose the edit icon or the waste bin icon next to the domain name.

## DNS zone assignments tab


Complete the following procedure to assign your domain to a Lightsail instance in the **Assignments** tab of the DNS zone.

**To assign your domain by using the **Assignments** tab**

1. Sign in to the [Lightsail console](https://lightsail.aws.amazon.com/).

1. Choose the **Domains & DNS** tab.

1. Choose the DNS zone for the domain name that you want to use.

1. Choose **Add assignment** in the **Assignments** tab.

1. Select the domain name that you want to assign to your Lightsail instance. If a static IP isn’t already attached to the instance, you are prompted to attach one.

1. Verify that the routing information is correct, and then choose **Assign**.

**Optional**

To edit or remove your domain assignment from the resource, choose the edit icon or the waste bin icon next to the domain name.

# Point your domain to a Lightsail load balancer
Point domain to a load balancer

After you [verify that you control the domain where you want to have encrypted (HTTPS) traffic](verify-tls-ssl-certificate-using-dns-cname-https.md), you need to add an address (A) record to your domain's DNS hosting provider that points your domain to your Lightsail load balancer. In this guide, we show you how to add the A record to a Lightsail DNS zone, and an Amazon Route 53 hosted zone.

## Add an A record using the DNS zone - Assignments page


1. In the left navigation pane, choose **Domains & DNS**.

1. Choose the DNS zone you want to manage.

1. Choose the **Assignments** tab.

1. Choose **Add assignment**.

1. In the **Select a domain name** field, choose whether to use the domain name, or a subdomain of the domain.

1. In the **Select a resource** drop down, select the load balancer you want to assign the domain to.

1. Choose **Assign**.

Allow time for the change to propagate through the internet's DNS. This may take a few minutes to several hours.

## Add an A record using the DNS zone - DNS records page


1. In the left navigation pane, choose **Domains & DNS**.

1. Choose the DNS zone you want to manage.

1. Choose the **DNS records** tab.

1. Complete one of the following steps depending on the current state of your DNS zone:
   + If you haven't added an A record, choose **Add record**.
   + If you previously added an A record, choose the edit icon next to the existing A record listed on the page, and then skip to step 5 of this procedure.

1. Choose **A record** in the **Record type** dropdown menu.

1. In the **Record name** text box, enter one of the following options:
   + Enter `@` to route traffic for the apex of your domain (e.g., `example.com`) to your load balancer.
   + Enter `www` to route traffic for the www subdomain (e.g., `www.example.com`) to your load balancer.

1. In the **Resolves to** text box, choose the name of your Lightsail load balancer.

1. Choose the **Save** icon.

Allow time for the change to propagate through the internet's DNS. This may take a few minutes to several hours.

## Add an A record in Route 53


1. Sign in to the [Route 53 console](https://console.aws.amazon.com/route53).

1. In the navigation pane, choose **Hosted zones**.

1. Choose the hosted zone for the domain name that you want to use to route traffic to your load balancer.

1. Choose **Create record**.

   The **Quick create record** page appears.  
![\[Create a record in Route 53 to point an alias to your Lightsail load balancer\]](http://docs.aws.amazon.com/lightsail/latest/userguide/images/create-record-set-alias-record-route-53-blank.png)
**Note**  
If you see the **Choose routing policy** page, then choose **Switch to quick create** to switch to the quick create wizard before continuing with the following steps.

1. For **Record name**, type `www` if you plan to use the `www` subdomain (i.e., `www.example.com`) or leave it blank if you plan to use the apex of the domain (i.e., `example.com`).

1. For **Record type**, choose **A - Routes traffic to an IPv4 address and some AWS resources**.

1. Choose the **Alias** toggle to enable alias records.

1. Choose the following options for **Route traffic to**:

   1. For **Choose endpoint**, choose **Alias to Application and Classic Load Balancer**.

   1. For **Choose Region**, choose the AWS Region in which you created your Lightsail load balancer.

   1. For **Choose load balancer**, enter or paste the endpoint URL (i.e., DNS name) of your Lightsail load balancer.

1. For **Routing Policy**, choose **Simple routing**, and disable the **Evaluate target health** toggle.

   Lightsail already performs health checks on your load balancer. For more information, see [Health checks for your load balancer](enable-set-up-health-checking-for-lightsail-load-balancer-metrics.md).

   Your record should look like the following example.  
![\[Create a record in Route 53 to point an alias to your Lightsail load balancer\]](http://docs.aws.amazon.com/lightsail/latest/userguide/images/create-record-set-alias-record-route-53.png)

1. Choose **Create records** to add the record to your hosted zone.
**Note**  
Allow time for the change to propagate through the internet's DNS. This may take a few minutes to several hours.

# Transfer DNS management for your Lightsail domain
Transfer DNS management

You can use an Amazon Lightsail DNS zone to manage the DNS records for a domain that you registered using Lightsail. Or, if you'd like, you can transfer management of DNS records for the domain to another DNS hosting provider. In this guide, we show you how to transfer management of DNS records for a domain you registered with Lightsail to another DNS hosting provider.

**Important**  
Any changes you make to the DNS of your domain might require several hours to propagate through the internet’s DNS. Because of this, you should keep the DNS records of your domain in place at your current DNS hosting provider until the transfer of management is done. This ensures that traffic for your domain continues to route to your resources uninterrupted while the transfer takes place.

**Contents**
+ [Complete the prerequisites](#other-dns-service-prerequisites)
+ [Add records to the DNS zone](#other-dns-service-add-records-dns-zone)

## Complete the prerequisites


Complete the following prerequisites if you haven’t already done so:

1. Register a domain name. You can register a domain name using Lightsail. For more information, see [Register a new domain](amazon-lightsail-register-new-domain.md).

1. Use the process that’s provided by your DNS service to get the name servers for your domain.

## Add records to the DNS zone


Complete the following procedure to add the name servers for another DNS hosting provider into your registered domain in Lightsail.

1. Sign in to the [Lightsail console](https://lightsail.aws.amazon.com/).

1. Choose the **Domains & DNS** tab.

1. Choose the name of the domain that you want to configure to use another DNS service.

1. Choose **Edit Name Servers**.

1. Change the names of the name servers to the name servers that you got from your DNS service when you completed the prerequisites.

1. Choose **Save**.

# Point a domain to your Lightsail instance using Amazon Route 53
Use Route 53

The DNS zone in Amazon Lightsail makes it easy to point a registered domain name, like `example.com`, to your website running on a Lightsail instance. You can create up to six Lightsail DNS zones, and not all DNS record types are supported. For more information about Lightsail DNS zones, see [DNS](understanding-dns-in-amazon-lightsail.md).

If the Lightsail DNS zone is too limited for you, then we recommend using an Amazon Route 53 hosted zone to manage your domain’s DNS records. You can manage the DNS for up to 500 domains using Route 53, and it supports a greater variety of DNS record types. Or, you might already be using Route 53 to manage your domain’s DNS records and prefer to continue using it. This guide shows you how to edit the DNS records for a domain managed in Route 53 to point to your Lightsail instance.

## Prerequisites


Complete the following prerequisites if you haven’t already done so:
+ Register a domain name using Route 53. For more information, see [Registering a New Domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html) in the Route 53 documentation.
+ If you already registered a domain but you’re not using Route 53 to manage its records, then you must transfer management of the DNS records for your domain to Route 53. For more information, see [Making Amazon Route 53 the DNS Service for an Existing Domain](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html) in the Route 53 documentation.
+ Create a public hosted zone for your domain in Route 53. For more information, see [Creating a Public Hosted Zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html) in the Route 53 documentation.
+ Create a static IP and attach it to your Lightsail instance. In this guide, you create a DNS record in your domain’s Route 53 hosted zone that resolves to the static IP address (public IP address) of your instance. For more information, see [Create a static IP and attach it to an instance](lightsail-create-static-ip.md).

## Point a domain to a Lightsail instance using Route 53


Complete the following steps to create an address (A) record in Route 53 to point your domain to a Lightsail instance.

**Note**  
This procedure is also documented in the Route 53 Developer Guide. For more information, see [Creating Records by Using the Amazon Route 53 Console](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating.html) in the Route 53 documentation.

1. Sign in to the [Route 53 console](https://console.aws.amazon.com/route53).

1. In the navigation pane, choose **Hosted zones**.

1. Choose the hosted zone for the domain name that you want to use to route traffic to your load balancer.

1. Choose **Create record**.

   The **Quick create record** page appears.  
![\[Create a record in Route 53 to point an alias to your Lightsail load balancer\]](http://docs.aws.amazon.com/lightsail/latest/userguide/images/create-record-set-alias-record-route-53-blank.png)
**Note**  
If you see the **Choose routing policy** page, then choose **Switch to quick create** to switch to the quick create wizard before continuing with the following steps.

1. Keep the **Record name** text box empty to point the apex of your domain, such as `example.com`, to an IP address, or enter a subdomain.

1. For **Record type**, choose **A - Routes traffic to an IPv4 address and some AWS resources**.

1. Enter the static IP address (public IP address) of your Lightsail instance in the **Value** text box.

1. Keep the TTL of 300, and the routing policy as **Simple routing**.  
![\[Address record example in a Route 53 hosted zone.\]](http://docs.aws.amazon.com/lightsail/latest/userguide/images/amazon-lightsail-route-53-hosted-zone-a-record.png)

1. Choose **Create records** to add the record to your hosted zone.
**Note**  
Allow time for the change to propagate through the internet's DNS. This may take a few minutes to several hours.

   To edit an existing record set in the Route 53 hosted zone, choose the record to edit, enter your changes, and then choose **Save**.