

# IP-based routing
<a name="routing-policy-ipbased"></a>

With IP-based routing in Amazon Route 53, you can fine-tune your DNS routing by using your understanding of your network, applications, and clients to make the best DNS routing decisions for your end users. IP-based routing gives you granular control to optimize performance or reduce network costs by uploading your data to Route 53 in the form of user-IP-to-endpoint mappings.

Geolocation and latency-based routing is based on data that Route 53 collects and keeps up to date. This approach works well for the majority of customers, but IP-based routing offers you the additional ability to optimize routing based on specific knowledge of your customer base. For example, a global video content provider might want to route end users from a particular internet service provider (ISP).

Some common use cases for IP-based routing are the following:
+ You want to route end users from certain ISPs to specific endpoints so you can optimize network transit costs or performance.
+ You want to add overrides to existing Route 53 routing types, such as geolocation routing, based on your knowledge of your clients' physical locations.

**Managing IP ranges and associating them to a resource record set (RRSet)**  
 For IPv4, you can use CIDR blocks between 1 and 24 bits of length, inclusive, while for IPv6, you can use CIDR blocks between 1 and 48 bits of length, inclusive. To define a zero bit CIDR block (0.0.0.0/0 or ::/0), use the default ("\$1") location.

For DNS queries with a CIDR longer than the one specified in the CIDR collection, Route 53 will match it to the shorter CIDR. For example, if you specify 2001:0DB8::/32 as the CIDR block in your CIDR collection and a query originates from 2001:0DB8:0000:1234::/48, it will match. If, on the other hand, you specify 2001:0DB8:0000:1234::/48 in your CIDR collection and a query originates from 2001:0DB8::/32, this will not match and Route 53 will answer with the record for the default ("\$1") location.

You can group sets of CIDR blocks (or IP ranges) into CIDR locations, which are in turn grouped into reusable entities called CIDR collections:

**CIDR block**  
An IP range in CIDR notation, for example, 192.0.2.0/24 or 2001:DB8::/32.

**CIDR location**  
A named list of CIDR blocks. For example, example-isp-seattle = [192.0.2.0/24, 203.0.113.0/22, 198.51.100.0/24, 2001:DB8::/32 ]. The blocks in a CIDR location list don't have to be adjacent or the same range.   
A single location can have both IPv4 and IPv6 blocks, and this location can be associated to both A and AAAA record sets, respectively.   
The location name is often a location by convention, but can be any string, for example, *Company-A*.

**CIDR collection**  
A named collection of locations. For example, mycollection = [example-isp-seattle, example-isp-tokyo].  
IP-based routing resource record sets reference a location in a collection, and all resource record sets for the same record set name and type must reference the same collection. For example, if you create websites in two Regions and want to direct DNS queries from two different CIDR locations to a specific website based on the originating IP addresses, then both of those locations must be listed in the same CIDR collection.

You cannot use IP-based routing policy for records in a private hosted zone.

For information about values that you specify when you use the IP-based routing policy to create records, see the following topics:
+ [Values specific for IP-based records](resource-record-sets-values-ipbased.md)
+ [Values specific for IP-based alias records](resource-record-sets-values-ipbased-alias.md)
+ [Values that are common for all routing policies](resource-record-sets-values-shared.md)
+ [Values that are common for alias records for all routing policies](resource-record-sets-values-alias-common.md)

**Topics**
+ [

# Creating a CIDR collection with CIDR locations and blocks
](resource-record-sets-creating-cidr-collection.md)
+ [

# Working with CIDR locations and blocks
](resource-record-sets-working-with-cidr-locations.md)
+ [

# Deleting a CIDR collection
](resource-record-sets-delete-cidr-collection.md)
+ [

# Moving a geolocation to IP-based routing
](resource-record-sets-move-geolocation-to-cidr.md)

# Creating a CIDR collection with CIDR locations and blocks
<a name="resource-record-sets-creating-cidr-collection"></a>



To get started, create a CIDR collection and add CIDR blocks and locations to it.<a name="CIDR-collection-creating-procedure"></a>

**To create a CIDR collection using the Route 53 console**

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

1. In the navigation pane, choose **IP-based routing**, and then **CIDR collections**.

1. Select **Create CIDR collection**.

1. In the **Create CIDR collection** pane, under **Details**, enter a name for the collection.

1. Choose **Create collection** to create an empty collection.

   - or -

   In the **Create CIDR locations** section, enter a name for the CIDR location in the **CIDR location** box. The location name can be any identifying string, for example **company 1**, or **Seattle**. It doesn't have to be an actual geographic location.
**Important**  
The CIDR location name has a maximum length of 16 characters.

   Enter the CIDR blocks in the **CIDR blocks** box one per line. These can be IPv4 or IPv6 addresses ranging from /0 to /24 for IPv4 and /0 to /48 for IPv6.

1. After you have entered the CIDR blocks, choose **Create CIDR collection**, or **Add another location** to keep entering locations and CIDR block. You can enter multiple CIDR locations per collection.

1. After you have entered CIDR locations, choose **Create CIDR collection**.

# Working with CIDR locations and blocks
<a name="resource-record-sets-working-with-cidr-locations"></a>

<a name="CIDR-locations-work-with-procedure"></a>

**To work with CIDR locations by using the Route 53 console**

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

1. In the navigation pane, choose **IP-based routing**, **CIDR collections** and then, in the **CIDR collections** section, click on a link to a CIDR collection in the **Collection name** list.

   On the **CIDR locations** page, you can create a CIDR location, delete it, or edit a location and its blocks.
   + To create a location, choose **Create CIDR location**. 
   + In the **Create CIDR location** pane, enter a name for the location, the CIDR blocks associated with the location, and then choose **Create**.
   + To view a CIDR location and the blocks within, choose the radio button next to a location to display its name and CIDR blocks in the location pane.

     In this pane, you can also choose **Edit** to update the name of the location or its CIDR blocks. Choose **Save** when you have finished editing.
   + To delete a CIDR location and the blocks within, choose the radio button next to the location you want to delete, and then choose **Delete**. To confirm deletion, enter the location name in the text input field and choose **Delete** again.
**Important**  
Deleting a CIDR location can't be undone. If you have any DNS records associated with the location, your domain might become unreachable.

# Deleting a CIDR collection
<a name="resource-record-sets-delete-cidr-collection"></a>

<a name="CIDR-collection-delete-procedure"></a>

**To delete a CIDR collection, its locations, and blocks by using the Route 53 console**

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

1. In the navigation pane, choose **IP-based routing** and then **CIDR collections**.

1. In the **CIDR collections** section, click the linked name of the collection that you want to delete.

1. On the **CIDR locations** page, select each location one at a time, choose **Delete**, enter its name in the dialog box, and then choose **Delete**. You must delete each location associated with a CIDR collection before you can delete the collection.

1. After the deletion of each CIDR location is complete, on the **CIDR locations** page, choose the radio button next to the collection you want to delete, and then choose **Delete**.

# Moving a geolocation to IP-based routing
<a name="resource-record-sets-move-geolocation-to-cidr"></a>

If you are using either geolocation or geoproximity routing policies, and you’re consistently seeing specific clients routed to an endpoint that isn’t optimal based on their physical location or network topology, you can better target these clients’ public IP ranges by using IP-based routing.

The following table contains an example geolocation configuration for an existing geolocation routing that we will fine-tune for California IP ranges.


| Record set name | Routing policy and origin | IP address of the application endpoint  | 
| --- | --- | --- | 
|  example.com  |  Geolocation-routing (US)  |  `198.51.100.1`  | 
|  example.com  |  Geolocation-routing (EU)   |  `198.51.100.2`  | 

To override IP ranges from California to go to a new application endpoint, first recreate the geolocation routing under a new record set name.


| Record set name | Routing policy and origin | IP address of the application endpoint  | 
| --- | --- | --- | 
|  geo.example.com  |  Geolocation-routing (US)  |  `198.51.100.1`  | 
|  geo.example.com  |  Geoloaction-routing (EU)   |  `198.51.100.2`  | 

Then, create IP-based routing records and a default record that points to your recently recreated geolocation routing recordset. 


| Record set name | Routing policy and origin | IP address of the application endpoint  | 
| --- | --- | --- | 
|  example.com  |  IP-based routing (default)   |  Alias record to geo.example.com application endpoint that you want to be the default. For example, `198.51.100.1`.  | 
|  example.com  |  IP-based routing (California IP ranges)   |  `198.51.100.3`  | 